diff options
| author | Radu Nicolae <rnicolae04@gmail.com> | 2024-04-22 13:51:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-22 13:51:39 +0200 |
| commit | d4c1d8468a17eb7adf8bf20949c2fdc4b2f93fec (patch) | |
| tree | 3ab47cd41633615ae187c2a2923ac09ae48ccbd3 /opendc-experiments/opendc-experiments-portfolio/src/main/kotlin | |
| parent | d652fa2fa76556edd81d3b8087a0c943d462ec49 (diff) | |
Merged scenario and portfolio (#220)
* sync with the master branch
* rebase
* multimodel - simulation is currently run as many times as you can see a model
* factory method - handles models without given params
* removed redundant flags
* modelType
* flags removed
* implemented output into a folder
* multimodel ipynb setup - to be implemented and also ran as a python script, when the simulation occurs
* towards a mutimodel python implementation - issue observed - the saved files have same data?
* json parsing handles now lists for topology, workloads, allocaitonPolicies, powerModels
* scenarioFile inputs lists, and creates multiple combinations of scenarios
* multi-model prediction repaired, now we predict using multiple models
* commit before removing powerModel from scenario
* commit after removing powerModel from scenario
* commit after removing powerModel from scenario (and actually running)
* powermodels now can output their name and full name (with min and max)
* now we can select where to output (seed or output folder)
* input files - clear naming + output naming improved
* minimal changes
* all tests passing + json files from tests updated to the new json format
* json files from topology now accept only one power model (instead of list)
* json files from topology now accept only one power model (instead of list)
* multi and single input from tests updated to match the format
* tests passed locally
* spotless applies
* demo folder removed
Diffstat (limited to 'opendc-experiments/opendc-experiments-portfolio/src/main/kotlin')
2 files changed, 0 insertions, 133 deletions
diff --git a/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/ExamplePortfolio.kt b/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/ExamplePortfolio.kt deleted file mode 100644 index b5b174b6..00000000 --- a/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/ExamplePortfolio.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2022 AtLarge Research - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package org.opendc.experiments.scenario - -import org.opendc.compute.service.scheduler.ComputeSchedulerEnum -import org.opendc.experiments.base.models.portfolio.Portfolio -import org.opendc.experiments.base.models.scenario.AllocationPolicySpec -import org.opendc.experiments.base.models.scenario.FailureModelSpec -import org.opendc.experiments.base.models.scenario.Scenario -import org.opendc.experiments.base.models.scenario.ScenarioSpec -import org.opendc.experiments.base.models.scenario.TopologySpec -import org.opendc.experiments.base.models.scenario.WorkloadSpec -import org.opendc.experiments.base.models.scenario.WorkloadTypes -import org.opendc.experiments.base.models.scenario.getScenario - -/** - * A [Portfolio] that explores the difference between horizontal and vertical scaling. - */ -public fun getExamplePortfolio(): Portfolio { - val topologies = - listOf( - TopologySpec("resources/env/single.json"), - TopologySpec("resources/env/multi.json"), - ) - - val workloads = - listOf( - WorkloadSpec("resources/bitbrains-small", type = WorkloadTypes.ComputeWorkload), - ) - - val failureModel = FailureModelSpec(0.0) - val allocationPolicy = AllocationPolicySpec(ComputeSchedulerEnum.ActiveServers) - - val scenarios: Iterable<Scenario> = - topologies.flatMap { topology -> - workloads.map { workload -> - getScenario( - ScenarioSpec( - topology, - workload, - allocationPolicy, - failureModel, - ), - ) - } - } - - return Portfolio(scenarios) -} diff --git a/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/PortfolioCli.kt b/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/PortfolioCli.kt deleted file mode 100644 index 10ba33d6..00000000 --- a/opendc-experiments/opendc-experiments-portfolio/src/main/kotlin/org/opendc/experiments/scenario/PortfolioCli.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2022 AtLarge Research - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -@file:JvmName("PortfolioCli") - -package org.opendc.experiments.portfolio - -import com.github.ajalt.clikt.core.CliktCommand -import com.github.ajalt.clikt.parameters.options.default -import com.github.ajalt.clikt.parameters.options.defaultLazy -import com.github.ajalt.clikt.parameters.options.option -import com.github.ajalt.clikt.parameters.types.file -import com.github.ajalt.clikt.parameters.types.int -import org.opendc.experiments.base.models.portfolio.getPortfolio -import org.opendc.experiments.base.runner.runPortfolio -import java.io.File - -/** - * Main entrypoint of the application. - */ -public fun main(args: Array<String>): Unit = PortfolioCommand().main(args) - -/** - * Represents the command for the Portfolio experiments. - */ -internal class PortfolioCommand : CliktCommand(name = "portfolio") { - /** - * The path to the environment directory. - */ - private val portfolioPath by option("--portfolio-path", help = "path to portfolio file") - .file(canBeDir = false, canBeFile = true) - .defaultLazy { File("resources/portfolio.json") } - - /** - * The number of threads to use for parallelism. - */ - private val parallelism by option("-p", "--parallelism", help = "number of worker threads") - .int() - .default(Runtime.getRuntime().availableProcessors() - 1) - - override fun run() { - val portfolio = getPortfolio(portfolioPath) - runPortfolio(portfolio, parallelism) - } -} |
