diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-04-29 13:51:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 13:51:36 +0200 |
| commit | 1b8e81343f576b0a29cf94e02e0429f5011b1f52 (patch) | |
| tree | 3abefbc3fabe6d51dd34df0ffb2dd3a4daf2d5b0 | |
| parent | 2dc44c7283200f4689cc1be15115a8b1cd37d456 (diff) | |
Reworked Scenario.kt to consist of only specifications. The Specs are turned into objects when the scenario is being executed by ScenarioRunner.kt (#227)
18 files changed, 89 insertions, 149 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt index 549086d4..bab886a4 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt @@ -24,10 +24,10 @@ package org.opendc.compute.topology -import org.opendc.compute.topology.specs.ClusterJSONSpec +import org.opendc.compute.topology.specs.ClusterSpec import org.opendc.compute.topology.specs.HostJSONSpec import org.opendc.compute.topology.specs.HostSpec -import org.opendc.compute.topology.specs.TopologyJSONSpec +import org.opendc.compute.topology.specs.TopologySpec import org.opendc.simulator.compute.SimPsuFactories import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit @@ -46,6 +46,16 @@ import java.util.random.RandomGenerator private val reader = TopologyReader() /** + * Construct a topology from the specified [pathToFile]. + */ +public fun clusterTopology( + pathToFile: String, + random: RandomGenerator = SplittableRandom(0), +): List<HostSpec> { + return clusterTopology(File(pathToFile), random) +} + +/** * Construct a topology from the specified [file]. */ public fun clusterTopology( @@ -68,9 +78,9 @@ public fun clusterTopology( } /** - * Helper method to convert a [TopologyJSONSpec] into a list of [HostSpec]s. + * Helper method to convert a [TopologySpec] into a list of [HostSpec]s. */ -private fun TopologyJSONSpec.toHostSpecs(random: RandomGenerator): List<HostSpec> { +private fun TopologySpec.toHostSpecs(random: RandomGenerator): List<HostSpec> { return clusters.flatMap { cluster -> List(cluster.count) { cluster.toHostSpecs(random) @@ -79,11 +89,11 @@ private fun TopologyJSONSpec.toHostSpecs(random: RandomGenerator): List<HostSpec } /** - * Helper method to convert a [ClusterJSONSpec] into a list of [HostSpec]s. + * Helper method to convert a [ClusterSpec] into a list of [HostSpec]s. */ private var clusterId = 0 -private fun ClusterJSONSpec.toHostSpecs(random: RandomGenerator): List<HostSpec> { +private fun ClusterSpec.toHostSpecs(random: RandomGenerator): List<HostSpec> { val hostSpecs = hosts.flatMap { host -> ( diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt index 70e08e3b..63719c0a 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt @@ -25,7 +25,7 @@ package org.opendc.compute.topology import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.json.decodeFromStream -import org.opendc.compute.topology.specs.TopologyJSONSpec +import org.opendc.compute.topology.specs.TopologySpec import java.io.File import java.io.InputStream @@ -34,9 +34,9 @@ import java.io.InputStream */ public class TopologyReader { @OptIn(ExperimentalSerializationApi::class) - public fun read(file: File): TopologyJSONSpec { + public fun read(file: File): TopologySpec { val input = file.inputStream() - val obj = Json.decodeFromStream<TopologyJSONSpec>(input) + val obj = Json.decodeFromStream<TopologySpec>(input) return obj } @@ -45,8 +45,8 @@ public class TopologyReader { * Read the specified [input]. */ @OptIn(ExperimentalSerializationApi::class) - public fun read(input: InputStream): TopologyJSONSpec { - val obj = Json.decodeFromStream<TopologyJSONSpec>(input) + public fun read(input: InputStream): TopologySpec { + val obj = Json.decodeFromStream<TopologySpec>(input) return obj } } diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt index 2bfed502..f34bc855 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt @@ -30,8 +30,8 @@ import kotlinx.serialization.Serializable * @param clusters List of the clusters in this topology */ @Serializable -public data class TopologyJSONSpec( - val clusters: List<ClusterJSONSpec>, +public data class TopologySpec( + val clusters: List<ClusterSpec>, val schemaVersion: Int = 1, ) @@ -43,7 +43,7 @@ public data class TopologyJSONSpec( * @param location Location of the cluster. This can impact the carbon intensity */ @Serializable -public data class ClusterJSONSpec( +public data class ClusterSpec( val name: String = "Cluster", val count: Int = 1, val hosts: List<HostJSONSpec>, @@ -62,9 +62,9 @@ public data class ClusterJSONSpec( @Serializable public data class HostJSONSpec( val name: String = "Host", - val cpu: CPUJSONSpec, - val memory: MemoryJSONSpec, - val powerModel: PowerModelJSONSpec = PowerModelJSONSpec("linear", 350.0, 400.0, 200.0), + val cpu: CPUSpec, + val memory: MemorySpec, + val powerModel: PowerModelSpec = PowerModelSpec("linear", 350.0, 400.0, 200.0), val count: Int = 1, ) @@ -78,7 +78,7 @@ public data class HostJSONSpec( * @param coreSpeed The speed of the cores in Mhz */ @Serializable -public data class CPUJSONSpec( +public data class CPUSpec( val vendor: String = "unknown", val modelName: String = "unknown", val arch: String = "unknown", @@ -97,7 +97,7 @@ public data class CPUJSONSpec( * @param memorySize The size of the memory Unit in MiB */ @Serializable -public data class MemoryJSONSpec( +public data class MemorySpec( val vendor: String = "unknown", val modelName: String = "unknown", val arch: String = "unknown", @@ -106,7 +106,7 @@ public data class MemoryJSONSpec( ) @Serializable -public data class PowerModelJSONSpec( +public data class PowerModelSpec( val modelType: String, val power: Double = 400.0, val maxPower: Double, diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioHelpers.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioHelpers.kt index 97914556..e1305b3f 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioHelpers.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/runner/ScenarioHelpers.kt @@ -24,6 +24,7 @@ package org.opendc.experiments.base.runner +import FailureModelSpec import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -33,11 +34,8 @@ import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.ComputeService -import org.opendc.compute.simulator.failure.FailureModel import org.opendc.compute.workload.VirtualMachine import java.time.InstantSource -import java.util.Random -import kotlin.coroutines.coroutineContext import kotlin.math.max /** @@ -76,16 +74,16 @@ public class RunningServerWatcher : ServerWatcher { * @param trace The trace to simulate. * @param seed The seed to use for randomness. * @param submitImmediately A flag to indicate that the servers are scheduled immediately (so not at their start time). - * @param failureModel A failure model to use for injecting failures. + * @param failureModelSpec A failure model to use for injecting failures. */ public suspend fun ComputeService.replay( clock: InstantSource, trace: List<VirtualMachine>, - seed: Long, + failureModelSpec: FailureModelSpec? = null, + seed: Long = 0, submitImmediately: Boolean = false, - failureModel: FailureModel? = null, ) { - val injector = failureModel?.createInjector(coroutineContext, clock, this, Random(seed)) + // TODO: add failureModel functionality val client = newClient() // Create new image for the virtual machine @@ -93,8 +91,7 @@ public suspend fun ComputeService.replay( try { coroutineScope { - // Start the fault injector - injector?.start() + // TODO: start failure model when implemented var simulationOffset = Long.MIN_VALUE @@ -107,9 +104,6 @@ public suspend fun ComputeService.replay( simulationOffset = start - now } - // Make sure the trace entries are ordered by submission time - // assert(start - simulationOffset >= 0) { "Invalid trace order" } - // Delay the server based on the startTime given by the trace. if (!submitImmediately) { delay(max(0, (start - now - simulationOffset))) @@ -146,7 +140,7 @@ public suspend fun ComputeService.replay( } yield() } finally { - injector?.close() + // TODO: close failure model when implemented client.close() } } 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 734cdacc..bf5188a2 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 @@ -35,8 +35,9 @@ import org.opendc.compute.simulator.provisioner.registerComputeMonitor import org.opendc.compute.simulator.provisioner.setupComputeService import org.opendc.compute.simulator.provisioner.setupHosts 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.models.scenario.Scenario +import org.opendc.experiments.base.scenario.Scenario import org.opendc.simulator.kotlin.runSimulation import java.io.File import java.time.Duration @@ -47,10 +48,10 @@ import java.util.stream.LongStream /** * Run scenario when no pool is available for parallel execution * - * @param scenario The scenario to run + * @param scenarios The scenarios to run * @param parallelism The number of scenarios that can be run in parallel */ -public fun runScenario( +public fun runScenarios( scenarios: List<Scenario>, parallelism: Int, ) { @@ -110,12 +111,14 @@ public fun runScenario( runSimulation { val serviceDomain = "compute.opendc.org" Provisioner(dispatcher, seed).use { provisioner -> + + val topology = clusterTopology(scenario.topology.pathToFile, Random(seed)) provisioner.runSteps( setupComputeService( serviceDomain, { createComputeScheduler(ComputeSchedulerEnum.Mem, Random(it.seeder.nextLong())) }, ), - setupHosts(serviceDomain, scenario.topology, optimize = true), + setupHosts(serviceDomain, topology, optimize = true), ) val workloadLoader = ComputeWorkloadLoader(File(scenario.workload.pathToFile)) @@ -126,43 +129,11 @@ public fun runScenario( saveInOutputFolder(provisioner, serviceDomain, scenario, seed, startTime, carbonTrace) val service = provisioner.registry.resolve(serviceDomain, ComputeService::class.java)!! - service.replay(timeSource, vms, seed, failureModel = scenario.failureModel) + service.replay(timeSource, vms, failureModelSpec = scenario.failureModel, seed = seed) } } /** - * When the simulation is run, saves the simulation results into a seed folder. This is useful for debugging purposes. - * @param provisioner The provisioner used to setup and run the simulation. - * @param serviceDomain The domain of the compute service. - * @param scenario The scenario being run in the simulation. - * @param seed The seed used for randomness in the simulation. - * @param partition The partition name for the output data. - * @param startTime The start time of the simulation. - - */ -public fun saveInSeedFolder( - provisioner: Provisioner, - serviceDomain: String, - scenario: Scenario, - seed: Long, - partition: String, - startTime: Duration, -) { - provisioner.runStep( - registerComputeMonitor( - serviceDomain, - ParquetComputeMonitor( - File(scenario.outputFolder), - partition, - bufferSize = 4096, - ), - Duration.ofSeconds(scenario.exportModel.exportInterval), - startTime, - ), - ) -} - -/** * Saves the simulation results into a specific output folder received from the input. * * @param provisioner The provisioner used to setup and run the simulation. diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/Scenario.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt index bd4b5cc9..4f3fcd4f 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/Scenario.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/Scenario.kt @@ -20,13 +20,13 @@ * SOFTWARE. */ -package org.opendc.experiments.base.models.scenario +package org.opendc.experiments.base.scenario import AllocationPolicySpec import ExportModelSpec +import FailureModelSpec +import ScenarioTopologySpec import WorkloadSpec -import org.opendc.compute.simulator.failure.FailureModel -import org.opendc.compute.topology.specs.HostSpec /** * A data class representing a scenario for a set of experiments. @@ -42,10 +42,10 @@ import org.opendc.compute.topology.specs.HostSpec * @property initialSeed The Int representing the initial seed of the scenario. It defaults to 0. */ public data class Scenario( - val topology: List<HostSpec>, + val topology: ScenarioTopologySpec, val workload: WorkloadSpec, val allocationPolicy: AllocationPolicySpec, - val failureModel: FailureModel?, + val failureModel: FailureModelSpec?, val carbonTracePath: String? = null, val exportModel: ExportModelSpec = ExportModelSpec(), val outputFolder: String = "output", diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/ScenarioFactories.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt index 05fa762e..010c8845 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/ScenarioFactories.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioFactories.kt @@ -20,16 +20,12 @@ * SOFTWARE. */ -package org.opendc.experiments.base.models.scenario +package org.opendc.experiments.base.scenario import AllocationPolicySpec -import TopologySpec +import ScenarioTopologySpec import WorkloadSpec -import org.opendc.compute.simulator.failure.getFailureModel -import org.opendc.compute.topology.TopologyReader -import org.opendc.compute.topology.clusterTopology -import org.opendc.compute.topology.specs.TopologyJSONSpec -import org.opendc.experiments.base.models.scenario.specs.ScenarioSpec +import org.opendc.experiments.base.scenario.specs.ScenarioSpec import java.io.File private val scenarioReader = ScenarioReader() @@ -40,8 +36,8 @@ private val scenarioReader = ScenarioReader() * @param filePath The path to the file containing the scenario specifications. * @return A list of Scenarios. */ -public fun getScenario(filePath: String): List<Scenario> { - return getScenario(File(filePath)) +public fun getScenarios(filePath: String): List<Scenario> { + return getScenarios(File(filePath)) } /** @@ -50,18 +46,8 @@ public fun getScenario(filePath: String): List<Scenario> { * @param file The file containing the scenario specifications. * @return A list of Scenarios. */ -public fun getScenario(file: File): List<Scenario> { - return getScenario(scenarioReader.read(file)) -} - -/** - * Returns a list of Scenarios from a given ScenarioSpec. - * - * @param scenarioSpec The ScenarioSpec containing the scenario specifications. - * @return A list of Scenarios. - */ -public fun getScenario(scenarioSpec: ScenarioSpec): List<Scenario> { - return getScenarioCombinations(scenarioSpec) +public fun getScenarios(file: File): List<Scenario> { + return getScenarios(scenarioReader.read(file)) } /** @@ -71,30 +57,25 @@ public fun getScenario(scenarioSpec: ScenarioSpec): List<Scenario> { * @param scenarioSpec The ScenarioSpec containing the scenario specifications. * @return A list of Scenarios. */ -public fun getScenarioCombinations(scenarioSpec: ScenarioSpec): List<Scenario> { - val topologiesSpec = scenarioSpec.topologies - val workloads = scenarioSpec.workloads - val allocationPolicies = scenarioSpec.allocationPolicies - val failureModels = scenarioSpec.failureModels - val exportModels = scenarioSpec.exportModels +public fun getScenarios(scenarioSpec: ScenarioSpec): List<Scenario> { val scenarios = mutableListOf<Scenario>() - for (topology in topologiesSpec) { - for (workload in workloads) { - for (allocationPolicy in allocationPolicies) { - for (failureModel in failureModels) { + for (scenarioTopologySpec in scenarioSpec.topologies) { + for (workloadSpec in scenarioSpec.workloads) { + for (allocationPolicySpec in scenarioSpec.allocationPolicies) { + for (failureModelSpec in scenarioSpec.failureModels) { for (carbonTracePath in scenarioSpec.carbonTracePaths) { - for (exportModel in exportModels) { + for (exportModelSpec in scenarioSpec.exportModels) { val scenario = Scenario( - topology = clusterTopology(File(topology.pathToFile)), - workload = workload, - allocationPolicy = allocationPolicy, - failureModel = getFailureModel(failureModel.failureInterval), + topology = scenarioTopologySpec, + workload = workloadSpec, + allocationPolicy = allocationPolicySpec, + failureModel = failureModelSpec, carbonTracePath = carbonTracePath, - exportModel = exportModel, + exportModel = exportModelSpec, outputFolder = scenarioSpec.outputFolder, - name = getOutputFolderName(scenarioSpec, topology, workload, allocationPolicy), + name = getOutputFolderName(scenarioSpec, scenarioTopologySpec, workloadSpec, allocationPolicySpec), runs = scenarioSpec.runs, initialSeed = scenarioSpec.initialSeed, ) @@ -110,37 +91,22 @@ public fun getScenarioCombinations(scenarioSpec: ScenarioSpec): List<Scenario> { } /** - * Returns a list of TopologyJSONSpec from a given list of TopologySpec. - * - * @param topologies The list of TopologySpec. - * @return A list of TopologyJSONSpec. - */ -public fun getTopologies(topologies: List<TopologySpec>): List<TopologyJSONSpec> { - val readTopologies = mutableListOf<TopologyJSONSpec>() - for (topology in topologies) { - readTopologies.add(TopologyReader().read(File(topology.pathToFile))) - } - - return readTopologies -} - -/** * Returns a string representing the output folder name for a given ScenarioSpec, CpuPowerModel, AllocationPolicySpec, and topology path. * * @param scenarioSpec The ScenarioSpec. - * @param powerModel The CpuPowerModel. - * @param allocationPolicy The AllocationPolicySpec. - * @param topologyPath The path to the topology file. + * @param topology The specification of the topology used + * @param workload The specification of the workload + * @param allocationPolicy The allocation policy used * @return A string representing the output folder name. */ public fun getOutputFolderName( scenarioSpec: ScenarioSpec, - topology: TopologySpec, + topology: ScenarioTopologySpec, workload: WorkloadSpec, allocationPolicy: AllocationPolicySpec, ): String { return "scenario=${scenarioSpec.name}" + "-topology=${topology.name}" + "-workload=${workload.name}" + - "-scheduler=${allocationPolicy.name}" + "-allocation=${allocationPolicy.name}" } diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/ScenarioReader.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt index ffbb3aa3..19ce5a14 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/ScenarioReader.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/ScenarioReader.kt @@ -20,12 +20,12 @@ * SOFTWARE. */ -package org.opendc.experiments.base.models.scenario +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.models.scenario.specs.ScenarioSpec +import org.opendc.experiments.base.scenario.specs.ScenarioSpec import java.io.File import java.io.InputStream diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/AllocationPolicySpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt index f7ae7e9f..f7ae7e9f 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/AllocationPolicySpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/AllocationPolicySpec.kt diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/ExportModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt index 9a23ad00..9a23ad00 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/ExportModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ExportModelSpec.kt diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/FailureModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/FailureModelSpec.kt index 99620366..99620366 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/FailureModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/FailureModelSpec.kt diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/PowerModelSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt index fc568925..fc568925 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/PowerModelSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/PowerModelSpec.kt diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/ScenarioSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioSpec.kt index 15012461..cfbb913c 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/ScenarioSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioSpec.kt @@ -20,12 +20,12 @@ * SOFTWARE. */ -package org.opendc.experiments.base.models.scenario.specs +package org.opendc.experiments.base.scenario.specs import AllocationPolicySpec import ExportModelSpec import FailureModelSpec -import TopologySpec +import ScenarioTopologySpec import WorkloadSpec import kotlinx.serialization.Serializable @@ -43,7 +43,7 @@ import kotlinx.serialization.Serializable */ @Serializable public data class ScenarioSpec( - val topologies: List<TopologySpec>, + val topologies: List<ScenarioTopologySpec>, val workloads: List<WorkloadSpec>, val allocationPolicies: List<AllocationPolicySpec>, val failureModels: List<FailureModelSpec> = listOf(FailureModelSpec()), diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/TopologySpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt index 392b9763..47d3447f 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/TopologySpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/ScenarioTopologySpec.kt @@ -29,7 +29,7 @@ import java.io.File * @property pathToFile */ @Serializable -public data class TopologySpec( +public data class ScenarioTopologySpec( val pathToFile: String, ) { public val name: String = File(pathToFile).nameWithoutExtension diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/WorkloadSpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt index 819f633d..819f633d 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/models/scenario/specs/WorkloadSpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/scenario/specs/WorkloadSpec.kt diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt index 96e62e80..61716053 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt @@ -32,7 +32,6 @@ import org.opendc.compute.service.scheduler.filters.ComputeFilter import org.opendc.compute.service.scheduler.filters.RamFilter import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.CoreRamWeigher -import org.opendc.compute.simulator.failure.getFailureModel import org.opendc.compute.simulator.provisioner.Provisioner import org.opendc.compute.simulator.provisioner.registerComputeMonitor import org.opendc.compute.simulator.provisioner.setupComputeService @@ -103,7 +102,7 @@ class ScenarioIntegrationTest { ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! - service.replay(timeSource, workload, seed) + service.replay(timeSource, workload, seed = seed) } println( @@ -149,7 +148,7 @@ class ScenarioIntegrationTest { ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! - service.replay(timeSource, workload, seed) + service.replay(timeSource, workload, seed = seed) } println( @@ -190,7 +189,7 @@ class ScenarioIntegrationTest { ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! - service.replay(timeSource, workload, seed) + service.replay(timeSource, workload, seed = seed) } println( @@ -230,7 +229,7 @@ class ScenarioIntegrationTest { ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! - service.replay(timeSource, workload, seed, failureModel = getFailureModel(7.0 * 24 * 60 * 60)) + service.replay(timeSource, workload, seed = seed, failureModelSpec = null) } // Note that these values have been verified beforehand diff --git a/opendc-experiments/opendc-experiments-scenario/src/main/kotlin/org/opendc/experiments/scenario/ScenarioCli.kt b/opendc-experiments/opendc-experiments-scenario/src/main/kotlin/org/opendc/experiments/scenario/ScenarioCli.kt index bd05824b..c2dbafd5 100644 --- a/opendc-experiments/opendc-experiments-scenario/src/main/kotlin/org/opendc/experiments/scenario/ScenarioCli.kt +++ b/opendc-experiments/opendc-experiments-scenario/src/main/kotlin/org/opendc/experiments/scenario/ScenarioCli.kt @@ -30,8 +30,8 @@ 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.scenario.getScenario -import org.opendc.experiments.base.runner.runScenario +import org.opendc.experiments.base.runner.runScenarios +import org.opendc.experiments.base.scenario.getScenarios import java.io.File /** @@ -59,8 +59,8 @@ internal class ScenarioCommand : CliktCommand(name = "scenario") { override fun run() { // TODO: clean the simulation-results folder? - val scenarios = getScenario(scenarioPath) - runScenario(scenarios, parallelism) + val scenarios = getScenarios(scenarioPath) + runScenarios(scenarios, parallelism) // TODO: implement outputResults(scenario) // this will take the results, from a folder, and output them visually } } diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt index 0de3b7fc..d6913412 100644 --- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt +++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt @@ -288,7 +288,7 @@ public class OpenDCRunner( } // Run workload trace - service.replay(timeSource, vms, seed, failureModel = failureModel) + service.replay(timeSource, vms, seed = seed) val serviceMetrics = service.getSchedulerStats() logger.debug { |
