diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioReplayer.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioReplayer.kt index 8fb4a938d..970754b0a 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioReplayer.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioReplayer.kt @@ -24,6 +24,7 @@ package org.opendc.experiments.base.runner +import CheckpointModelSpec import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -35,7 +36,6 @@ import org.opendc.compute.api.ServerWatcher import org.opendc.compute.failure.models.FailureModel import org.opendc.compute.service.ComputeService import org.opendc.compute.workload.VirtualMachine -import org.opendc.experiments.base.scenario.specs.CheckpointModelSpec import org.opendc.experiments.base.scenario.specs.FailureModelSpec import org.opendc.experiments.base.scenario.specs.createFailureModel import java.time.InstantSource diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioRunner.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioRunner.kt index b48b8fe6e..5a37a0b9c 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioRunner.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioRunner.kt @@ -22,6 +22,7 @@ package org.opendc.experiments.base.runner +import getWorkloadType import me.tongfei.progressbar.ProgressBarBuilder import me.tongfei.progressbar.ProgressBarStyle import org.opendc.compute.carbon.CarbonTrace @@ -36,7 +37,6 @@ import org.opendc.compute.telemetry.export.parquet.ParquetComputeMonitor import org.opendc.compute.topology.clusterTopology import org.opendc.compute.workload.ComputeWorkloadLoader import org.opendc.experiments.base.scenario.Scenario -import org.opendc.experiments.base.scenario.specs.getWorkloadType import org.opendc.simulator.kotlin.runSimulation import java.io.File import java.time.Duration @@ -60,7 +60,7 @@ public fun runScenarios( setupOutputFolderStructure(scenarios[0].outputFolder) - for (scenario in scenarios) { + for ((i, scenario) in scenarios.withIndex()) { val pool = ForkJoinPool(parallelism) println( "\n\n$ansiGreen================================================================================$ansiReset", @@ -70,6 +70,7 @@ public fun runScenarios( runScenario( scenario, pool, + i, ) } } @@ -84,6 +85,7 @@ public fun runScenarios( public fun runScenario( scenario: Scenario, pool: ForkJoinPool, + index: Int = -1, ) { val pb = ProgressBarBuilder().setInitialMax(scenario.runs.toLong()).setStyle(ProgressBarStyle.ASCII) @@ -91,7 +93,7 @@ public fun runScenario( pool.submit { LongStream.range(0, scenario.runs.toLong()).parallel().forEach { - runScenario(scenario, scenario.initialSeed + it) + runScenario(scenario, scenario.initialSeed + it, index) pb.step() } pb.close() @@ -107,6 +109,7 @@ public fun runScenario( public fun runScenario( scenario: Scenario, seed: Long, + index: Int = 0, ): Unit = runSimulation { val serviceDomain = "compute.opendc.org" @@ -126,7 +129,7 @@ public fun runScenario( val carbonTrace = getCarbonTrace(scenario.carbonTracePath) val startTime = Duration.ofMillis(vms.minOf { it.startTime }.toEpochMilli()) - addExportModel(provisioner, serviceDomain, scenario, seed, startTime, carbonTrace, scenario.id) + addExportModel(provisioner, serviceDomain, scenario, seed, startTime, carbonTrace, index) val service = provisioner.registry.resolve(serviceDomain, ComputeService::class.java)!! service.replay(timeSource, vms, failureModelSpec = scenario.failureModelSpec, seed = seed) diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt index 9ce462f4e..02a8234db 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt @@ -22,12 +22,12 @@ package org.opendc.experiments.base.scenario -import org.opendc.experiments.base.scenario.specs.AllocationPolicySpec -import org.opendc.experiments.base.scenario.specs.CheckpointModelSpec -import org.opendc.experiments.base.scenario.specs.ExportModelSpec +import AllocationPolicySpec +import CheckpointModelSpec +import ExportModelSpec +import ScenarioTopologySpec +import WorkloadSpec import org.opendc.experiments.base.scenario.specs.FailureModelSpec -import org.opendc.experiments.base.scenario.specs.ScenarioTopologySpec -import org.opendc.experiments.base.scenario.specs.WorkloadSpec /** * A data class representing a scenario for a set of experiments. diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt index e47d9c58f..e7b52c555 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt @@ -23,7 +23,6 @@ package org.opendc.experiments.base.scenario import org.opendc.experiments.base.scenario.specs.ScenarioSpec -import org.opendc.experiments.base.scenario.specs.ScenariosSpec import java.io.File private val scenarioReader = ScenarioReader() @@ -53,11 +52,11 @@ public fun getScenarios(file: File): List { * Returns a list of Scenarios from a given ScenarioSpec by generating all possible combinations of * workloads, allocation policies, failure models, and export models within a topology. * - * @param scenariosSpec The ScenarioSpec containing the scenario specifications. + * @param scenarioSpec The ScenarioSpec containing the scenario specifications. * @return A list of Scenarios. */ -public fun getScenarios(scenariosSpec: ScenariosSpec): List { - val outputFolder = scenariosSpec.outputFolder + "/" + scenariosSpec.name +public fun getScenarios(scenarioSpec: ScenarioSpec): List { + val outputFolder = scenarioSpec.outputFolder + "/" + scenarioSpec.name File(outputFolder).mkdirs() val trackrPath = "$outputFolder/trackr.json" @@ -65,26 +64,36 @@ public fun getScenarios(scenariosSpec: ScenariosSpec): List { val scenarios = mutableListOf() - val cartesianInput = scenariosSpec.getCartesian() - - for ((scenarioID, scenarioSpec) in cartesianInput.withIndex()) { - val scenario = - Scenario( - id = scenarioID, - topologySpec = scenarioSpec.topology, - workloadSpec = scenarioSpec.workload, - allocationPolicySpec = scenarioSpec.allocationPolicy, - failureModelSpec = scenarioSpec.failureModel, - checkpointModelSpec = scenarioSpec.checkpointModel, - carbonTracePath = scenarioSpec.carbonTracePath, - exportModelSpec = scenarioSpec.exportModel, - outputFolder = outputFolder, - name = scenarioID.toString(), - runs = scenariosSpec.runs, - initialSeed = scenariosSpec.initialSeed, - ) - trackScenario(scenarioSpec, outputFolder) - scenarios.add(scenario) + for ((scenarioID, scenarioTopologySpec) in scenarioSpec.topologies.withIndex()) { + for (workloadSpec in scenarioSpec.workloads) { + for (allocationPolicySpec in scenarioSpec.allocationPolicies) { + for (failureModelSpec in scenarioSpec.failureModels) { + for (checkpointModelSpec in scenarioSpec.checkpointModels) { + for (carbonTracePath in scenarioSpec.carbonTracePaths) { + for (exportModelSpec in scenarioSpec.exportModels) { + val scenario = + Scenario( + id = scenarioID, + topologySpec = scenarioTopologySpec, + workloadSpec = workloadSpec, + allocationPolicySpec = allocationPolicySpec, + failureModelSpec = failureModelSpec, + checkpointModelSpec = checkpointModelSpec, + carbonTracePath = carbonTracePath, + exportModelSpec = exportModelSpec, + outputFolder = outputFolder, + name = scenarioID.toString(), + runs = scenarioSpec.runs, + initialSeed = scenarioSpec.initialSeed, + ) + trackScenario(scenarioSpec, outputFolder, scenario) + scenarios.add(scenario) + } + } + } + } + } + } } return scenarios @@ -93,7 +102,7 @@ public fun getScenarios(scenariosSpec: ScenariosSpec): List { /** * Writes a ScenarioSpec to a file. * - * @param scenariosSpec The ScenarioSpec. + * @param scenarioSpec The ScenarioSpec. * @param outputFolder The output folder path. * @param scenario The Scenario. * @param topologySpec The TopologySpec. @@ -102,10 +111,24 @@ public fun getScenarios(scenariosSpec: ScenariosSpec): List { public fun trackScenario( scenarioSpec: ScenarioSpec, outputFolder: String, + scenario: Scenario, ) { val trackrPath = "$outputFolder/trackr.json" scenarioWriter.write( - scenarioSpec, + ScenarioSpec( + id = scenario.id, + name = scenarioSpec.name, + topologies = listOf(scenario.topologySpec), + workloads = listOf(scenario.workloadSpec), + allocationPolicies = listOf(scenario.allocationPolicySpec), + failureModels = listOf(scenario.failureModelSpec), + checkpointModels = listOf(scenario.checkpointModelSpec), + carbonTracePaths = listOf(scenario.carbonTracePath), + exportModels = listOf(scenario.exportModelSpec), + outputFolder = scenario.outputFolder, + initialSeed = scenario.initialSeed, + runs = scenario.runs, + ), File(trackrPath), ) diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt index a7cda768a..3bbd500b1 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt @@ -25,7 +25,7 @@ package org.opendc.experiments.base.scenario import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.json.decodeFromStream -import org.opendc.experiments.base.scenario.specs.ScenariosSpec +import org.opendc.experiments.base.scenario.specs.ScenarioSpec import java.io.File import java.io.InputStream import java.nio.file.Path @@ -36,24 +36,24 @@ public class ScenarioReader { private val jsonReader = Json @OptIn(ExperimentalSerializationApi::class) - public fun read(file: File): ScenariosSpec { + public fun read(file: File): ScenarioSpec { val input = file.inputStream() - return jsonReader.decodeFromStream(input) + return jsonReader.decodeFromStream(input) } @OptIn(ExperimentalSerializationApi::class) - public fun read(path: Path): ScenariosSpec { + public fun read(path: Path): ScenarioSpec { val input = path.inputStream() - return jsonReader.decodeFromStream(input) + return jsonReader.decodeFromStream(input) } /** * Read the specified [input]. */ @OptIn(ExperimentalSerializationApi::class) - public fun read(input: InputStream): ScenariosSpec { - return jsonReader.decodeFromStream(input) + public fun read(input: InputStream): ScenarioSpec { + return jsonReader.decodeFromStream(input) } } diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioWriter.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioWriter.kt index a582d1405..8d99647a6 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioWriter.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioWriter.kt @@ -37,7 +37,7 @@ public class ScenarioWriter { private val json = Json { prettyPrint = true } /** - * Write the given [scenariosSpec] to the given [file]. + * Write the given [scenarioSpec] to the given [file]. */ public fun write( scenarioSpec: ScenarioSpec, diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt index edfdfaf53..f7ae7e9f5 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable import org.opendc.compute.service.scheduler.ComputeSchedulerEnum @@ -34,7 +32,7 @@ import org.opendc.compute.service.scheduler.ComputeSchedulerEnum */ @Serializable public data class AllocationPolicySpec( - val policyType: ComputeSchedulerEnum = ComputeSchedulerEnum.Mem, + val policyType: ComputeSchedulerEnum, ) { public val name: String = policyType.toString() } diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/CheckpointModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/CheckpointModelSpec.kt index 6147d25d3..9432fc9be 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/CheckpointModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/CheckpointModelSpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable @Serializable diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt index d51de27bf..9a23ad001 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable /** diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt index f9679b26f..fc5689258 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable @Serializable diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioSpec.kt new file mode 100644 index 000000000..eb3cd04e4 --- /dev/null +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioSpec.kt @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 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.base.scenario.specs + +import AllocationPolicySpec +import CheckpointModelSpec +import ExportModelSpec +import ScenarioTopologySpec +import WorkloadSpec +import kotlinx.serialization.Serializable +import java.util.UUID + +/** + * specification describing a scenario + * + * @property topologies + * @property workloads + * @property allocationPolicies + * @property failureModels + * @property exportModels + * @property outputFolder + * @property initialSeed + * @property runs + */ +@Serializable +public data class ScenarioSpec( + var id: Int = -1, + var name: String = "", + val topologies: List, + val workloads: List, + val allocationPolicies: List, + val failureModels: List = listOf(null), + val checkpointModels: List = listOf(null), + val carbonTracePaths: List = listOf(null), + val exportModels: List = listOf(ExportModelSpec()), + val outputFolder: String = "output", + val initialSeed: Int = 0, + val runs: Int = 1, +) { + init { + require(runs > 0) { "The number of runs should always be positive" } + + // generate name if not provided + // TODO: improve this + if (name == "") { + name = "unnamed-simulation-${UUID.randomUUID().toString().substring(0, 4)}" +// "workload=${workloads[0].name}_topology=${topologies[0].name}_allocationPolicy=${allocationPolicies[0].name}" + } + } +} diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt index feaca0c68..47d3447fc 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable import java.io.File diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenariosSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenariosSpec.kt deleted file mode 100644 index da3ceecf4..000000000 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenariosSpec.kt +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2024 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.base.scenario.specs - -import kotlinx.serialization.Serializable -import java.util.UUID - -@Serializable -public data class ScenarioSpec( - var id: Int = -1, - var name: String = "", - val outputFolder: String = "output", - val topology: ScenarioTopologySpec, - val workload: WorkloadSpec, - val allocationPolicy: AllocationPolicySpec = AllocationPolicySpec(), - val exportModel: ExportModelSpec = ExportModelSpec(), - val failureModel: FailureModelSpec? = null, - val checkpointModel: CheckpointModelSpec? = null, - val carbonTracePath: String? = null, -) - -/** - * specification describing a scenario - * - * @property topologies - * @property workloads - * @property allocationPolicies - * @property failureModels - * @property exportModels - * @property outputFolder - * @property initialSeed - * @property runs - */ -@Serializable -public data class ScenariosSpec( - var id: Int = -1, - var name: String = "", - val outputFolder: String = "output", - val initialSeed: Int = 0, - val runs: Int = 1, - val topologies: Set, - val workloads: Set, - val allocationPolicies: Set = setOf(AllocationPolicySpec()), - val exportModels: Set = setOf(ExportModelSpec()), - val failureModels: Set = setOf(null), - val checkpointModels: Set = setOf(null), - val carbonTracePaths: Set = setOf(null), -) { - init { - require(runs > 0) { "The number of runs should always be positive" } - - // generate name if not provided - // TODO: improve this - if (name == "") { - name = "unnamed-simulation-${UUID.randomUUID().toString().substring(0, 4)}" -// "workload=${workloads[0].name}_topology=${topologies[0].name}_allocationPolicy=${allocationPolicies[0].name}" - } - } - - public fun getCartesian(): Sequence { - return sequence { - val checkpointDiv = carbonTracePaths.size - val failureDiv = checkpointDiv * checkpointModels.size - val exportDiv = failureDiv * failureModels.size - val allocationDiv = exportDiv * exportModels.size - val workloadDiv = allocationDiv * allocationPolicies.size - val topologyDiv = workloadDiv * workloads.size - val numScenarios = topologyDiv * topologies.size - - val topologyList = topologies.toList() - val workloadList = workloads.toList() - val allocationPolicyList = allocationPolicies.toList() - val exportModelList = exportModels.toList() - val failureModelList = failureModels.toList() - val checkpointModelList = checkpointModels.toList() - val carbonTracePathList = carbonTracePaths.toList() - - for (i in 0 until numScenarios) { - yield( - ScenarioSpec( - id, - name, - outputFolder, - topologyList[(i / topologyDiv) % topologyList.size], - workloadList[(i / workloadDiv) % workloadList.size], - allocationPolicyList[(i / allocationDiv) % allocationPolicyList.size], - exportModelList[(i / exportDiv) % exportModelList.size], - failureModelList[(i / failureDiv) % failureModelList.size], - checkpointModelList[(i / checkpointDiv) % checkpointModelList.size], - carbonTracePathList[i % carbonTracePathList.size], - ), - ) - } - } - } -} diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt index c104d759d..819f633d7 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt @@ -20,8 +20,6 @@ * SOFTWARE. */ -package org.opendc.experiments.base.scenario.specs - import kotlinx.serialization.Serializable import org.opendc.compute.workload.ComputeWorkload import org.opendc.compute.workload.sampleByLoad