summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-10-01 10:24:17 +0200
committerGitHub <noreply@github.com>2020-10-01 10:24:17 +0200
commit5d71ef4bd6ca84cf5f445f7ba4bb5f7a1e181b64 (patch)
tree378ee03042636dde384e4c7eb98aef00f5d3213c
parent1656a77645079754fc31cffad9d0af6d92e184ee (diff)
parenta283fac5e4d2a6be229acba191acdcbf7eba6dcd (diff)
Merge pull request #42 from atlarge-research/refactor/clean-up
Remove odcsim component from OpenDC
-rw-r--r--simulator/Dockerfile4
-rw-r--r--simulator/README.md34
-rw-r--r--simulator/build.gradle.kts6
-rw-r--r--simulator/buildSrc/build.gradle.kts2
-rw-r--r--simulator/odcsim/README.md54
-rw-r--r--simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/Domain.kt54
-rw-r--r--simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationContext.kt63
-rw-r--r--simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngineProvider.kt35
-rw-r--r--simulator/odcsim/odcsim-engine-omega/build.gradle.kts46
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt264
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngineProvider.kt37
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationAwareLoggerImpl.kt567
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationIgnorantLoggerImpl.kt440
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LoggerImpl.kt74
-rw-r--r--simulator/odcsim/odcsim-engine-omega/src/main/resources/META-INF/services/com.atlarge.odcsim.SimulationEngineProvider1
-rw-r--r--simulator/opendc-compute/build.gradle.kts (renamed from simulator/opendc/opendc-compute/build.gradle.kts)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Flavor.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/MemoryUnit.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/MemoryUnit.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingNode.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingUnit.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingUnit.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Server.kt)16
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerEvent.kt)8
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerState.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerContext.kt)20
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerManagementContext.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerManagementContext.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ShutdownException.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ShutdownException.kt)9
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/EmptyImage.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImage.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsHistoryFragment.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsHistoryFragment.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/Image.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/VmImage.kt54
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt)15
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt47
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Metadata.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Node.kt)14
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeEvent.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeState.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/BareMetalDriver.kt)20
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt)123
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/power/PowerModels.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/ProvisioningService.kt)14
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningService.kt)35
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/Hypervisor.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorEvent.kt)10
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorImage.kt)18
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt)101
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/VirtDriver.kt)24
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt37
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt)275
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningEvent.kt)2
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt (renamed from simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngine.kt)46
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt50
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt)8
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt37
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt)12
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt37
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt)8
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt)12
-rw-r--r--simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt (renamed from simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt)28
-rw-r--r--simulator/opendc-compute/src/test/kotlin/org/opendc/compute/core/image/FlopsApplicationImageTest.kt (renamed from simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImageTest.kt)4
-rw-r--r--simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt (renamed from simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt)49
-rw-r--r--simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt (renamed from simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt)41
-rw-r--r--simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/HypervisorTest.kt (renamed from simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/virt/HypervisorTest.kt)104
-rw-r--r--simulator/opendc-core/build.gradle.kts (renamed from simulator/odcsim/odcsim-api/build.gradle.kts)7
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Environment.kt)6
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Identity.kt)8
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Platform.kt)8
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/User.kt)6
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Zone.kt)10
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/CorrelatedFaultInjector.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt)25
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FailureDomain.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FailureDomain.kt)2
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FaultInjector.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FaultInjector.kt)6
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/UncorrelatedFaultInjector.kt)21
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/power/PowerModel.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/PowerModel.kt)2
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/Powerable.kt)2
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/Resource.kt)8
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/TagContainer.kt)6
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceKey.kt)10
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistry.kt)6
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistryImpl.kt)9
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt (renamed from simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/Workload.kt)10
-rw-r--r--simulator/opendc-experiments/build.gradle.kts (renamed from simulator/odcsim/build.gradle.kts)4
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts (renamed from simulator/opendc/opendc-experiments-sc18/build.gradle.kts)14
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt (renamed from simulator/opendc/opendc-experiments-sc18/src/main/kotlin/com/atlarge/opendc/experiments/sc18/TestExperiment.kt)72
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc18/src/main/resources/env/setup-test.json (renamed from simulator/opendc/opendc-experiments-sc18/src/main/resources/env/setup-test.json)0
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts (renamed from simulator/opendc/opendc-experiments-sc20/build.gradle.kts)12
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Main.kt)30
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Experiment.kt)20
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/ExperimentHelpers.kt)143
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolio.kt)14
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolios.kt)11
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Run.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Run.kt)60
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Scenario.kt)16
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Topology.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Topology.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Workload.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Workload.kt)12
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt)18
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt)22
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt)14
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt)10
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentDescriptor.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentRunner.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt)18
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt)20
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/Event.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/HostEvent.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt)2
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/RunEvent.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/VmEvent.kt)8
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt)18
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt)12
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt)12
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt)12
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt)22
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt)25
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt)54
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20TraceConverter.kt)30
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/WorkloadSampler.kt)23
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/main/resources/log4j2.xml (renamed from simulator/opendc/opendc-experiments-sc20/src/main/resources/log4j2.xml)11
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/test/kotlin/org/opendc/experiments/sc20/Sc20IntegrationTest.kt (renamed from simulator/opendc/opendc-experiments-sc20/src/test/kotlin/com/atlarge/opendc/experiments/sc20/Sc20IntegrationTest.kt)93
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/single.txt (renamed from simulator/opendc/opendc-experiments-sc20/src/test/resources/env/single.txt)0
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/topology.txt (renamed from simulator/opendc/opendc-experiments-sc20/src/test/resources/env/topology.txt)0
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/meta.parquet (renamed from simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/meta.parquet)bin2148 -> 2148 bytes
-rw-r--r--simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/trace.parquet (renamed from simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/trace.parquet)bin1672463 -> 1672463 bytes
-rw-r--r--simulator/opendc-format/build.gradle.kts (renamed from simulator/opendc/opendc-format/build.gradle.kts)14
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/EnvironmentReader.kt)15
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Model.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Model.kt)24
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt)46
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Model.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Model.kt)24
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt)51
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt)46
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt)8
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceEntry.kt)4
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceReader.kt)8
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceWriter.kt)4
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/VmPlacementReader.kt)2
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt)41
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/gwf/GwfTraceReader.kt)50
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt)2
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt)14
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt)28
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt)8
-rw-r--r--simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt (renamed from simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt)44
-rw-r--r--simulator/opendc-format/src/test/kotlin/org/opendc/format/trace/swf/SwfTraceReaderTest.kt45
-rw-r--r--simulator/opendc-format/src/test/resources/swf_trace.txt (renamed from simulator/opendc/opendc-format/src/test/resources/swf_trace.txt)0
-rw-r--r--simulator/opendc-runner-web/build.gradle.kts (renamed from simulator/opendc/opendc-runner-web/build.gradle.kts)16
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt (renamed from simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/Main.kt)79
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt (renamed from simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ResultProcessor.kt)44
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt (renamed from simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ScenarioManager.kt)26
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt (renamed from simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/TopologyParser.kt)68
-rw-r--r--simulator/opendc-runner-web/src/main/resources/log4j2.xml (renamed from simulator/opendc/opendc-runner-web/src/main/resources/log4j2.xml)9
-rw-r--r--simulator/opendc-simulator/build.gradle.kts32
-rw-r--r--simulator/opendc-simulator/src/main/kotlin/org/opendc/simulator/utils/DelayControllerClockAdapter.kt46
-rw-r--r--simulator/opendc-utils/build.gradle.kts32
-rw-r--r--simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/EventFlow.kt (renamed from simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/EventFlow.kt)9
-rw-r--r--simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/StateFlow.kt (renamed from simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/StateFlow.kt)6
-rw-r--r--simulator/opendc-workflows/build.gradle.kts (renamed from simulator/opendc/opendc-workflows/build.gradle.kts)13
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/JobState.kt)8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerListener.kt)6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt)80
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskState.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskStatus.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskStatus.kt)2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowEvent.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowEvent.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowSchedulerMode.kt)17
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowService.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/StagePolicy.kt)8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt)18
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt)13
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt)19
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt)20
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt)14
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt)10
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt)6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt)6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskOrderPolicy.kt)6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Job.kt)12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Metadata.kt)2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt (renamed from simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Task.kt)8
-rw-r--r--simulator/opendc-workflows/src/test/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt (renamed from simulator/opendc/opendc-workflows/src/test/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt)58
-rw-r--r--simulator/opendc-workflows/src/test/resources/environment.json (renamed from simulator/opendc/opendc-workflows/src/test/resources/environment.json)0
-rw-r--r--simulator/opendc-workflows/src/test/resources/trace.gwf (renamed from simulator/opendc/opendc-workflows/src/test/resources/trace.gwf)0
-rw-r--r--simulator/opendc/README.md8
-rw-r--r--simulator/opendc/build.gradle.kts23
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/VmImage.kt34
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/VmWorkload.kt25
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/HypervisorView.kt15
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningService.kt42
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AllocationPolicy.kt25
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt15
-rw-r--r--simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt15
-rw-r--r--simulator/opendc/opendc-core/build.gradle.kts38
-rw-r--r--simulator/opendc/opendc-format/src/test/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReaderTest.kt23
-rw-r--r--simulator/settings.gradle.kts22
220 files changed, 2207 insertions, 3608 deletions
diff --git a/simulator/Dockerfile b/simulator/Dockerfile
index e42c7f14..880af95d 100644
--- a/simulator/Dockerfile
+++ b/simulator/Dockerfile
@@ -23,9 +23,9 @@ RUN ./gradlew clean build --no-daemon > /dev/null 2>&1 || true
# Build project
COPY ./ /app/
-RUN ./gradlew --no-daemon :opendc:opendc-runner-web:installDist
+RUN ./gradlew --no-daemon :opendc-runner-web:installDist
FROM openjdk:14-slim
-COPY --from=builder /app/opendc/opendc-runner-web/build/install /app
+COPY --from=builder /app/opendc-runner-web/build/install /app
WORKDIR /app
CMD opendc-runner-web/bin/opendc-runner-web
diff --git a/simulator/README.md b/simulator/README.md
index 0e9a1671..61ef1d43 100644
--- a/simulator/README.md
+++ b/simulator/README.md
@@ -8,22 +8,34 @@
<p align="center">
Collaborative Datacenter Simulation and Exploration for Everybody
</p>
-<p align="center">
- <a href="https://travis-ci.org/atlarge-research/opendc-simulator">
- <img src="https://travis-ci.org/atlarge-research/opendc-simulator.svg?branch=master" alt="Build Status">
- </a>
+<p align="center">
<a href="https://opensource.org/licenses/MIT">
- <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="MIT License">
+ <img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License">
</a>
</p>
## Introduction
-This repository hosts the source code and development of the simulation component of the [OpenDC](https://opendc.org) project. This component is responsible for modelling and simulation of datacenters and their components. We have structured the repository into two individual subprojects:
-- **[odcsim](/odcsim)**
- A framework for discrete event simulation using the [Kotlin](https://kotlinlang.org/) language.
-- **[opendc](/opendc)**
- A collection of models for simulating clouds, datacenters and their components using the **odcsim** framework.
-
+This directory hosts the source code and development of the simulation component of the [OpenDC](https://opendc.org) project.
+This component is responsible for modelling and simulation of datacenters and their components. We have structured the directory into several subprojects:
+- **[opendc-core](opendc-core)**
+ This module establishes core concepts and terminology of datacenters that we share across the various modules.
+ Other `opendc` modules build on these concepts and extend it in various directions (e.g. virtual machines or workflows).
+- **[opendc-compute](opendc-compute)**
+ The [Infrastructure as a Service](https://en.wikipedia.org/wiki/Infrastructure_as_a_Service) (IaaS) component of OpenDC for computing infrastructure (similar to
+ [Amazon EC2](https://aws.amazon.com/ec2/) and [Google Compute Engine](https://cloud.google.com/compute)).
+- **[opendc-workflows](opendc-workflows)**
+ Workflow orchestration service built on top of OpenDC.
+- **[opendc-format](opendc-format)**
+ Collection of libraries for processing data formats related to (simulation of) cloud computing and datacenters.
+- **[opendc-experiments](opendc-experiments)**
+ Collection of experiments that use OpenDC to explore various concepts of cloud computing and datacenters.
+- **[opendc-runner-web](opendc-runner-web)**
+ Experiment runner that integrates with the OpenDC web interface.
+- **[opendc-simulator](opendc-simulator)**
+ Collection of libraries that enable simulation of various components of datacenters.
+- **[opendc-utils](opendc-utils)**
+ Collection of utilities that are shared across the OpenDC subprojects.
+
## Documentation
Check out the [Getting Started](#getting-started) section for a quick
overview.
diff --git a/simulator/build.gradle.kts b/simulator/build.gradle.kts
index 4775369b..b104654b 100644
--- a/simulator/build.gradle.kts
+++ b/simulator/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2017 atlarge-research
+ * Copyright (c) 2017 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
@@ -27,6 +25,6 @@ plugins {
}
allprojects {
- group = "com.atlarge.opendc"
+ group = "org.opendc"
version = "2.0.0"
}
diff --git a/simulator/buildSrc/build.gradle.kts b/simulator/buildSrc/build.gradle.kts
index 79ae0de9..7ccd920f 100644
--- a/simulator/buildSrc/build.gradle.kts
+++ b/simulator/buildSrc/build.gradle.kts
@@ -41,6 +41,6 @@ repositories {
dependencies {
implementation(kotlin("gradle-plugin", version = "1.4.10"))
- implementation("org.jlleitschuh.gradle:ktlint-gradle:9.2.1")
+ implementation("org.jlleitschuh.gradle:ktlint-gradle:9.4.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
}
diff --git a/simulator/odcsim/README.md b/simulator/odcsim/README.md
deleted file mode 100644
index 78cfaa27..00000000
--- a/simulator/odcsim/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-<h1 align="center">
- <a href="http://opendc.org/">
- <img src="../misc/artwork/logo.png" width="100" alt="OpenDC">
- </a>
- <br>
- odcsim
-</h1>
-
-## Introduction
-**odcsim** is a framework for discrete event simulation in Kotlin, used
-by the [OpenDC](https://opendc.org) project.
-Projects are defined in terms of a hierarchical grouping of actors
-and the interactions between these actors
-([Actor model](https://en.wikipedia.org/wiki/Actor_model)).
-
-## Getting Started
-
-The instructions below are meant for when you would like to use `odcsim` separately from `opendc`. If you simply want to use the simulator, you do not need to follow them, please refer to the [main README](../README.md) for instructions.
-
-### Installation
-Please add the required packages as dependency in your project.
-Releases are available in the [Maven Central Repository](https://search.maven.org/).
-
-The package `odcsim-core` is required to construct a simulation model.
-A `odcsim-engine-*` package is needed for running the simulation
-model.
-
-#### Gradle
-Groovy
-```groovy
-implementation 'com.atlarge.odcsim:odcsim-api:2.0.0'
-runtime 'com.atlarge.odcsim:odcsim-engine-omega:2.0.0'
-```
-Kotlin
-```groovy
-implementation("com.atlarge.odcsim:odcsim-api:2.0.0")
-runtime("com.atlarge.odcsim:odcsim-engine-omega:2.0.0")
-```
-
-#### Maven
-```xml
-<dependency>
- <groupId>com.atlarge.odcsim</groupId>
- <artifactId>odcsim-api</artifactId>
- <version>2.0.0</version>
-</dependency>
-
-<dependency>
- <groupId>com.atlarge.odcsim</groupId>
- <artifactId>odcsim-engine-omega</artifactId>
- <version>2.0.0</version>
-</dependency>
-```
-
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/Domain.kt b/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/Domain.kt
deleted file mode 100644
index c850952c..00000000
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/Domain.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2020 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 com.atlarge.odcsim
-
-import kotlinx.coroutines.CoroutineScope
-
-/**
- * An isolated execution unit that runs concurrently in simulation to the other simulation domains. A domain defines a
- * logical boundary between processes in simulation.
- */
-public interface Domain : CoroutineScope {
- /**
- * The name of this domain.
- */
- public val name: String
-
- /**
- * The parent domain to which the lifecycle of this domain is bound. In case this is a root domain, this refers to
- * itself.
- */
- public val parent: Domain
-
- /**
- * Construct an anonymous simulation sub-domain that is bound to the lifecycle of this domain.
- */
- public fun newDomain(): Domain
-
- /**
- * Construct a new simulation sub-domain with the specified [name].
- */
- public fun newDomain(name: String): Domain
-}
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationContext.kt b/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationContext.kt
deleted file mode 100644
index c51d1d8b..00000000
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationContext.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2018 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 com.atlarge.odcsim
-
-import java.time.Clock
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.coroutineContext
-import org.slf4j.Logger
-
-/**
- * Represents the execution context of a simulation domain.
- */
-public interface SimulationContext : CoroutineContext.Element {
- /**
- * Key for [SimulationContext] instance in the coroutine context.
- */
- companion object Key : CoroutineContext.Key<SimulationContext>
-
- /**
- * The reference to the current simulation domain.
- */
- public val domain: Domain
-
- /**
- * The clock tracking the simulation time.
- */
- public val clock: Clock
-
- /**
- * A logger instance tied to the logical process.
- */
- public val log: Logger
-}
-
-/**
- * The simulation context of the current coroutine.
- */
-@Suppress("WRONG_MODIFIER_TARGET")
-public suspend inline val simulationContext: SimulationContext
- @Suppress("ILLEGAL_SUSPEND_PROPERTY_ACCESS")
- get() = coroutineContext[SimulationContext] ?: throw IllegalStateException("No simulation context available")
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngineProvider.kt b/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngineProvider.kt
deleted file mode 100644
index a975fa3c..00000000
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngineProvider.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2018 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 com.atlarge.odcsim
-
-/**
- * A factory for [SimulationEngine] instances that allows users to dynamically load engine implementations.
- */
-public interface SimulationEngineProvider {
- /**
- * Construct an [SimulationEngine] with the given [name].
- */
- public operator fun invoke(name: String): SimulationEngine
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/build.gradle.kts b/simulator/odcsim/odcsim-engine-omega/build.gradle.kts
deleted file mode 100644
index f9c0b94f..00000000
--- a/simulator/odcsim/odcsim-engine-omega/build.gradle.kts
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2018 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.
- */
-
-description = "Single-threaded reference implementation for the odcsim API"
-
-/* Build configuration */
-plugins {
- `kotlin-library-convention`
-}
-
-/* Project configuration */
-repositories {
- jcenter()
-}
-
-dependencies {
- api(project(":odcsim:odcsim-api"))
-
- implementation("org.jetbrains:annotations:17.0.0")
-
- testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
- testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}")
- testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}")
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt b/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt
deleted file mode 100644
index e675b877..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2018 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 com.atlarge.odcsim.engine.omega
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.SimulationContext
-import com.atlarge.odcsim.SimulationEngine
-import com.atlarge.odcsim.engine.omega.logging.LoggerImpl
-import java.time.Clock
-import java.time.Instant
-import java.time.ZoneId
-import java.util.PriorityQueue
-import java.util.UUID
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.coroutineContext
-import kotlinx.coroutines.CancellableContinuation
-import kotlinx.coroutines.CoroutineDispatcher
-import kotlinx.coroutines.CoroutineExceptionHandler
-import kotlinx.coroutines.CoroutineName
-import kotlinx.coroutines.Delay
-import kotlinx.coroutines.DisposableHandle
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.InternalCoroutinesApi
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.Runnable
-import kotlinx.coroutines.SupervisorJob
-import org.jetbrains.annotations.Async
-import org.slf4j.Logger
-
-/**
- * The reference implementation of the [SimulationEngine] instance for the OpenDC simulation core.
- *
- * This engine implementation is a single-threaded implementation, running logical processes synchronously and
- * provides a single priority queue for all events (messages, ticks, etc) that occur.
- *
- * @param name The name of the engine instance.
- */
-public class OmegaSimulationEngine(override val name: String) : SimulationEngine {
- /**
- * The state of the actor system.
- */
- private var state: SimulationEngineState = SimulationEngineState.CREATED
-
- /**
- * The clock tracking the simulation time.
- */
- private val clock: VirtualClock = VirtualClock(0)
-
- /**
- * The event queue to process
- */
- private val queue: PriorityQueue<Event> = PriorityQueue(Comparator<Event> { lhs, rhs ->
- // Note that Comparator gives better performance than Comparable according to
- // profiling
- val cmp = lhs.time.compareTo(rhs.time)
- if (cmp == 0) lhs.id.compareTo(rhs.id) else cmp
- })
-
- /**
- * The active processes in the simulation engine.
- */
- private val registry: MutableMap<String, Domain> = HashMap()
-
- /**
- * A unique increasing identifier assigned to each event, needed because otherwise two events occurring in sequence
- * (but at the same time) may be differently ordered in the internal priority queue (queue) since it does not
- * guarantee insertion order.
- */
- private var nextId: Long = 0
-
- override fun newDomain(): Domain = newDomain(null)
-
- override fun newDomain(name: String): Domain = newDomain(name, null)
-
- override suspend fun run() {
- check(state != SimulationEngineState.TERMINATED) { "The simulation engine is terminated" }
-
- if (state == SimulationEngineState.CREATED) {
- state = SimulationEngineState.STARTED
- }
-
- val job = coroutineContext[Job]
-
- while (job?.isActive == true) {
- val event = queue.peek() ?: break
- val delivery = event.time
-
- // A message should never be delivered out of order in this single-threaded implementation. Assert for
- // sanity
- assert(delivery >= clock.time) { "Message delivered out of order [expected=$delivery, actual=${clock.time}]" }
-
- clock.time = delivery
- queue.poll()
-
- process(event)
- }
- }
-
- override suspend fun terminate() {
- state = SimulationEngineState.TERMINATED
- }
-
- /**
- * Schedule the specified event to be processed by the engine.
- */
- private fun schedule(@Async.Schedule event: Event) {
- assert(event.time >= clock.time) { "Message scheduled in the past [received=${event.time}, actual=${clock.time}]" }
- queue.add(event)
- }
-
- /**
- * Process the delivery of an event.
- */
- @OptIn(ExperimentalCoroutinesApi::class)
- private fun process(@Async.Execute event: Event) {
- // This has been inlined into this method for performance
- when (event) {
- is Event.Dispatch ->
- event.block.run()
- is Event.Resume ->
- with(event.continuation) { event.dispatcher.resumeUndispatched(Unit) }
- is Event.Timeout ->
- if (!event.isCancelled)
- event.block.run()
- }
- }
-
- /**
- * Spawn a new simulation domain.
- */
- private fun newDomainImpl(name: String, parent: DomainImpl?): Domain {
- val domain = DomainImpl(name, parent)
- require(domain.path !in registry) { "Domain name $name not unique" }
- registry[domain.path] = domain
- return domain
- }
-
- private fun newDomain(parent: DomainImpl?): Domain {
- val name = "$" + UUID.randomUUID()
- return newDomainImpl(name, parent)
- }
-
- private fun newDomain(name: String, parent: DomainImpl?): Domain {
- require(name.isNotEmpty()) { "Domain name may not be empty" }
- require(!name.startsWith("$")) { "Domain name may not start with $-sign" }
- require(!name.contains("/")) { "Domain name may not contain /" }
- return newDomainImpl(name, parent)
- }
-
- private inner class DomainImpl(override val name: String, parent: DomainImpl?) : SimulationContext, Domain {
- val job: Job = SupervisorJob(parent?.job)
- val path: String = (parent?.path ?: "") + "/$name"
-
- @InternalCoroutinesApi
- private val dispatcher = object : CoroutineDispatcher(), Delay {
- // CoroutineDispatcher
- override fun dispatch(context: CoroutineContext, block: Runnable) {
- schedule(Event.Dispatch(clock.time, nextId++, block))
- }
-
- // Delay
- override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation<Unit>) {
- schedule(Event.Resume(clock.time + timeMillis, nextId++, this, continuation))
- }
-
- override fun invokeOnTimeout(timeMillis: Long, block: Runnable): DisposableHandle {
- val event = Event.Timeout(clock.time + timeMillis, nextId++, block)
- schedule(event)
- return event
- }
- }
-
- private val exceptionHandler = CoroutineExceptionHandler { _, exception ->
- log.error("Uncaught exception", exception)
- }
-
- // SimulationContext
- override val key: CoroutineContext.Key<*> = SimulationContext.Key
-
- override val domain: Domain = this
-
- override val clock: VirtualClock
- get() = this@OmegaSimulationEngine.clock
-
- override val log: Logger by lazy(LazyThreadSafetyMode.NONE) { LoggerImpl.invoke(this) }
-
- override fun newDomain(): Domain = this@OmegaSimulationEngine.newDomain(this)
-
- override fun newDomain(name: String): Domain = this@OmegaSimulationEngine.newDomain(name, this)
-
- // Domain
- override val parent: Domain = parent ?: this
-
- @InternalCoroutinesApi
- override val coroutineContext: CoroutineContext = this + CoroutineName(name) + dispatcher + job + exceptionHandler
-
- override fun toString(): String = path
- }
-
- /**
- * Enumeration to track the state of the actor system.
- */
- private enum class SimulationEngineState {
- CREATED, STARTED, TERMINATED
- }
-
- /**
- * A wrapper around a message that has been scheduled for processing.
- *
- * @property time The point in time to deliver the message.
- */
- private sealed class Event(val time: Long, val id: Long) {
- class Dispatch(time: Long, id: Long, val block: Runnable) : Event(time, id) {
- override fun toString(): String = "Dispatch[$time]"
- }
-
- class Resume(time: Long, id: Long, val dispatcher: CoroutineDispatcher, val continuation: CancellableContinuation<Unit>) : Event(time, id) {
- override fun toString(): String = "Resume[$time]"
- }
-
- class Timeout(time: Long, id: Long, val block: Runnable, var isCancelled: Boolean = false) : Event(time, id), DisposableHandle {
- override fun dispose() {
- isCancelled = true
- }
-
- override fun toString(): String = "Timeout[$time]"
- }
- }
-
- /**
- * A virtual [Clock] implementation for keeping track of simulation time.
- */
- private data class VirtualClock(var time: Long) : Clock() {
- override fun withZone(zone: ZoneId?): Clock = throw NotImplementedError()
-
- override fun getZone(): ZoneId = ZoneId.systemDefault()
-
- override fun instant(): Instant = Instant.ofEpochMilli(time)
-
- override fun millis(): Long = time
- }
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngineProvider.kt b/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngineProvider.kt
deleted file mode 100644
index 5dba3233..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngineProvider.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2018 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 com.atlarge.odcsim.engine.omega
-
-import com.atlarge.odcsim.SimulationEngine
-import com.atlarge.odcsim.SimulationEngineProvider
-import java.util.ServiceLoader
-
-/**
- * An [SimulationEngineProvider] for the Omega engine, used by the [ServiceLoader] API to create
- * [OmegaSimulationEngine] instances.
- */
-public class OmegaSimulationEngineProvider : SimulationEngineProvider {
- override operator fun invoke(name: String): SimulationEngine = OmegaSimulationEngine(name)
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationAwareLoggerImpl.kt b/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationAwareLoggerImpl.kt
deleted file mode 100644
index fca4826e..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationAwareLoggerImpl.kt
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2019 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 com.atlarge.odcsim.engine.omega.logging
-
-import com.atlarge.odcsim.SimulationContext
-import org.slf4j.Logger
-import org.slf4j.Marker
-import org.slf4j.helpers.MessageFormatter
-import org.slf4j.spi.LocationAwareLogger
-
-/**
- * An actor-specific [Logger] implementation that is aware of the calling location.
- *
- * @param ctx The owning [SimulationContext] of this logger.
- * @param delegate The [LocationAwareLogger] to delegate the messages to.
- */
-internal class LocationAwareLoggerImpl(
- ctx: SimulationContext,
- private val delegate: LocationAwareLogger
-) : LoggerImpl(ctx), Logger by delegate {
- /**
- * The fully qualified name of this class.
- */
- private val fqcn = LocationAwareLoggerImpl::class.java.name
-
- override fun trace(format: String?, arg: Any?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(null, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun trace(format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(null, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun trace(format: String?, argArray: Array<Any?>) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(null, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun trace(msg: String?, t: Throwable?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.TRACE_INT, msg, null, t)
- }
- }
-
- override fun trace(marker: Marker?, msg: String?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.TRACE_INT, msg, null, null)
- }
- }
-
- override fun trace(marker: Marker?, format: String?, arg: Any?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(marker, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun trace(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(marker, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun trace(marker: Marker?, format: String?, argArray: Array<Any?>) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(marker, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun trace(marker: Marker?, msg: String?, t: Throwable?) {
- if (!delegate.isTraceEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.TRACE_INT, msg, null, t)
- }
- }
-
- override fun debug(msg: String?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, null)
- }
- }
-
- override fun debug(format: String?, arg: Any?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(null, fqcn, LocationAwareLogger.DEBUG_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun debug(format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(null, fqcn, LocationAwareLogger.DEBUG_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun debug(format: String?, argArray: Array<Any?>) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val ft = MessageFormatter.arrayFormat(format, argArray)
- delegate.log(null, fqcn, LocationAwareLogger.DEBUG_INT, ft.message, ft.argArray, ft.throwable)
- }
- }
-
- override fun debug(msg: String?, t: Throwable?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, t)
- }
- }
-
- override fun debug(marker: Marker?, msg: String?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, null)
- }
- }
-
- override fun debug(marker: Marker?, format: String?, arg: Any?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val ft = MessageFormatter.format(format, arg)
- delegate.log(marker, fqcn, LocationAwareLogger.DEBUG_INT, ft.message, ft.argArray, ft.throwable)
- }
- }
-
- override fun debug(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(marker, fqcn, LocationAwareLogger.DEBUG_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun debug(marker: Marker?, format: String?, argArray: Array<Any?>) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- val ft = MessageFormatter.arrayFormat(format, argArray)
- delegate.log(marker, fqcn, LocationAwareLogger.DEBUG_INT, ft.message, argArray, ft.throwable)
- }
- }
-
- override fun debug(marker: Marker?, msg: String?, t: Throwable?) {
- if (!delegate.isDebugEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, t)
- }
- }
-
- override fun info(msg: String?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.INFO_INT, msg, null, null)
- }
- }
-
- override fun info(format: String?, arg: Any?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(null, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun info(format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(null, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun info(format: String?, argArray: Array<Any?>) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(null, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun info(msg: String?, t: Throwable?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.INFO_INT, msg, null, t)
- }
- }
-
- override fun info(marker: Marker?, msg: String?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.INFO_INT, msg, null, null)
- }
- }
-
- override fun info(marker: Marker?, format: String?, arg: Any?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(marker, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun info(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(marker, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun info(marker: Marker?, format: String?, argArray: Array<Any?>) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(marker, fqcn, LocationAwareLogger.INFO_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun info(marker: Marker?, msg: String?, t: Throwable?) {
- if (!delegate.isInfoEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.INFO_INT, msg, null, t)
- }
- }
-
- override fun warn(msg: String?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.WARN_INT, msg, null, null)
- }
- }
-
- override fun warn(format: String?, arg: Any?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(null, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun warn(format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(null, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun warn(format: String?, argArray: Array<Any?>) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(null, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun warn(msg: String?, t: Throwable?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.WARN_INT, msg, null, t)
- }
- }
-
- override fun warn(marker: Marker?, msg: String?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.WARN_INT, msg, null, null)
- }
- }
-
- override fun warn(marker: Marker?, format: String?, arg: Any?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(marker, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun warn(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(marker, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun warn(marker: Marker?, format: String?, argArray: Array<Any?>) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(marker, fqcn, LocationAwareLogger.WARN_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun warn(marker: Marker?, msg: String?, t: Throwable?) {
- if (!delegate.isWarnEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.WARN_INT, msg, null, t)
- }
- }
-
- override fun error(msg: String?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.ERROR_INT, msg, null, null)
- }
- }
-
- override fun error(format: String?, arg: Any?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(null, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun error(format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(null, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun error(format: String?, argArray: Array<Any?>) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(null, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun error(msg: String?, t: Throwable?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- delegate.log(null, fqcn, LocationAwareLogger.ERROR_INT, msg, null, t)
- }
- }
-
- override fun error(marker: Marker?, msg: String?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.ERROR_INT, msg, null, null)
- }
- }
-
- override fun error(marker: Marker?, format: String?, arg: Any?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg).message
- delegate.log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, arrayOf(arg), null)
- }
- }
-
- override fun error(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.format(format, arg1, arg2).message
- delegate.log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, arrayOf(arg1, arg2), null)
- }
- }
-
- override fun error(marker: Marker?, format: String?, argArray: Array<Any?>) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- val formattedMessage = MessageFormatter.arrayFormat(format, argArray).message
- delegate.log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null)
- }
- }
-
- override fun error(marker: Marker?, msg: String?, t: Throwable?) {
- if (!delegate.isErrorEnabled) {
- return
- }
-
- withMdc {
- delegate.log(marker, fqcn, LocationAwareLogger.ERROR_INT, msg, null, t)
- }
- }
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationIgnorantLoggerImpl.kt b/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationIgnorantLoggerImpl.kt
deleted file mode 100644
index 856cecfa..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LocationIgnorantLoggerImpl.kt
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2019 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 com.atlarge.odcsim.engine.omega.logging
-
-import com.atlarge.odcsim.SimulationContext
-import org.slf4j.Logger
-import org.slf4j.Marker
-
-/**
- * A [Logger] implementation that is not aware of the calling location.
- *
- * @param ctx The owning [SimulationContext] of this logger.
- * @param delegate The [Logger] to delegate the messages to.
- */
-internal class LocationIgnorantLoggerImpl(
- ctx: SimulationContext,
- private val delegate: Logger
-) : LoggerImpl(ctx), Logger by delegate {
- override fun warn(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(marker, format, arg1, arg2) }
- }
-
- override fun warn(format: String?, arg1: Any?, arg2: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(format, arg1, arg2) }
- }
-
- override fun warn(msg: String?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(msg) }
- }
-
- override fun warn(marker: Marker?, format: String?, arg: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(marker, format, arg) }
- }
-
- override fun warn(marker: Marker?, format: String?, vararg arguments: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(marker, format, arguments) }
- }
-
- override fun warn(format: String?, arg: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(format, arg) }
- }
-
- override fun warn(marker: Marker?, msg: String?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(marker, msg) }
- }
-
- override fun warn(msg: String?, t: Throwable?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(msg, t) }
- }
-
- override fun warn(format: String?, vararg arguments: Any?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(format, *arguments) }
- }
-
- override fun warn(marker: Marker?, msg: String?, t: Throwable?) {
- if (!isWarnEnabled) {
- return
- }
-
- withMdc { delegate.warn(marker, msg, t) }
- }
-
- override fun info(marker: Marker?, format: String?, vararg arguments: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(marker, format, *arguments) }
- }
-
- override fun info(format: String?, arg: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(format, arg) }
- }
-
- override fun info(marker: Marker?, msg: String?, t: Throwable?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(marker, msg, t) }
- }
-
- override fun info(msg: String?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(msg) }
- }
-
- override fun info(format: String?, vararg arguments: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(format, *arguments) }
- }
-
- override fun info(format: String?, arg1: Any?, arg2: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(format, arg1, arg2) }
- }
-
- override fun info(marker: Marker?, msg: String?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(marker, msg) }
- }
-
- override fun info(marker: Marker?, format: String?, arg: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(marker, format, arg) }
- }
-
- override fun info(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(marker, format, arg1, arg2) }
- }
-
- override fun info(msg: String?, t: Throwable?) {
- if (!isInfoEnabled) {
- return
- }
-
- withMdc { delegate.info(msg, t) }
- }
-
- override fun error(msg: String?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(msg) }
- }
-
- override fun error(marker: Marker?, msg: String?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(marker, msg) }
- }
-
- override fun error(format: String?, vararg arguments: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(format, *arguments) }
- }
-
- override fun error(format: String?, arg: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(format, arg) }
- }
-
- override fun error(msg: String?, t: Throwable?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(msg, t) }
- }
-
- override fun error(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(marker, format, arg1, arg2) }
- }
-
- override fun error(marker: Marker?, format: String?, vararg arguments: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(marker, format, *arguments) }
- }
-
- override fun error(marker: Marker?, msg: String?, t: Throwable?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(marker, msg, t) }
- }
-
- override fun error(format: String?, arg1: Any?, arg2: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(format, arg1, arg2) }
- }
-
- override fun error(marker: Marker?, format: String?, arg: Any?) {
- if (!isErrorEnabled) {
- return
- }
-
- withMdc { delegate.error(marker, format, arg) }
- }
-
- override fun debug(format: String?, vararg arguments: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(format, *arguments) }
- }
-
- override fun debug(format: String?, arg1: Any?, arg2: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(format, arg1, arg2) }
- }
-
- override fun debug(msg: String?, t: Throwable?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(msg, t) }
- }
-
- override fun debug(format: String?, arg: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(format, arg) }
- }
-
- override fun debug(marker: Marker?, msg: String?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(marker, msg) }
- }
-
- override fun debug(msg: String?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(msg) }
- }
-
- override fun debug(marker: Marker?, msg: String?, t: Throwable?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(marker, msg, t) }
- }
-
- override fun debug(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(marker, format, arg1, arg2) }
- }
-
- override fun debug(marker: Marker?, format: String?, arg: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(marker, format, arg) }
- }
-
- override fun debug(marker: Marker?, format: String?, vararg arguments: Any?) {
- if (!isDebugEnabled) {
- return
- }
-
- withMdc { delegate.debug(marker, format, *arguments) }
- }
-
- override fun trace(format: String?, arg: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(format, arg) }
- }
-
- override fun trace(marker: Marker?, msg: String?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(marker, msg) }
- }
-
- override fun trace(msg: String?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(msg) }
- }
-
- override fun trace(msg: String?, t: Throwable?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(msg, t) }
- }
-
- override fun trace(format: String?, arg1: Any?, arg2: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(format, arg1, arg2) }
- }
-
- override fun trace(marker: Marker?, format: String?, arg1: Any?, arg2: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(marker, format, arg1, arg2) }
- }
-
- override fun trace(marker: Marker?, format: String?, arg: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(marker, format, arg) }
- }
-
- override fun trace(marker: Marker?, format: String?, vararg argArray: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(marker, format, *argArray) }
- }
-
- override fun trace(marker: Marker?, msg: String?, t: Throwable?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(marker, msg, t) }
- }
-
- override fun trace(format: String?, vararg arguments: Any?) {
- if (!isTraceEnabled) {
- return
- }
-
- withMdc { delegate.trace(format, *arguments) }
- }
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LoggerImpl.kt b/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LoggerImpl.kt
deleted file mode 100644
index 1adcfdc0..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/logging/LoggerImpl.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2019 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 com.atlarge.odcsim.engine.omega.logging
-
-import com.atlarge.odcsim.SimulationContext
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import org.slf4j.MDC
-import org.slf4j.spi.LocationAwareLogger
-
-/**
- * An actor-specific [Logger] implementation.
- *
- * @param ctx The owning [SimulationContext] of this logger.
- */
-internal abstract class LoggerImpl internal constructor(protected val ctx: SimulationContext) : Logger {
- /**
- * Configure [MDC] with actor-specific information.
- */
- protected inline fun withMdc(block: () -> Unit) {
- MDC.put(MDC_PROCESS_REF, ctx.domain.name)
- MDC.put(MDC_PROCESS_TIME, String.format("%d", ctx.clock.millis()))
- try {
- block()
- } finally {
- MDC.remove(MDC_PROCESS_TIME)
- MDC.remove(MDC_PROCESS_REF)
- }
- }
-
- /**
- * Mapped Diagnostic Context (MDC) attribute names.
- */
- companion object {
- val MDC_PROCESS_TIME = "process.time"
- val MDC_PROCESS_REF = "process.ref"
-
- /**
- * Create a [Logger] for the specified [ActorContext].
- *
- * @param ctx The actor context to create the logger for.
- */
- operator fun invoke(ctx: SimulationContext): Logger {
- val logger = LoggerFactory.getLogger(ctx.javaClass)
- return if (logger is LocationAwareLogger) {
- LocationAwareLoggerImpl(ctx, logger)
- } else {
- LocationIgnorantLoggerImpl(ctx, logger)
- }
- }
- }
-}
diff --git a/simulator/odcsim/odcsim-engine-omega/src/main/resources/META-INF/services/com.atlarge.odcsim.SimulationEngineProvider b/simulator/odcsim/odcsim-engine-omega/src/main/resources/META-INF/services/com.atlarge.odcsim.SimulationEngineProvider
deleted file mode 100644
index 1131cebd..00000000
--- a/simulator/odcsim/odcsim-engine-omega/src/main/resources/META-INF/services/com.atlarge.odcsim.SimulationEngineProvider
+++ /dev/null
@@ -1 +0,0 @@
-com.atlarge.odcsim.engine.omega.OmegaSimulationEngineProvider
diff --git a/simulator/opendc/opendc-compute/build.gradle.kts b/simulator/opendc-compute/build.gradle.kts
index 376c4269..dfdd6f35 100644
--- a/simulator/opendc/opendc-compute/build.gradle.kts
+++ b/simulator/opendc-compute/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2017 atlarge-research
+ * Copyright (c) 2017 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
@@ -30,11 +28,11 @@ plugins {
}
dependencies {
- api(project(":odcsim:odcsim-api"))
- api(project(":opendc:opendc-core"))
+ api(project(":opendc-core"))
+ implementation(project(":opendc-utils"))
implementation("io.github.microutils:kotlin-logging:1.7.9")
- testRuntimeOnly(project(":odcsim:odcsim-engine-omega"))
+ testImplementation(project(":opendc-simulator"))
testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Flavor.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt
index a49d3abf..e5ca115f 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Flavor.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Flavor.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
/**
* Flavors define the compute and memory capacity of [Server] instance. To put it simply, a flavor is an available
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/MemoryUnit.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/MemoryUnit.kt
index ce57fc72..f41c41c4 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/MemoryUnit.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/MemoryUnit.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
/**
* A memory unit of a compute resource, either virtual or physical.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingNode.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt
index 91f5dde9..23c82816 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingNode.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
/**
* A processing node/package/socket containing possibly several CPU cores.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingUnit.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingUnit.kt
index ba148ee0..e6ee7f9a 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ProcessingUnit.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingUnit.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
/**
* A single logical compute unit of processor node, either virtual or physical.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Server.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt
index fd0fc836..948f622f 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/Server.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/Server.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,14 +20,14 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.core.resource.Resource
-import com.atlarge.opendc.core.resource.TagContainer
-import com.atlarge.opendc.core.services.ServiceRegistry
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.compute.core.image.Image
+import org.opendc.core.resource.Resource
+import org.opendc.core.resource.TagContainer
+import org.opendc.core.services.ServiceRegistry
+import java.util.UUID
/**
* A server instance that is running on some physical or virtual machine.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerEvent.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt
index 1595937c..fbef8a7d 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerEvent.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
-import com.atlarge.opendc.core.services.ServiceKey
+import org.opendc.core.services.ServiceKey
/**
* An event that is emitted by a [Server].
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerState.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt
index 27372a5e..4b9d7c13 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/ServerState.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ServerState.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core
+package org.opendc.compute.core
/**
* An enumeration describing the possible states of a server.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerContext.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt
index f770fa49..3cab94c0 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerContext.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,26 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.execution
+package org.opendc.compute.core.execution
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.core.services.ServiceKey
import kotlinx.coroutines.selects.SelectClause0
import kotlinx.coroutines.selects.select
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.image.Image
+import org.opendc.core.services.ServiceKey
+import java.time.Clock
/**
* Represents the execution context in which a bootable [Image] runs on a [Server].
*/
public interface ServerContext {
/**
+ * The virtual clock.
+ */
+ public val clock: Clock
+
+ /**
* The server on which the image runs.
*/
public val server: Server
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerManagementContext.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerManagementContext.kt
index 5a9b725b..51727e43 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ServerManagementContext.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerManagementContext.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.execution
+package org.opendc.compute.core.execution
/**
* An extended [ServerContext] providing several methods for managing the execution context.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ShutdownException.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ShutdownException.kt
index e4da557b..d751fb5e 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/execution/ShutdownException.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ShutdownException.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.execution
+package org.opendc.compute.core.execution
import kotlinx.coroutines.CancellationException
@@ -30,7 +28,8 @@ import kotlinx.coroutines.CancellationException
* This exception is thrown by the underlying [ServerContext] to indicate that a shutdown flow
* has been sent to the server.
*/
-public class ShutdownException(message: String? = null, override val cause: Throwable? = null) : CancellationException(message)
+public class ShutdownException(message: String? = null, override val cause: Throwable? = null) :
+ CancellationException(message)
/**
* This method terminates the current active coroutine if the specified [CancellationException] is caused
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/EmptyImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt
index 8f6c4682..1f760978 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/EmptyImage.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.image
+package org.opendc.compute.core.image
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.core.resource.TagContainer
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.core.resource.TagContainer
import java.util.UUID
/**
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt
index d65e7e94..9a95520e 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImage.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.image
+package org.opendc.compute.core.image
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.core.resource.TagContainer
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.core.resource.TagContainer
import java.util.UUID
import kotlin.math.min
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsHistoryFragment.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsHistoryFragment.kt
index 5b0035e3..7097c818 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/FlopsHistoryFragment.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsHistoryFragment.kt
@@ -1,3 +1,3 @@
-package com.atlarge.opendc.compute.core.image
+package org.opendc.compute.core.image
data class FlopsHistoryFragment(val tick: Long, val flops: Long, val duration: Long, val usage: Double, val cores: Int)
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/Image.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt
index 52d4d7b5..d04920c3 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/Image.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/Image.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.image
+package org.opendc.compute.core.image
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.core.resource.Resource
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.core.resource.Resource
/**
* An image containing a bootable operating system that can directly be executed by physical or virtual server.
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/VmImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/VmImage.kt
new file mode 100644
index 00000000..b6622fa4
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/VmImage.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 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.compute.core.image
+
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.core.resource.TagContainer
+import java.util.*
+import kotlin.math.min
+
+class VmImage(
+ public override val uid: UUID,
+ public override val name: String,
+ public override val tags: TagContainer,
+ public val flopsHistory: Sequence<FlopsHistoryFragment>,
+ public val maxCores: Int,
+ public val requiredMemory: Long
+) : Image {
+
+ override suspend fun invoke(ctx: ServerContext) {
+ var offset = ctx.clock.millis()
+
+ val batch = flopsHistory.map { fragment ->
+ val cores = min(fragment.cores, ctx.server.flavor.cpuCount)
+ val burst = LongArray(cores) { fragment.flops / cores }
+ val usage = DoubleArray(cores) { fragment.usage / cores }
+ offset += fragment.duration
+ ServerContext.Slice(burst, usage, offset)
+ }
+
+ ctx.run(batch)
+ }
+
+ override fun toString(): String = "VmImage(uid=$uid, name=$name, cores=$maxCores, requiredMemory=$requiredMemory)"
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt
index 3f885f89..f84366b2 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.workload
+package org.opendc.compute.core.workload
-import com.atlarge.opendc.compute.core.Server
+import org.opendc.compute.core.Server
import java.util.*
import kotlin.random.Random
@@ -57,7 +55,12 @@ class PerformanceInterferenceModel(
private fun doesMatch(item: PerformanceInterferenceModelItem): Boolean {
var count = 0
- for (name in item.workloadNames.subSet(colocatedWorkloads.firstKey(), colocatedWorkloads.lastKey() + "\u0000")) {
+ for (
+ name in item.workloadNames.subSet(
+ colocatedWorkloads.firstKey(),
+ colocatedWorkloads.lastKey() + "\u0000"
+ )
+ ) {
count += colocatedWorkloads.getOrDefault(name, 0)
if (count > 1)
return true
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt
new file mode 100644
index 00000000..d8edb416
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/VmWorkload.kt
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 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.compute.core.workload
+
+import org.opendc.compute.core.image.VmImage
+import org.opendc.core.User
+import org.opendc.core.workload.Workload
+import java.util.UUID
+
+/**
+ * A workload that represents a VM.
+ *
+ * @property uid A unique identified of this VM.
+ * @property name The name of this VM.
+ * @property owner The owner of the VM.
+ * @property image The image of the VM.
+ */
+data class VmWorkload(
+ override val uid: UUID,
+ override val name: String,
+ override val owner: User,
+ val image: VmImage
+) : Workload {
+ override fun equals(other: Any?): Boolean = other is VmWorkload && uid == other.uid
+
+ override fun hashCode(): Int = uid.hashCode()
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Metadata.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt
index a3a851fe..389f4ab9 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Metadata.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal
+package org.opendc.compute.metal
/*
* Common metadata keys for bare-metal nodes.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Node.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt
index cb637aea..5cb4be1a 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/Node.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Node.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,13 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal
+package org.opendc.compute.metal
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.core.Identity
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.image.Image
+import org.opendc.core.Identity
+import java.util.UUID
/**
* A bare-metal compute node.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeEvent.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt
index 7719db24..d367f2e6 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeEvent.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeEvent.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal
+package org.opendc.compute.metal
/**
* An event that is emitted by a [Node].
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeState.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt
index ca9cf509..e76e0b43 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/NodeState.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/NodeState.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal
+package org.opendc.compute.metal
/**
* An enumeration describing the possible states of a bare-metal compute node.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/BareMetalDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt
index 17d8ee53..2d7ba2ed 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/BareMetalDriver.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,16 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.driver
+package org.opendc.compute.metal.driver
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.core.failure.FailureDomain
-import com.atlarge.opendc.core.power.Powerable
-import com.atlarge.opendc.core.services.AbstractServiceKey
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.metal.Node
+import org.opendc.core.failure.FailureDomain
+import org.opendc.core.power.Powerable
+import org.opendc.core.services.AbstractServiceKey
+import java.util.UUID
/**
* A driver interface for the management interface of a bare-metal compute node.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
index a453e459..98ba8994 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,38 +20,8 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.driver
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.SimulationContext
-import com.atlarge.odcsim.flow.EventFlow
-import com.atlarge.odcsim.flow.StateFlow
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.MemoryUnit
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.ServerState
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.compute.core.execution.ServerManagementContext
-import com.atlarge.opendc.compute.core.execution.ShutdownException
-import com.atlarge.opendc.compute.core.image.EmptyImage
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.compute.metal.NodeEvent
-import com.atlarge.opendc.compute.metal.NodeState
-import com.atlarge.opendc.compute.metal.power.ConstantPowerModel
-import com.atlarge.opendc.core.power.PowerModel
-import com.atlarge.opendc.core.services.ServiceKey
-import com.atlarge.opendc.core.services.ServiceRegistry
-import java.lang.Exception
-import java.time.Clock
-import java.util.UUID
-import kotlin.coroutines.ContinuationInterceptor
-import kotlin.math.ceil
-import kotlin.math.max
-import kotlin.math.min
-import kotlin.random.Random
+package org.opendc.compute.metal.driver
+
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Delay
import kotlinx.coroutines.DisposableHandle
@@ -67,12 +35,40 @@ import kotlinx.coroutines.intrinsics.startCoroutineCancellable
import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.SelectClause0
import kotlinx.coroutines.selects.SelectInstance
-import kotlinx.coroutines.withContext
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.MemoryUnit
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.ServerState
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.compute.core.execution.ServerManagementContext
+import org.opendc.compute.core.execution.ShutdownException
+import org.opendc.compute.core.image.EmptyImage
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.metal.Node
+import org.opendc.compute.metal.NodeEvent
+import org.opendc.compute.metal.NodeState
+import org.opendc.compute.metal.power.ConstantPowerModel
+import org.opendc.core.power.PowerModel
+import org.opendc.core.services.ServiceKey
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.utils.flow.EventFlow
+import org.opendc.utils.flow.StateFlow
+import java.lang.Exception
+import java.time.Clock
+import java.util.UUID
+import kotlin.coroutines.ContinuationInterceptor
+import kotlin.math.ceil
+import kotlin.math.max
+import kotlin.math.min
+import kotlin.random.Random
/**
* A basic implementation of the [BareMetalDriver] that simulates an [Image] running on a bare-metal machine.
*
- * @param domain The simulation domain the driver runs in.
+ * @param coroutineScope The [CoroutineScope] the driver runs in.
+ * @param clock The virtual clock to keep track of time.
* @param uid The unique identifier of the machine.
* @param name An optional name of the machine.
* @param metadata The initial metadata of the node.
@@ -82,7 +78,8 @@ import kotlinx.coroutines.withContext
*/
@OptIn(ExperimentalCoroutinesApi::class)
public class SimpleBareMetalDriver(
- private val domain: Domain,
+ private val coroutineScope: CoroutineScope,
+ private val clock: Clock,
uid: UUID,
name: String,
metadata: Map<String, Any>,
@@ -115,7 +112,8 @@ public class SimpleBareMetalDriver(
/**
* The machine state.
*/
- private val nodeState = StateFlow(Node(uid, name, metadata + ("driver" to this), NodeState.SHUTOFF, EmptyImage, null, events))
+ private val nodeState =
+ StateFlow(Node(uid, name, metadata + ("driver" to this), NodeState.SHUTOFF, EmptyImage, null, events))
override val node: Flow<Node> = nodeState
@@ -129,14 +127,14 @@ public class SimpleBareMetalDriver(
*/
private val random = Random(uid.leastSignificantBits xor uid.mostSignificantBits)
- override suspend fun init(): Node = withContext(domain.coroutineContext) {
- nodeState.value
+ override suspend fun init(): Node {
+ return nodeState.value
}
- override suspend fun start(): Node = withContext(domain.coroutineContext) {
+ override suspend fun start(): Node {
val node = nodeState.value
if (node.state != NodeState.SHUTOFF) {
- return@withContext node
+ return node
}
val events = EventFlow<ServerEvent>()
@@ -153,13 +151,13 @@ public class SimpleBareMetalDriver(
setNode(node.copy(state = NodeState.BOOT, server = server))
serverContext = BareMetalServerContext(events)
- return@withContext nodeState.value
+ return nodeState.value
}
- override suspend fun stop(): Node = withContext(domain.coroutineContext) {
+ override suspend fun stop(): Node {
val node = nodeState.value
if (node.state == NodeState.SHUTOFF) {
- return@withContext node
+ return node
}
// We terminate the image running on the machine
@@ -167,20 +165,20 @@ public class SimpleBareMetalDriver(
serverContext = null
setNode(node.copy(state = NodeState.SHUTOFF, server = null))
- return@withContext node
+ return node
}
- override suspend fun reboot(): Node = withContext(domain.coroutineContext) {
+ override suspend fun reboot(): Node {
stop()
- start()
+ return start()
}
- override suspend fun setImage(image: Image): Node = withContext(domain.coroutineContext) {
+ override suspend fun setImage(image: Image): Node {
setNode(nodeState.value.copy(image = image))
- return@withContext nodeState.value
+ return nodeState.value
}
- override suspend fun refresh(): Node = withContext(domain.coroutineContext) { nodeState.value }
+ override suspend fun refresh(): Node = nodeState.value
private fun setNode(value: Node) {
val field = nodeState.value
@@ -207,7 +205,10 @@ public class SimpleBareMetalDriver(
override val server: Server
get() = nodeState.value.server!!
- private val job = domain.launch {
+ override val clock: Clock
+ get() = this@SimpleBareMetalDriver.clock
+
+ private val job = coroutineScope.launch {
delay(1) // TODO Introduce boot time
init()
try {
@@ -265,18 +266,13 @@ public class SimpleBareMetalDriver(
private var usageFlush: DisposableHandle? = null
/**
- * Cache the [Clock] for timing.
- */
- private val clock = domain.coroutineContext[SimulationContext]!!.clock
-
- /**
* Cache the [Delay] instance for timing.
*
* XXX We need to cache this before the call to [onRun] since doing this in [onRun] is too heavy.
* XXX Note however that this is an ugly hack which may break in the future.
*/
@OptIn(InternalCoroutinesApi::class)
- private val delay = domain.coroutineContext[ContinuationInterceptor] as Delay
+ private val delay = coroutineScope.coroutineContext[ContinuationInterceptor] as Delay
@OptIn(InternalCoroutinesApi::class)
override fun onRun(
@@ -353,10 +349,10 @@ public class SimpleBareMetalDriver(
currentDisposable?.dispose()
// Schedule reset the usage of the machine since the call is returning
- usageFlush = delay.invokeOnTimeout(1, Runnable {
+ usageFlush = delay.invokeOnTimeout(1) {
usageState.value = 0.0
usageFlush = null
- })
+ }
}
select.disposeOnSelect(disposable)
@@ -408,7 +404,8 @@ public class SimpleBareMetalDriver(
for (i in 0 until min(cpus.size, slice.burst.size)) {
val cpu = cpus[i]
val usage = min(slice.limit[i], cpu.frequency)
- val cpuDuration = ceil(slice.burst[i] / usage * 1000).toLong() // Convert from seconds to milliseconds
+ val cpuDuration =
+ ceil(slice.burst[i] / usage * 1000).toLong() // Convert from seconds to milliseconds
totalUsage += usage / cpu.frequency
@@ -458,7 +455,7 @@ public class SimpleBareMetalDriver(
}
override val scope: CoroutineScope
- get() = domain
+ get() = coroutineScope
override suspend fun fail() {
serverContext?.unavailable = true
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/power/PowerModels.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt
index 9ddbe08e..9286626c 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/power/PowerModels.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/power/PowerModels.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.power
+package org.opendc.compute.metal.power
-import com.atlarge.opendc.compute.metal.driver.BareMetalDriver
-import com.atlarge.opendc.core.power.PowerModel
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
+import org.opendc.compute.metal.driver.BareMetalDriver
+import org.opendc.core.power.PowerModel
/**
* A power model which emits a single value.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/ProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt
index a54d8df4..9b056adf 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/ProvisioningService.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.service
+package org.opendc.compute.metal.service
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.compute.metal.driver.BareMetalDriver
-import com.atlarge.opendc.core.services.AbstractServiceKey
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.metal.Node
+import org.opendc.compute.metal.driver.BareMetalDriver
+import org.opendc.core.services.AbstractServiceKey
import java.util.UUID
/**
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt
index f6b236ae..3d126ba1 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningService.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/SimpleProvisioningService.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,46 +20,43 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.service
+package org.opendc.compute.metal.service
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.compute.metal.driver.BareMetalDriver
import kotlinx.coroutines.CancellationException
-import kotlinx.coroutines.withContext
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.metal.Node
+import org.opendc.compute.metal.driver.BareMetalDriver
/**
* A very basic implementation of the [ProvisioningService].
*/
-public class SimpleProvisioningService(val domain: Domain) : ProvisioningService {
+public class SimpleProvisioningService : ProvisioningService {
/**
* The active nodes in this service.
*/
private val nodes: MutableMap<Node, BareMetalDriver> = mutableMapOf()
- override suspend fun create(driver: BareMetalDriver): Node = withContext(domain.coroutineContext) {
+ override suspend fun create(driver: BareMetalDriver): Node {
val node = driver.init()
nodes[node] = driver
- return@withContext node
+ return node
}
- override suspend fun nodes(): Set<Node> = withContext(domain.coroutineContext) { nodes.keys }
+ override suspend fun nodes(): Set<Node> = nodes.keys
- override suspend fun refresh(node: Node): Node = withContext(domain.coroutineContext) {
- return@withContext nodes[node]!!.refresh()
+ override suspend fun refresh(node: Node): Node {
+ return nodes[node]!!.refresh()
}
- override suspend fun deploy(node: Node, image: Image): Node = withContext(domain.coroutineContext) {
+ override suspend fun deploy(node: Node, image: Image): Node {
val driver = nodes[node]!!
driver.setImage(image)
- val newNode = driver.reboot()
- return@withContext newNode
+ return driver.reboot()
}
- override suspend fun stop(node: Node): Node = withContext(domain.coroutineContext) {
+ override suspend fun stop(node: Node): Node {
val driver = nodes[node]!!
- try {
+ return try {
driver.stop()
} catch (e: CancellationException) {
node
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/Hypervisor.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt
index 1e7e351f..5dd98bbc 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/Hypervisor.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/Hypervisor.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt
+package org.opendc.compute.virt
-import com.atlarge.opendc.core.Identity
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.core.Identity
+import java.util.UUID
/**
* A hypervisor (or virtual machine monitor) is software or firmware that virtualizes the host compute environment
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorEvent.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt
index 7c088bc8..1e2e285c 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorEvent.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt
+package org.opendc.compute.virt
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
+import org.opendc.compute.core.Server
+import org.opendc.compute.virt.driver.VirtDriver
/**
* An event that is emitted by a [VirtDriver].
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt
index 607759a8..84d26593 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/HypervisorImage.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,16 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt
+package org.opendc.compute.virt
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.virt.driver.SimpleVirtDriver
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import com.atlarge.opendc.core.resource.TagContainer
-import java.util.UUID
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.suspendCancellableCoroutine
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.virt.driver.SimpleVirtDriver
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.core.resource.TagContainer
+import java.util.UUID
/**
* A hypervisor managing the VMs of a node.
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt
index 0586ae00..83dd70d4 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/InsufficientMemoryOnServerException.kt
@@ -1,3 +1,3 @@
-package com.atlarge.opendc.compute.virt.driver
+package org.opendc.compute.virt.driver
public class InsufficientMemoryOnServerException : IllegalStateException("Insufficient memory left on server.")
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt
index 192db413..4d39dc4b 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,43 +20,41 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.driver
-
-import com.atlarge.odcsim.flow.EventFlow
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.ServerState
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.compute.core.execution.ServerManagementContext
-import com.atlarge.opendc.compute.core.execution.ShutdownException
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.virt.HypervisorEvent
-import com.atlarge.opendc.core.services.ServiceKey
-import com.atlarge.opendc.core.services.ServiceRegistry
-import java.util.UUID
-import kotlin.math.ceil
-import kotlin.math.max
-import kotlin.math.min
-import kotlinx.coroutines.CancellationException
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.DisposableHandle
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.FlowPreview
-import kotlinx.coroutines.InternalCoroutinesApi
-import kotlinx.coroutines.Job
+package org.opendc.compute.virt.driver
+
+import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
-import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.intrinsics.startCoroutineCancellable
-import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.SelectClause0
import kotlinx.coroutines.selects.SelectInstance
import kotlinx.coroutines.selects.select
+import mu.KotlinLogging
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.ServerState
+import org.opendc.compute.core.execution.ServerContext
+import org.opendc.compute.core.execution.ServerManagementContext
+import org.opendc.compute.core.execution.ShutdownException
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.virt.HypervisorEvent
+import org.opendc.core.services.ServiceKey
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.utils.flow.EventFlow
+import java.time.Clock
+import java.util.UUID
+import kotlin.math.ceil
+import kotlin.math.max
+import kotlin.math.min
+
+/**
+ * The logging instance to use.
+ */
+private val logger = KotlinLogging.logger {}
/**
* A [VirtDriver] that is backed by a simple hypervisor implementation.
@@ -94,10 +90,12 @@ class SimpleVirtDriver(
init {
launch {
try {
+ // Yield first to allow class variables to initialize
+ yield()
scheduler()
} catch (e: Exception) {
if (e !is CancellationException) {
- simulationContext.log.error("Hypervisor scheduler failed", e)
+ logger.error("Hypervisor scheduler failed", e)
}
throw e
}
@@ -117,8 +115,14 @@ class SimpleVirtDriver(
val events = EventFlow<ServerEvent>()
val server = Server(
- UUID.randomUUID(), name, emptyMap(), flavor, image, ServerState.BUILD,
- ServiceRegistry(), events
+ UUID.randomUUID(),
+ name,
+ emptyMap(),
+ flavor,
+ image,
+ ServerState.BUILD,
+ ServiceRegistry(),
+ events
)
availableMemory -= requiredMemory
vms.add(VmServerContext(server, events))
@@ -181,7 +185,7 @@ class SimpleVirtDriver(
* The scheduling process of the hypervisor.
*/
private suspend fun scheduler() {
- val clock = simulationContext.clock
+ val clock = hostContext.clock
val maxUsage = hostContext.cpus.sumByDouble { it.frequency }
val pCPUs = hostContext.cpus.indices.sortedBy { hostContext.cpus[it].frequency }
@@ -201,7 +205,8 @@ class SimpleVirtDriver(
vms -= command.vm
vcpus.removeAll(command.vm.vcpus)
}
- is SchedulerCommand.Interrupt -> {}
+ is SchedulerCommand.Interrupt -> {
+ }
}
}
@@ -284,7 +289,8 @@ class SimpleVirtDriver(
// time, so not all of the burst may be executed.
select<Boolean> {
schedulingQueue.onReceive { schedulingQueue.offer(it); true }
- hostContext.onRun(ServerContext.Slice(burst, usage, deadline), ServerContext.TriggerMode.DEADLINE).invoke { false }
+ hostContext.onRun(ServerContext.Slice(burst, usage, deadline), ServerContext.TriggerMode.DEADLINE)
+ .invoke { false }
}
val end = clock.millis()
@@ -295,7 +301,8 @@ class SimpleVirtDriver(
}
// The total requested burst that the VMs wanted to run in the time-frame that we ran.
- val totalRequestedSubBurst = vcpus.map { ceil((duration * 1000) / (it.vm.deadline - start) * it.burst).toLong() }.sum()
+ val totalRequestedSubBurst =
+ vcpus.map { ceil((duration * 1000) / (it.vm.deadline - start) * it.burst).toLong() }.sum()
val totalRemainder = burst.sum()
val totalGrantedBurst = totalAllocatedBurst - totalRemainder
@@ -352,7 +359,10 @@ class SimpleVirtDriver(
min(totalRequestedSubBurst, totalGrantedBurst), // We can run more than requested due to timing
totalOvercommissionedBurst,
totalInterferedBurst, // Might be smaller than zero due to FP rounding errors,
- min(totalAllocatedUsage, totalRequestedUsage), // The allocated usage might be slightly higher due to FP rounding
+ min(
+ totalAllocatedUsage,
+ totalRequestedUsage
+ ), // The allocated usage might be slightly higher due to FP rounding
totalRequestedUsage,
vmCount, // Some VMs might already have finished, so keep initial VM count
server
@@ -534,7 +544,9 @@ class SimpleVirtDriver(
* @param server The details of the VM.
* @param events The event stream to publish to.
*/
- private inner class VmServerContext(server: Server, val events: EventFlow<ServerEvent>) : ServerManagementContext, DisposableHandle {
+ private inner class VmServerContext(server: Server, val events: EventFlow<ServerEvent>) :
+ ServerManagementContext,
+ DisposableHandle {
private var finalized: Boolean = false
private var initialized: Boolean = false
private val vm: Vm
@@ -561,6 +573,9 @@ class SimpleVirtDriver(
override val cpus: List<ProcessingUnit> = hostContext.cpus.take(server.flavor.cpuCount)
+ override val clock: Clock
+ get() = hostContext.clock
+
init {
vm = Vm(this)
}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/VirtDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt
index b1844f67..b169a00b 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/VirtDriver.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,15 +20,15 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.driver
+package org.opendc.compute.virt.driver
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.virt.HypervisorEvent
-import com.atlarge.opendc.core.services.AbstractServiceKey
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.virt.HypervisorEvent
+import org.opendc.core.services.AbstractServiceKey
+import java.util.UUID
/**
* A driver interface for a hypervisor running on some host server and communicating with the central compute service to
@@ -50,7 +48,11 @@ public interface VirtDriver {
* @param flavor The flavor of the server which this driver is controlling.
* @return The virtual server spawned by this method.
*/
- public suspend fun spawn(name: String, image: Image, flavor: Flavor): Server
+ public suspend fun spawn(
+ name: String,
+ image: Image,
+ flavor: Flavor
+ ): Server
companion object Key : AbstractServiceKey<VirtDriver>(UUID.randomUUID(), "virtual-driver")
}
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt
new file mode 100644
index 00000000..197b4392
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/HypervisorView.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020 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.compute.virt.service
+
+import org.opendc.compute.core.Server
+import org.opendc.compute.virt.driver.VirtDriver
+import java.util.UUID
+
+class HypervisorView(
+ val uid: UUID,
+ var server: Server,
+ var numberOfActiveServers: Int,
+ var availableMemory: Long,
+ var provisionedCores: Int
+) {
+ lateinit var driver: VirtDriver
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt
index 79388bc3..c5d2fd66 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt
@@ -1,44 +1,60 @@
-package com.atlarge.opendc.compute.virt.service
-
-import com.atlarge.odcsim.SimulationContext
-import com.atlarge.odcsim.flow.EventFlow
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.ServerState
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.virt.HypervisorEvent
-import com.atlarge.opendc.compute.virt.HypervisorImage
-import com.atlarge.opendc.compute.virt.driver.InsufficientMemoryOnServerException
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import com.atlarge.opendc.compute.virt.service.allocation.AllocationPolicy
-import com.atlarge.opendc.core.services.ServiceKey
-import kotlin.coroutines.Continuation
-import kotlin.coroutines.resume
-import kotlin.math.max
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.delay
+/*
+ * Copyright (c) 2020 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.compute.virt.service
+
+import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.suspendCancellableCoroutine
-import kotlinx.coroutines.withContext
import mu.KotlinLogging
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.ServerState
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.virt.HypervisorEvent
+import org.opendc.compute.virt.HypervisorImage
+import org.opendc.compute.virt.driver.InsufficientMemoryOnServerException
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.compute.virt.service.allocation.AllocationPolicy
+import org.opendc.core.services.ServiceKey
+import org.opendc.utils.flow.EventFlow
+import java.time.Clock
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.resume
+import kotlin.math.max
private val logger = KotlinLogging.logger {}
@OptIn(ExperimentalCoroutinesApi::class)
class SimpleVirtProvisioningService(
- public override val allocationPolicy: AllocationPolicy,
- private val ctx: SimulationContext,
- private val provisioningService: ProvisioningService
-) : VirtProvisioningService, CoroutineScope by ctx.domain {
+ private val coroutineScope: CoroutineScope,
+ private val clock: Clock,
+ private val provisioningService: ProvisioningService,
+ override val allocationPolicy: AllocationPolicy
+) : VirtProvisioningService {
/**
* The hypervisors that have been launched by the service.
*/
@@ -59,11 +75,11 @@ class SimpleVirtProvisioningService(
*/
private val activeImages: MutableSet<ImageView> = mutableSetOf()
- public var submittedVms = 0
- public var queuedVms = 0
- public var runningVms = 0
- public var finishedVms = 0
- public var unscheduledVms = 0
+ var submittedVms = 0
+ var queuedVms = 0
+ var runningVms = 0
+ var finishedVms = 0
+ var unscheduledVms = 0
private var maxCores = 0
private var maxMemory = 0L
@@ -81,7 +97,7 @@ class SimpleVirtProvisioningService(
override val events: Flow<VirtProvisioningEvent> = eventFlow
init {
- launch {
+ coroutineScope.launch {
val provisionedNodes = provisioningService.nodes()
provisionedNodes.forEach { node ->
val hypervisorImage = HypervisorImage
@@ -96,27 +112,29 @@ class SimpleVirtProvisioningService(
}
}
- override suspend fun drivers(): Set<VirtDriver> = withContext(coroutineContext) {
- availableHypervisors.map { it.driver }.toSet()
+ override suspend fun drivers(): Set<VirtDriver> {
+ return availableHypervisors.map { it.driver }.toSet()
}
override suspend fun deploy(
name: String,
image: Image,
flavor: Flavor
- ): Server = withContext(coroutineContext) {
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- ++submittedVms,
- runningVms,
- finishedVms,
- ++queuedVms,
- unscheduledVms
- ))
-
- suspendCancellableCoroutine<Server> { cont ->
+ ): Server {
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ ++submittedVms,
+ runningVms,
+ finishedVms,
+ ++queuedVms,
+ unscheduledVms
+ )
+ )
+
+ return suspendCancellableCoroutine<Server> { cont ->
val vmInstance = ImageView(name, image, flavor, cont)
incomingImages += vmInstance
requestCycle()
@@ -139,9 +157,9 @@ class SimpleVirtProvisioningService(
// We assume that the provisioner runs at a fixed slot every time quantum (e.g t=0, t=60, t=120).
// This is important because the slices of the VMs need to be aligned.
// We calculate here the delay until the next scheduling slot.
- val delay = quantum - (ctx.clock.millis() % quantum)
+ val delay = quantum - (clock.millis() % quantum)
- val call = launch {
+ val call = coroutineScope.launch {
delay(delay)
this@SimpleVirtProvisioningService.call = null
schedule()
@@ -150,7 +168,6 @@ class SimpleVirtProvisioningService(
}
private suspend fun schedule() {
- val clock = simulationContext.clock
val imagesToBeScheduled = incomingImages.toSet()
for (imageInstance in imagesToBeScheduled) {
@@ -159,16 +176,18 @@ class SimpleVirtProvisioningService(
if (selectedHv == null) {
if (requiredMemory > maxMemory || imageInstance.flavor.cpuCount > maxCores) {
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- runningVms,
- finishedVms,
- queuedVms,
- ++unscheduledVms
- ))
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ runningVms,
+ finishedVms,
+ queuedVms,
+ ++unscheduledVms
+ )
+ )
incomingImages -= imageInstance
@@ -180,7 +199,7 @@ class SimpleVirtProvisioningService(
}
try {
- logger.info { "[${ctx.clock.millis()}] Spawning ${imageInstance.image} on ${selectedHv.server.uid} ${selectedHv.server.name} ${selectedHv.server.flavor}" }
+ logger.info { "[${clock.millis()}] Spawning ${imageInstance.image} on ${selectedHv.server.uid} ${selectedHv.server.name} ${selectedHv.server.flavor}" }
incomingImages -= imageInstance
// Speculatively update the hypervisor view information to prevent other images in the queue from
@@ -197,16 +216,18 @@ class SimpleVirtProvisioningService(
imageInstance.server = server
imageInstance.continuation.resume(server)
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- ++runningVms,
- finishedVms,
- --queuedVms,
- unscheduledVms
- ))
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ ++runningVms,
+ finishedVms,
+ --queuedVms,
+ unscheduledVms
+ )
+ )
activeImages += imageInstance
server.events
@@ -214,18 +235,20 @@ class SimpleVirtProvisioningService(
when (event) {
is ServerEvent.StateChanged -> {
if (event.server.state == ServerState.SHUTOFF) {
- logger.info { "[${ctx.clock.millis()}] Server ${event.server.uid} ${event.server.name} ${event.server.flavor} finished." }
-
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- --runningVms,
- ++finishedVms,
- queuedVms,
- unscheduledVms
- ))
+ logger.info { "[${clock.millis()}] Server ${event.server.uid} ${event.server.name} ${event.server.flavor} finished." }
+
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ --runningVms,
+ ++finishedVms,
+ queuedVms,
+ unscheduledVms
+ )
+ )
activeImages -= imageInstance
selectedHv.provisionedCores -= server.flavor.cpuCount
@@ -238,7 +261,7 @@ class SimpleVirtProvisioningService(
}
}
}
- .launchIn(this)
+ .launchIn(coroutineScope)
} catch (e: InsufficientMemoryOnServerException) {
logger.error("Failed to deploy VM", e)
@@ -254,7 +277,7 @@ class SimpleVirtProvisioningService(
private fun stateChanged(server: Server) {
when (server.state) {
ServerState.ACTIVE -> {
- logger.debug { "[${ctx.clock.millis()}] Server ${server.uid} available: ${server.state}" }
+ logger.debug { "[${clock.millis()}] Server ${server.uid} available: ${server.state}" }
if (server in hypervisors) {
// Corner case for when the hypervisor already exists
@@ -272,16 +295,18 @@ class SimpleVirtProvisioningService(
hypervisors[server] = hv
}
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- runningVms,
- finishedVms,
- queuedVms,
- unscheduledVms
- ))
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ runningVms,
+ finishedVms,
+ queuedVms,
+ unscheduledVms
+ )
+ )
// Re-schedule on the new machine
if (incomingImages.isNotEmpty()) {
@@ -289,20 +314,22 @@ class SimpleVirtProvisioningService(
}
}
ServerState.SHUTOFF, ServerState.ERROR -> {
- logger.debug { "[${ctx.clock.millis()}] Server ${server.uid} unavailable: ${server.state}" }
+ logger.debug { "[${clock.millis()}] Server ${server.uid} unavailable: ${server.state}" }
val hv = hypervisors[server] ?: return
availableHypervisors -= hv
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- runningVms,
- finishedVms,
- queuedVms,
- unscheduledVms
- ))
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ runningVms,
+ finishedVms,
+ queuedVms,
+ unscheduledVms
+ )
+ )
if (incomingImages.isNotEmpty()) {
requestCycle()
@@ -318,16 +345,18 @@ class SimpleVirtProvisioningService(
hv.driver = server.services[VirtDriver]
availableHypervisors += hv
- eventFlow.emit(VirtProvisioningEvent.MetricsAvailable(
- this@SimpleVirtProvisioningService,
- hypervisors.size,
- availableHypervisors.size,
- submittedVms,
- runningVms,
- finishedVms,
- queuedVms,
- unscheduledVms
- ))
+ eventFlow.emit(
+ VirtProvisioningEvent.MetricsAvailable(
+ this@SimpleVirtProvisioningService,
+ hypervisors.size,
+ availableHypervisors.size,
+ submittedVms,
+ runningVms,
+ finishedVms,
+ queuedVms,
+ unscheduledVms
+ )
+ )
hv.driver.events
.onEach { event ->
@@ -335,7 +364,7 @@ class SimpleVirtProvisioningService(
hv.numberOfActiveServers = event.numberOfActiveServers
hv.availableMemory = event.availableMemory
}
- }.launchIn(this)
+ }.launchIn(coroutineScope)
requestCycle()
}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningEvent.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt
index c3fb99f9..13930320 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningEvent.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.service
+package org.opendc.compute.virt.service
/**
* An event that is emitted by the [VirtProvisioningService].
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngine.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt
index db05cb1d..a111603f 100644
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/SimulationEngine.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2018 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,37 +20,49 @@
* SOFTWARE.
*/
-package com.atlarge.odcsim
+package org.opendc.compute.virt.service
+
+import kotlinx.coroutines.flow.Flow
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.image.Image
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.compute.virt.service.allocation.AllocationPolicy
/**
- * An engine for managing logical processes represented as [Behavior] during simulation.
- *
- * An implementation of this interface should be provided by an engine. See for example *odcsim-engine-omega*,
- * which is the reference implementation of the *odcsim* API.
+ * A service for VM provisioning on a cloud.
*/
-public interface SimulationEngine {
+interface VirtProvisioningService {
/**
- * The name of this engine instance, used to distinguish between multiple engines running within the same JVM.
+ * The policy used for allocating a VM on the available hypervisors.
*/
- public val name: String
+ val allocationPolicy: AllocationPolicy
/**
- * Construct an anonymous root simulation domain.
+ * The events emitted by the service.
*/
- public fun newDomain(): Domain
+ public val events: Flow<VirtProvisioningEvent>
/**
- * Construct a new root simulation domain with the specified [name].
+ * Obtain the active hypervisors for this provisioner.
*/
- public fun newDomain(name: String): Domain
+ public suspend fun drivers(): Set<VirtDriver>
/**
- * Run the simulation.
+ * Submit the specified [Image] to the provisioning service.
+ *
+ * @param name The name of the server to deploy.
+ * @param image The image to be deployed.
+ * @param flavor The flavor of the machine instance to run this [image] on.
*/
- public suspend fun run()
+ public suspend fun deploy(
+ name: String,
+ image: Image,
+ flavor: Flavor
+ ): Server
/**
- * Terminates this engine in an asynchronous fashion.
+ * Terminate the provisioning service releasing all the leased bare-metal machines.
*/
public suspend fun terminate()
}
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt
new file mode 100644
index 00000000..c2f730b9
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AllocationPolicy.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 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.compute.virt.service.allocation
+
+import org.opendc.compute.metal.Node
+import org.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
+
+/**
+ * A policy for selecting the [Node] an image should be deployed to,
+ */
+public interface AllocationPolicy {
+ /**
+ * The logic of the allocation policy.
+ */
+ public interface Logic {
+ /**
+ * Select the node on which the server should be scheduled.
+ */
+ public fun select(
+ hypervisors: Set<HypervisorView>,
+ image: SimpleVirtProvisioningService.ImageView
+ ): HypervisorView?
+ }
+
+ /**
+ * Builds the logic of the policy.
+ */
+ operator fun invoke(): Logic
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt
index 79b622d2..80debff7 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.service.allocation
+package org.opendc.compute.virt.service.allocation
-import com.atlarge.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.HypervisorView
/**
* An [AllocationPolicy] that selects the machine with the highest/lowest amount of memory per core.
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt
new file mode 100644
index 00000000..259077aa
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020 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.compute.virt.service.allocation
+
+import org.opendc.compute.virt.service.HypervisorView
+
+/**
+ * Allocation policy that selects the node with the most available memory.
+ *
+ * @param reversed A flag to reverse the order (least amount of memory scores the best).
+ */
+public class AvailableMemoryAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy {
+ override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic {
+ override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { -it.availableMemory }
+ .run { if (reversed) reversed() else this }
+ }
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt
index 79dd95f3..4bccaef8 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.service.allocation
+package org.opendc.compute.virt.service.allocation
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
/**
* The logic for an [AllocationPolicy] that uses a [Comparator] to select the appropriate node.
diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt
new file mode 100644
index 00000000..c385e686
--- /dev/null
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020 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.compute.virt.service.allocation
+
+import org.opendc.compute.virt.service.HypervisorView
+
+/**
+ * Allocation policy that selects the node with the least amount of active servers.
+ *
+ * @param reversed A flag to reverse the order, such that the node with the most active servers is selected.
+ */
+public class NumberOfActiveServersAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy {
+ override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic {
+ override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { it.numberOfActiveServers }
+ .run { if (reversed) reversed() else this }
+ }
+}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt
index e1a995a0..f5d4abc5 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.service.allocation
+package org.opendc.compute.virt.service.allocation
-import com.atlarge.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.HypervisorView
/**
* An [AllocationPolicy] that takes into account the number of vCPUs that have been provisioned on this machine
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt
index 07dcf1c5..d40b2bc2 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt.service.allocation
+package org.opendc.compute.virt.service.allocation
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
import kotlin.random.Random
/**
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
index 59acfce2..fb086027 100644
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
+++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt
@@ -1,8 +1,30 @@
-package com.atlarge.opendc.compute.virt.service.allocation
+/*
+ * Copyright (c) 2020 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.compute.virt.service.allocation
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
import mu.KotlinLogging
+import org.opendc.compute.virt.service.HypervisorView
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
private val logger = KotlinLogging.logger {}
diff --git a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImageTest.kt b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/core/image/FlopsApplicationImageTest.kt
index 1c7b751c..309dceb8 100644
--- a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/core/image/FlopsApplicationImageTest.kt
+++ b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/core/image/FlopsApplicationImageTest.kt
@@ -22,12 +22,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.core.image
+package org.opendc.compute.core.image
-import java.util.UUID
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
+import java.util.UUID
/**
* Test suite for [FlopsApplicationImage]
diff --git a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt
index af9d3421..9c9dc864 100644
--- a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt
+++ b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriverTest.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,55 +20,54 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.driver
+package org.opendc.compute.metal.driver
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.ServerState
-import com.atlarge.opendc.compute.core.image.FlopsApplicationImage
-import java.util.ServiceLoader
-import java.util.UUID
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.withContext
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.ServerState
+import org.opendc.compute.core.image.FlopsApplicationImage
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.util.UUID
+@OptIn(ExperimentalCoroutinesApi::class)
internal class SimpleBareMetalDriverTest {
/**
* A smoke test for the bare-metal driver.
*/
@Test
fun smoke() {
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
+
var finalState: ServerState = ServerState.BUILD
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider("sim")
- val root = system.newDomain(name = "root")
- root.launch {
- val dom = root.newDomain(name = "driver")
+ testScope.launch {
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 4)
val cpus = List(4) { ProcessingUnit(cpuNode, it, 2400.0) }
- val driver = SimpleBareMetalDriver(dom, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
+ val driver = SimpleBareMetalDriver(this, clock, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
val image = FlopsApplicationImage(UUID.randomUUID(), "<unnamed>", emptyMap(), 1_000, 2)
// Batch driver commands
- withContext(dom.coroutineContext) {
+ withContext(coroutineContext) {
driver.init()
driver.setImage(image)
val server = driver.start().server!!
driver.usage
- .onEach { println("${simulationContext.clock.millis()} $it") }
+ .onEach { println("${clock.millis()} $it") }
.launchIn(this)
server.events.collect { event ->
when (event) {
is ServerEvent.StateChanged -> {
- println("${simulationContext.clock.millis()} $event")
+ println("${clock.millis()} $event")
finalState = event.server.state
}
}
@@ -78,11 +75,7 @@ internal class SimpleBareMetalDriverTest {
}
}
- runBlocking {
- system.run()
- system.terminate()
- }
-
+ testScope.advanceUntilIdle()
assertEquals(ServerState.SHUTOFF, finalState)
}
}
diff --git a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt
index ed2256c0..91d4787c 100644
--- a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt
+++ b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/metal/service/SimpleProvisioningServiceTest.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,42 +20,42 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.metal.service
+package org.opendc.compute.metal.service
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.image.FlopsApplicationImage
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import java.util.ServiceLoader
-import java.util.UUID
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.jupiter.api.Test
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.image.FlopsApplicationImage
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.util.UUID
/**
* Test suite for the [SimpleProvisioningService].
*/
+@OptIn(ExperimentalCoroutinesApi::class)
internal class SimpleProvisioningServiceTest {
/**
* A basic smoke test.
*/
@Test
fun smoke() {
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider("sim")
- val root = system.newDomain(name = "root")
- root.launch {
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
+
+ testScope.launch {
val image = FlopsApplicationImage(UUID.randomUUID(), "<unnamed>", emptyMap(), 1000, 2)
- val dom = root.newDomain("provisioner")
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 4)
val cpus = List(4) { ProcessingUnit(cpuNode, it, 2400.0) }
- val driver = SimpleBareMetalDriver(dom.newDomain(), UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
+ val driver = SimpleBareMetalDriver(this, clock, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
- val provisioner = SimpleProvisioningService(dom)
+ val provisioner = SimpleProvisioningService()
provisioner.create(driver)
delay(5)
val nodes = provisioner.nodes()
@@ -65,9 +63,6 @@ internal class SimpleProvisioningServiceTest {
node.server!!.events.collect { println(it) }
}
- runBlocking {
- system.run()
- system.terminate()
- }
+ testScope.advanceUntilIdle()
}
}
diff --git a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/virt/HypervisorTest.kt b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/HypervisorTest.kt
index 622b185e..68efb1a3 100644
--- a/simulator/opendc/opendc-compute/src/test/kotlin/com/atlarge/opendc/compute/virt/HypervisorTest.kt
+++ b/simulator/opendc-compute/src/test/kotlin/org/opendc/compute/virt/HypervisorTest.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,33 +20,33 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.compute.virt
-
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.core.image.FlopsApplicationImage
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import java.util.ServiceLoader
-import java.util.UUID
+package org.opendc.compute.virt
+
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.core.image.FlopsApplicationImage
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.util.UUID
/**
* Basic test-suite for the hypervisor.
*/
+@OptIn(ExperimentalCoroutinesApi::class)
internal class HypervisorTest {
/**
* A smoke test for the bare-metal driver.
@@ -57,20 +55,18 @@ internal class HypervisorTest {
@Test
@Disabled
fun smoke() {
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider("test")
- val root = system.newDomain("root")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
- root.launch {
+ testScope.launch {
val vmm = HypervisorImage
val workloadA = FlopsApplicationImage(UUID.randomUUID(), "<unnamed>", emptyMap(), 1_000, 1)
val workloadB = FlopsApplicationImage(UUID.randomUUID(), "<unnamed>", emptyMap(), 2_000, 1)
- val driverDom = root.newDomain("driver")
-
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 1)
val cpus = List(1) { ProcessingUnit(cpuNode, it, 2000.0) }
- val metalDriver = SimpleBareMetalDriver(driverDom, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
+ val metalDriver =
+ SimpleBareMetalDriver(this, clock, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
metalDriver.init()
metalDriver.setImage(vmm)
@@ -88,10 +84,7 @@ internal class HypervisorTest {
vmB.events.onEach { println(it) }.launchIn(this)
}
- runBlocking {
- system.run()
- system.terminate()
- }
+ testScope.advanceUntilIdle()
}
/**
@@ -99,35 +92,47 @@ internal class HypervisorTest {
*/
@Test
fun overcommission() {
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider("test")
- val root = system.newDomain("root")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
var requestedBurst = 0L
var grantedBurst = 0L
var overcommissionedBurst = 0L
- root.launch {
+ testScope.launch {
val vmm = HypervisorImage
val duration = 5 * 60L
- val vmImageA = VmImage(UUID.randomUUID(), "<unnamed>", emptyMap(), sequenceOf(
- FlopsHistoryFragment(0, 28L * duration, duration * 1000, 28.0, 2),
- FlopsHistoryFragment(0, 3500L * duration, duration * 1000, 3500.0, 2),
- FlopsHistoryFragment(0, 0, duration * 1000, 0.0, 2),
- FlopsHistoryFragment(0, 183L * duration, duration * 1000, 183.0, 2)
- ), 2, 0)
- val vmImageB = VmImage(UUID.randomUUID(), "<unnamed>", emptyMap(), sequenceOf(
- FlopsHistoryFragment(0, 28L * duration, duration * 1000, 28.0, 2),
- FlopsHistoryFragment(0, 3100L * duration, duration * 1000, 3100.0, 2),
- FlopsHistoryFragment(0, 0, duration * 1000, 0.0, 2),
- FlopsHistoryFragment(0, 73L * duration, duration * 1000, 73.0, 2)
- ), 2, 0)
-
- val driverDom = root.newDomain("driver")
+ val vmImageA = VmImage(
+ UUID.randomUUID(),
+ "<unnamed>",
+ emptyMap(),
+ sequenceOf(
+ FlopsHistoryFragment(0, 28L * duration, duration * 1000, 28.0, 2),
+ FlopsHistoryFragment(0, 3500L * duration, duration * 1000, 3500.0, 2),
+ FlopsHistoryFragment(0, 0, duration * 1000, 0.0, 2),
+ FlopsHistoryFragment(0, 183L * duration, duration * 1000, 183.0, 2)
+ ),
+ 2,
+ 0
+ )
+ val vmImageB = VmImage(
+ UUID.randomUUID(),
+ "<unnamed>",
+ emptyMap(),
+ sequenceOf(
+ FlopsHistoryFragment(0, 28L * duration, duration * 1000, 28.0, 2),
+ FlopsHistoryFragment(0, 3100L * duration, duration * 1000, 3100.0, 2),
+ FlopsHistoryFragment(0, 0, duration * 1000, 0.0, 2),
+ FlopsHistoryFragment(0, 73L * duration, duration * 1000, 73.0, 2)
+ ),
+ 2,
+ 0
+ )
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 2)
val cpus = List(2) { ProcessingUnit(cpuNode, it, 3200.0) }
- val metalDriver = SimpleBareMetalDriver(driverDom, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
+ val metalDriver =
+ SimpleBareMetalDriver(this, clock, UUID.randomUUID(), "test", emptyMap(), cpus, emptyList())
metalDriver.init()
metalDriver.setImage(vmm)
@@ -153,10 +158,7 @@ internal class HypervisorTest {
vmDriver.spawn("b", vmImageB, flavor)
}
- runBlocking {
- system.run()
- system.terminate()
- }
+ testScope.advanceUntilIdle()
assertAll(
{ assertEquals(2073600, requestedBurst, "Requested Burst does not match") },
diff --git a/simulator/odcsim/odcsim-api/build.gradle.kts b/simulator/opendc-core/build.gradle.kts
index 3ebe8dd7..b1c2678b 100644
--- a/simulator/odcsim/odcsim-api/build.gradle.kts
+++ b/simulator/opendc-core/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2017 atlarge-research
+ * Copyright (c) 2017 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-description = "Framework for discrete event simulation in Kotlin"
+description = "Base model for datacenter simulation"
/* Build configuration */
plugins {
@@ -30,7 +28,6 @@ plugins {
}
dependencies {
- api("org.slf4j:slf4j-api:${Library.SLF4J}")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Environment.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt
index 62309bf9..3baef092 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Environment.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core
+package org.opendc.core
/**
* A description of a large-scale computing environment. This description includes including key size and topology
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Identity.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt
index c87e934f..9c1464af 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Identity.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core
+package org.opendc.core
-import java.util.UUID
+import java.util.*
/**
* An object that has a unique identity.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Platform.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt
index 0b2437c6..076df255 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Platform.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core
+package org.opendc.core
-import java.util.UUID
+import java.util.*
/**
* A representation of a cloud platform such as Amazon Web Services (AWS), Microsoft Azure or Google Cloud.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/User.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt
index 6105ae9e..d4b237e7 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/User.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core
+package org.opendc.core
/**
* A user of the cloud network.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Zone.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt
index d8851bcd..0bca4ee5 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/Zone.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core
+package org.opendc.core
-import com.atlarge.opendc.core.services.ServiceRegistry
-import java.util.UUID
+import org.opendc.core.services.ServiceRegistry
+import java.util.*
/**
* An isolated location within a topology region from which public cloud services operate, roughly equivalent to a
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/CorrelatedFaultInjector.kt
index f77a581e..f3bd7f5a 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/CorrelatedFaultInjector.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/CorrelatedFaultInjector.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,25 +20,22 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.failure
+package org.opendc.core.failure
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.simulationContext
+import kotlinx.coroutines.*
+import java.time.Clock
import kotlin.math.exp
import kotlin.math.max
import kotlin.random.Random
import kotlin.random.asJavaRandom
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.ensureActive
-import kotlinx.coroutines.launch
/**
* A [FaultInjector] that injects fault in the system which are correlated to each other. Failures do not occur in
* isolation, but will trigger other faults.
*/
public class CorrelatedFaultInjector(
- private val domain: Domain,
+ private val coroutineScope: CoroutineScope,
+ private val clock: Clock,
private val iatScale: Double,
private val iatShape: Double,
private val sizeScale: Double,
@@ -72,7 +67,7 @@ public class CorrelatedFaultInjector(
// Clean up the domain if it finishes
domain.scope.coroutineContext[Job]!!.invokeOnCompletion {
- this@CorrelatedFaultInjector.domain.launch {
+ this@CorrelatedFaultInjector.coroutineScope.launch {
active -= domain
if (active.isEmpty()) {
@@ -86,7 +81,7 @@ public class CorrelatedFaultInjector(
return
}
- job = this.domain.launch {
+ job = this.coroutineScope.launch {
while (active.isNotEmpty()) {
ensureActive()
@@ -94,7 +89,7 @@ public class CorrelatedFaultInjector(
val d = lognvariate(iatScale, iatShape) * 3.6e6
// Handle long overflow
- if (simulationContext.clock.millis() + d <= 0) {
+ if (clock.millis() + d <= 0) {
return@launch
}
@@ -111,7 +106,7 @@ public class CorrelatedFaultInjector(
val df = max(lognvariate(dScale, dShape) * 6e4, 15 * 6e4)
// Handle long overflow
- if (simulationContext.clock.millis() + df <= 0) {
+ if (clock.millis() + df <= 0) {
return@launch
}
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FailureDomain.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FailureDomain.kt
index d56df3c9..0795b09a 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FailureDomain.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FailureDomain.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.failure
+package org.opendc.core.failure
import kotlinx.coroutines.CoroutineScope
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FaultInjector.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FaultInjector.kt
index ac7a08de..ad776641 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/FaultInjector.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/FaultInjector.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.failure
+package org.opendc.core.failure
/**
* An interface for stochastically injecting faults into a running system.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/UncorrelatedFaultInjector.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt
index 0f62667f..6c019763 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/failure/UncorrelatedFaultInjector.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,25 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.failure
+package org.opendc.core.failure
-import com.atlarge.odcsim.simulationContext
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import java.time.Clock
import kotlin.math.ln1p
import kotlin.math.pow
import kotlin.random.Random
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
/**
* A [FaultInjector] that injects uncorrelated faults into the system, meaning that failures of the subsystems are
* independent.
*/
-public class UncorrelatedFaultInjector(private val alpha: Double, private val beta: Double, private val random: Random = Random(0)) : FaultInjector {
+class UncorrelatedFaultInjector(
+ private val clock: Clock,
+ private val alpha: Double,
+ private val beta: Double,
+ private val random: Random = Random(0)
+) : FaultInjector {
/**
* Enqueue the specified [FailureDomain] to fail some time in the future.
*/
@@ -44,7 +47,7 @@ public class UncorrelatedFaultInjector(private val alpha: Double, private val be
val d = random.weibull(alpha, beta) * 1e3 // Make sure to convert delay to milliseconds
// Handle long overflow
- if (simulationContext.clock.millis() + d <= 0) {
+ if (clock.millis() + d <= 0) {
return@launch
}
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/PowerModel.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/PowerModel.kt
index 51c9f379..e93023d8 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/PowerModel.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/PowerModel.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.power
+package org.opendc.core.power
import kotlinx.coroutines.flow.Flow
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/Powerable.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt
index 4473a571..4a225d9d 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/power/Powerable.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.power
+package org.opendc.core.power
import kotlinx.coroutines.flow.Flow
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/Resource.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt
index 25a494bc..5bb2c2ce 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/Resource.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.resource
+package org.opendc.core.resource
-import com.atlarge.opendc.core.Identity
+import org.opendc.core.Identity
/**
* Represents a generic cloud resource.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/TagContainer.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt
index 6ba1cf0b..842710d2 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/resource/TagContainer.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.resource
+package org.opendc.core.resource
/**
* An immutable map containing the tags of some resource.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceKey.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt
index 290bf439..6d475f87 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceKey.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.services
+package org.opendc.core.services
-import com.atlarge.opendc.core.Identity
-import java.util.UUID
+import org.opendc.core.Identity
+import java.util.*
/**
* An interface for identifying service implementations of the same type (providing the same service).
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistry.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt
index 75aa778f..7434d91c 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistry.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.services
+package org.opendc.core.services
/**
* An immutable service registry interface.
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistryImpl.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt
index 0686ebaf..e117bec6 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/services/ServiceRegistryImpl.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.services
+package org.opendc.core.services
/**
* Default implementation of the [ServiceRegistry] interface.
@@ -38,7 +36,8 @@ internal class ServiceRegistryImpl(private val map: Map<ServiceKey<*>, Any>) : S
return map[key] as T
}
- override fun <T : Any> put(key: ServiceKey<T>, service: T): ServiceRegistry = ServiceRegistryImpl(map.plus(key to service))
+ override fun <T : Any> put(key: ServiceKey<T>, service: T): ServiceRegistry =
+ ServiceRegistryImpl(map.plus(key to service))
override fun toString(): String = map.toString()
}
diff --git a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/Workload.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt
index def5d6e4..656020ef 100644
--- a/simulator/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/Workload.kt
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.core.workload
+package org.opendc.core.workload
-import com.atlarge.opendc.core.Identity
-import com.atlarge.opendc.core.User
+import org.opendc.core.Identity
+import org.opendc.core.User
/**
* A high-level abstraction that represents the actual work that a set of compute resources perform, such
diff --git a/simulator/odcsim/build.gradle.kts b/simulator/opendc-experiments/build.gradle.kts
index cc3f3add..a1a751a2 100644
--- a/simulator/odcsim/build.gradle.kts
+++ b/simulator/opendc-experiments/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
diff --git a/simulator/opendc/opendc-experiments-sc18/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts
index 2e366a43..393fd0d0 100644
--- a/simulator/opendc/opendc-experiments-sc18/build.gradle.kts
+++ b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2019 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
@@ -31,16 +29,16 @@ plugins {
}
application {
- mainClassName = "com.atlarge.opendc.experiments.sc18.TestExperiment"
+ mainClassName = "org.opendc.experiments.sc18.TestExperiment"
}
dependencies {
- api(project(":opendc:opendc-core"))
- implementation(project(":opendc:opendc-format"))
- implementation(project(":opendc:opendc-workflows"))
+ api(project(":opendc-core"))
+ implementation(project(":opendc-format"))
+ implementation(project(":opendc-workflows"))
+ implementation(project(":opendc-simulator"))
implementation(kotlin("stdlib"))
- runtimeOnly(project(":odcsim:odcsim-engine-omega"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}")
diff --git a/simulator/opendc/opendc-experiments-sc18/src/main/kotlin/com/atlarge/opendc/experiments/sc18/TestExperiment.kt b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt
index 7659b18e..18dce054 100644
--- a/simulator/opendc/opendc-experiments-sc18/src/main/kotlin/com/atlarge/opendc/experiments/sc18/TestExperiment.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,36 +20,33 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc18
+package org.opendc.experiments.sc18
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.format.environment.sc18.Sc18EnvironmentReader
-import com.atlarge.opendc.format.trace.gwf.GwfTraceReader
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.WorkflowEvent
-import com.atlarge.opendc.workflows.service.WorkflowSchedulerMode
-import com.atlarge.opendc.workflows.service.stage.job.NullJobAdmissionPolicy
-import com.atlarge.opendc.workflows.service.stage.job.SubmissionTimeJobOrderPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.FirstFitResourceSelectionPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.FunctionalResourceFilterPolicy
-import com.atlarge.opendc.workflows.service.stage.task.NullTaskEligibilityPolicy
-import com.atlarge.opendc.workflows.service.stage.task.SubmissionTimeTaskOrderPolicy
-import java.io.File
-import java.util.ServiceLoader
-import kotlin.math.max
-import kotlinx.coroutines.async
+import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
-import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.onEach
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.format.environment.sc18.Sc18EnvironmentReader
+import org.opendc.format.trace.gwf.GwfTraceReader
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.WorkflowEvent
+import org.opendc.workflows.service.WorkflowSchedulerMode
+import org.opendc.workflows.service.stage.job.NullJobAdmissionPolicy
+import org.opendc.workflows.service.stage.job.SubmissionTimeJobOrderPolicy
+import org.opendc.workflows.service.stage.resource.FirstFitResourceSelectionPolicy
+import org.opendc.workflows.service.stage.resource.FunctionalResourceFilterPolicy
+import org.opendc.workflows.service.stage.task.NullTaskEligibilityPolicy
+import org.opendc.workflows.service.stage.task.SubmissionTimeTaskOrderPolicy
+import java.io.File
+import kotlin.math.max
/**
* Main entry point of the experiment.
*/
+@OptIn(ExperimentalCoroutinesApi::class)
fun main(args: Array<String>) {
if (args.isEmpty()) {
println("error: Please provide path to GWF trace")
@@ -62,16 +57,16 @@ fun main(args: Array<String>) {
var finished = 0
val token = Channel<Boolean>()
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider(name = "sim")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
- val schedulerDomain = system.newDomain(name = "scheduler")
- val schedulerAsync = schedulerDomain.async {
+ val schedulerAsync = testScope.async {
val environment = Sc18EnvironmentReader(object {}.javaClass.getResourceAsStream("/env/setup-test.json"))
- .use { it.construct(system.newDomain("topology")) }
+ .use { it.construct(this, clock) }
StageWorkflowService(
- schedulerDomain,
+ this,
+ clock,
environment.platforms[0].zones[0].services[ProvisioningService],
mode = WorkflowSchedulerMode.Batch(100),
jobAdmissionPolicy = NullJobAdmissionPolicy,
@@ -83,9 +78,7 @@ fun main(args: Array<String>) {
)
}
- val broker = system.newDomain(name = "broker")
-
- broker.launch {
+ testScope.launch {
val scheduler = schedulerAsync.await()
scheduler.events
.onEach { event ->
@@ -105,21 +98,18 @@ fun main(args: Array<String>) {
}
.collect()
}
- broker.launch {
- val ctx = simulationContext
+
+ testScope.launch {
val reader = GwfTraceReader(File(args[0]))
val scheduler = schedulerAsync.await()
while (reader.hasNext()) {
val (time, job) = reader.next()
total += 1
- delay(max(0, time * 1000 - ctx.clock.millis()))
+ delay(max(0, time * 1000 - clock.millis()))
scheduler.submit(job)
}
}
- runBlocking {
- system.run()
- system.terminate()
- }
+ testScope.advanceUntilIdle()
}
diff --git a/simulator/opendc/opendc-experiments-sc18/src/main/resources/env/setup-test.json b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/resources/env/setup-test.json
index 0965b250..0965b250 100644
--- a/simulator/opendc/opendc-experiments-sc18/src/main/resources/env/setup-test.json
+++ b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/resources/env/setup-test.json
diff --git a/simulator/opendc/opendc-experiments-sc20/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts
index a66612e4..4bfe21d2 100644
--- a/simulator/opendc/opendc-experiments-sc20/build.gradle.kts
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2019 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
@@ -31,13 +29,14 @@ plugins {
}
application {
- mainClassName = "com.atlarge.opendc.experiments.sc20.MainKt"
+ mainClassName = "org.opendc.experiments.sc20.MainKt"
applicationDefaultJvmArgs = listOf("-Xms2500M")
}
dependencies {
- api(project(":opendc:opendc-core"))
- implementation(project(":opendc:opendc-format"))
+ api(project(":opendc-core"))
+ implementation(project(":opendc-format"))
+ implementation(project(":opendc-simulator"))
implementation("com.github.ajalt:clikt:2.6.0")
implementation("me.tongfei:progressbar:0.8.1")
@@ -50,7 +49,6 @@ dependencies {
}
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.13.1")
- runtimeOnly(project(":odcsim:odcsim-engine-omega"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Main.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt
index ec721ff0..9f096038 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Main.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,15 +20,8 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20
+package org.opendc.experiments.sc20
-import com.atlarge.opendc.experiments.sc20.experiment.*
-import com.atlarge.opendc.experiments.sc20.reporter.ConsoleExperimentReporter
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.execution.ThreadPoolExperimentScheduler
-import com.atlarge.opendc.experiments.sc20.runner.internal.DefaultExperimentRunner
-import com.atlarge.opendc.format.trace.sc20.Sc20PerformanceInterferenceReader
-import com.atlarge.opendc.format.trace.sc20.Sc20VmPlacementReader
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.convert
import com.github.ajalt.clikt.parameters.options.default
@@ -41,9 +32,16 @@ import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.choice
import com.github.ajalt.clikt.parameters.types.file
import com.github.ajalt.clikt.parameters.types.int
+import mu.KotlinLogging
+import org.opendc.experiments.sc20.experiment.*
+import org.opendc.experiments.sc20.reporter.ConsoleExperimentReporter
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.execution.ThreadPoolExperimentScheduler
+import org.opendc.experiments.sc20.runner.internal.DefaultExperimentRunner
+import org.opendc.format.trace.sc20.Sc20PerformanceInterferenceReader
+import org.opendc.format.trace.sc20.Sc20VmPlacementReader
import java.io.File
import java.io.InputStream
-import mu.KotlinLogging
/**
* The logger for this experiment.
@@ -71,7 +69,10 @@ class ExperimentCli : CliktCommand(name = "sc20-experiment", help = "Run experim
/**
* The path to the performance interference model.
*/
- private val performanceInterferenceStream by option("--performance-interference-model", help = "path to the performance interference file")
+ private val performanceInterferenceStream by option(
+ "--performance-interference-model",
+ help = "path to the performance interference file"
+ )
.file(canBeDir = false)
.convert { it.inputStream() as InputStream }
@@ -130,7 +131,8 @@ class ExperimentCli : CliktCommand(name = "sc20-experiment", help = "Run experim
performanceInterferenceStream?.let { Sc20PerformanceInterferenceReader(it) }
logger.info { "Creating experiment descriptor" }
- val descriptor = object : Experiment(environmentPath, tracePath, output, performanceInterferenceModel, vmPlacements, bufferSize) {
+ val descriptor = object :
+ Experiment(environmentPath, tracePath, output, performanceInterferenceModel, vmPlacements, bufferSize) {
private val descriptor = this
override val children: Sequence<ExperimentDescriptor> = sequence {
for ((i, producer) in portfolios.withIndex()) {
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Experiment.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt
index f3ac2554..e93d8c1e 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Experiment.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,15 +20,15 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
+package org.opendc.experiments.sc20.experiment
-import com.atlarge.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
-import com.atlarge.opendc.experiments.sc20.telemetry.RunEvent
-import com.atlarge.opendc.experiments.sc20.telemetry.parquet.ParquetRunEventWriter
-import com.atlarge.opendc.format.trace.PerformanceInterferenceModelReader
+import org.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
+import org.opendc.experiments.sc20.telemetry.RunEvent
+import org.opendc.experiments.sc20.telemetry.parquet.ParquetRunEventWriter
+import org.opendc.format.trace.PerformanceInterferenceModelReader
import java.io.File
/**
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/ExperimentHelpers.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt
index b09c0dbb..c2e5b619 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/ExperimentHelpers.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,33 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.compute.metal.NODE_CLUSTER
-import com.atlarge.opendc.compute.metal.driver.BareMetalDriver
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.virt.HypervisorEvent
-import com.atlarge.opendc.compute.virt.driver.SimpleVirtDriver
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
-import com.atlarge.opendc.compute.virt.service.VirtProvisioningEvent
-import com.atlarge.opendc.compute.virt.service.allocation.AllocationPolicy
-import com.atlarge.opendc.core.failure.CorrelatedFaultInjector
-import com.atlarge.opendc.core.failure.FailureDomain
-import com.atlarge.opendc.core.failure.FaultInjector
-import com.atlarge.opendc.experiments.sc20.experiment.monitor.ExperimentMonitor
-import com.atlarge.opendc.experiments.sc20.trace.Sc20StreamingParquetTraceReader
-import com.atlarge.opendc.format.environment.EnvironmentReader
-import com.atlarge.opendc.format.trace.TraceReader
-import java.io.File
-import kotlin.math.ln
-import kotlin.math.max
-import kotlin.random.Random
+package org.opendc.experiments.sc20.experiment
+
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.delay
@@ -57,8 +31,31 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.takeWhile
import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
import mu.KotlinLogging
+import org.opendc.compute.core.Flavor
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.compute.metal.NODE_CLUSTER
+import org.opendc.compute.metal.driver.BareMetalDriver
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.virt.HypervisorEvent
+import org.opendc.compute.virt.driver.SimpleVirtDriver
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
+import org.opendc.compute.virt.service.VirtProvisioningEvent
+import org.opendc.compute.virt.service.allocation.AllocationPolicy
+import org.opendc.core.failure.CorrelatedFaultInjector
+import org.opendc.core.failure.FailureDomain
+import org.opendc.core.failure.FaultInjector
+import org.opendc.experiments.sc20.experiment.monitor.ExperimentMonitor
+import org.opendc.experiments.sc20.trace.Sc20StreamingParquetTraceReader
+import org.opendc.format.environment.EnvironmentReader
+import org.opendc.format.trace.TraceReader
+import java.io.File
+import java.time.Clock
+import kotlin.math.ln
+import kotlin.math.max
+import kotlin.random.Random
/**
* The logger for this experiment.
@@ -69,14 +66,14 @@ private val logger = KotlinLogging.logger {}
* Construct the failure domain for the experiments.
*/
suspend fun createFailureDomain(
+ coroutineScope: CoroutineScope,
+ clock: Clock,
seed: Int,
failureInterval: Double,
bareMetalProvisioner: ProvisioningService,
chan: Channel<Unit>
-): Domain {
- val root = simulationContext.domain
- val domain = root.newDomain(name = "failures")
- domain.launch {
+): CoroutineScope {
+ val job = coroutineScope.launch {
chan.receive()
val random = Random(seed)
val injectors = mutableMapOf<String, FaultInjector>()
@@ -85,7 +82,8 @@ suspend fun createFailureDomain(
val injector =
injectors.getOrPut(cluster) {
createFaultInjector(
- simulationContext.domain,
+ this,
+ clock,
random,
failureInterval
)
@@ -93,17 +91,23 @@ suspend fun createFailureDomain(
injector.enqueue(node.metadata["driver"] as FailureDomain)
}
}
- return domain
+ return CoroutineScope(coroutineScope.coroutineContext + job)
}
/**
* Obtain the [FaultInjector] to use for the experiments.
*/
-fun createFaultInjector(domain: Domain, random: Random, failureInterval: Double): FaultInjector {
+fun createFaultInjector(
+ coroutineScope: CoroutineScope,
+ clock: Clock,
+ random: Random,
+ failureInterval: Double
+): FaultInjector {
// Parameters from A. Iosup, A Framework for the Study of Grid Inter-Operation Mechanisms, 2009
// GRID'5000
return CorrelatedFaultInjector(
- domain,
+ coroutineScope,
+ clock,
iatScale = ln(failureInterval), iatShape = 1.03, // Hours
sizeScale = ln(2.0), sizeShape = ln(1.0), // Expect 2 machines, with variation of 1
dScale = ln(60.0), dShape = ln(60.0 * 8), // Minutes
@@ -114,7 +118,12 @@ fun createFaultInjector(domain: Domain, random: Random, failureInterval: Double)
/**
* Create the trace reader from which the VM workloads are read.
*/
-fun createTraceReader(path: File, performanceInterferenceModel: PerformanceInterferenceModel, vms: List<String>, seed: Int): Sc20StreamingParquetTraceReader {
+fun createTraceReader(
+ path: File,
+ performanceInterferenceModel: PerformanceInterferenceModel,
+ vms: List<String>,
+ seed: Int
+): Sc20StreamingParquetTraceReader {
return Sc20StreamingParquetTraceReader(
path,
performanceInterferenceModel,
@@ -127,31 +136,35 @@ fun createTraceReader(path: File, performanceInterferenceModel: PerformanceInter
* Construct the environment for a VM provisioner and return the provisioner instance.
*/
suspend fun createProvisioner(
- root: Domain,
+ coroutineScope: CoroutineScope,
+ clock: Clock,
environmentReader: EnvironmentReader,
allocationPolicy: AllocationPolicy
-): Pair<ProvisioningService, SimpleVirtProvisioningService> = withContext(root.coroutineContext) {
- val environment = environmentReader.use { it.construct(root) }
+): Pair<ProvisioningService, SimpleVirtProvisioningService> {
+ val environment = environmentReader.use { it.construct(coroutineScope, clock) }
val bareMetalProvisioner = environment.platforms[0].zones[0].services[ProvisioningService]
// Wait for the bare metal nodes to be spawned
delay(10)
- val scheduler = SimpleVirtProvisioningService(allocationPolicy, simulationContext, bareMetalProvisioner)
+ val scheduler = SimpleVirtProvisioningService(coroutineScope, clock, bareMetalProvisioner, allocationPolicy)
// Wait for the hypervisors to be spawned
delay(10)
- bareMetalProvisioner to scheduler
+ return bareMetalProvisioner to scheduler
}
/**
* Attach the specified monitor to the VM provisioner.
*/
@OptIn(ExperimentalCoroutinesApi::class)
-suspend fun attachMonitor(scheduler: SimpleVirtProvisioningService, monitor: ExperimentMonitor) {
- val domain = simulationContext.domain
- val clock = simulationContext.clock
+suspend fun attachMonitor(
+ coroutineScope: CoroutineScope,
+ clock: Clock,
+ scheduler: SimpleVirtProvisioningService,
+ monitor: ExperimentMonitor
+) {
val hypervisors = scheduler.drivers()
// Monitor hypervisor events
@@ -167,7 +180,7 @@ suspend fun attachMonitor(scheduler: SimpleVirtProvisioningService, monitor: Exp
}
}
}
- .launchIn(domain)
+ .launchIn(coroutineScope)
hypervisor.events
.onEach { event ->
when (event) {
@@ -184,12 +197,12 @@ suspend fun attachMonitor(scheduler: SimpleVirtProvisioningService, monitor: Exp
)
}
}
- .launchIn(domain)
+ .launchIn(coroutineScope)
val driver = hypervisor.server.services[BareMetalDriver.Key]
driver.powerDraw
.onEach { monitor.reportPowerConsumption(hypervisor.server, it) }
- .launchIn(domain)
+ .launchIn(coroutineScope)
}
scheduler.events
@@ -199,15 +212,21 @@ suspend fun attachMonitor(scheduler: SimpleVirtProvisioningService, monitor: Exp
monitor.reportProvisionerMetrics(clock.millis(), event)
}
}
- .launchIn(domain)
+ .launchIn(coroutineScope)
}
/**
* Process the trace.
*/
-suspend fun processTrace(reader: TraceReader<VmWorkload>, scheduler: SimpleVirtProvisioningService, chan: Channel<Unit>, monitor: ExperimentMonitor, vmPlacements: Map<String, String> = emptyMap()) {
- val domain = simulationContext.domain
-
+suspend fun processTrace(
+ coroutineScope: CoroutineScope,
+ clock: Clock,
+ reader: TraceReader<VmWorkload>,
+ scheduler: SimpleVirtProvisioningService,
+ chan: Channel<Unit>,
+ monitor: ExperimentMonitor,
+ vmPlacements: Map<String, String> = emptyMap()
+) {
try {
var submitted = 0
@@ -215,18 +234,22 @@ suspend fun processTrace(reader: TraceReader<VmWorkload>, scheduler: SimpleVirtP
val (time, workload) = reader.next()
submitted++
- delay(max(0, time - simulationContext.clock.millis()))
- domain.launch {
+ delay(max(0, time - clock.millis()))
+ coroutineScope.launch {
chan.send(Unit)
val server = scheduler.deploy(
- workload.image.name, workload.image,
- Flavor(workload.image.maxCores, workload.image.requiredMemory)
+ workload.image.name,
+ workload.image,
+ Flavor(
+ workload.image.maxCores,
+ workload.image.requiredMemory
+ )
)
// Monitor server events
server.events
.onEach {
if (it is ServerEvent.StateChanged) {
- monitor.reportVmStateChange(simulationContext.clock.millis(), it.server)
+ monitor.reportVmStateChange(clock.millis(), it.server)
}
}
.collect()
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolio.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt
index 6a40f5fb..fb58e651 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolio.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
+package org.opendc.experiments.sc20.experiment
-import com.atlarge.opendc.experiments.sc20.experiment.model.OperationalPhenomena
-import com.atlarge.opendc.experiments.sc20.experiment.model.Topology
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
+import org.opendc.experiments.sc20.experiment.model.OperationalPhenomena
+import org.opendc.experiments.sc20.experiment.model.Topology
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
/**
* A portfolio represents a collection of scenarios are tested.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolios.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt
index 09a6ce40..53d6fc21 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Portfolios.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
+package org.opendc.experiments.sc20.experiment
-import com.atlarge.opendc.experiments.sc20.experiment.model.*
+import org.opendc.experiments.sc20.experiment.model.*
public class HorVerPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "horizontal_vs_vertical") {
override val topologies = listOf(
@@ -127,7 +125,8 @@ public class CompositeWorkloadPortfolio(parent: Experiment, id: Int) : Portfolio
)
}
-public class OperationalPhenomenaPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "operational_phenomena") {
+public class OperationalPhenomenaPortfolio(parent: Experiment, id: Int) :
+ Portfolio(parent, id, "operational_phenomena") {
override val topologies = listOf(
Topology("base")
)
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Run.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Run.kt
index 1580e4dd..95987d07 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Run.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Run.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,29 +20,25 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
+package org.opendc.experiments.sc20.experiment
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.opendc.compute.virt.service.allocation.AvailableCoreMemoryAllocationPolicy
-import com.atlarge.opendc.compute.virt.service.allocation.AvailableMemoryAllocationPolicy
-import com.atlarge.opendc.compute.virt.service.allocation.NumberOfActiveServersAllocationPolicy
-import com.atlarge.opendc.compute.virt.service.allocation.ProvisionedCoresAllocationPolicy
-import com.atlarge.opendc.compute.virt.service.allocation.RandomAllocationPolicy
-import com.atlarge.opendc.compute.virt.service.allocation.ReplayAllocationPolicy
-import com.atlarge.opendc.experiments.sc20.experiment.model.CompositeWorkload
-import com.atlarge.opendc.experiments.sc20.experiment.monitor.ParquetExperimentMonitor
-import com.atlarge.opendc.experiments.sc20.runner.TrialExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
-import com.atlarge.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
-import com.atlarge.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
-import com.atlarge.opendc.format.environment.sc20.Sc20ClusterEnvironmentReader
-import java.io.File
-import java.util.ServiceLoader
-import kotlin.random.Random
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.cancel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.launch
+import kotlinx.coroutines.test.TestCoroutineScope
import mu.KotlinLogging
+import org.opendc.compute.virt.service.allocation.*
+import org.opendc.experiments.sc20.experiment.model.CompositeWorkload
+import org.opendc.experiments.sc20.experiment.monitor.ParquetExperimentMonitor
+import org.opendc.experiments.sc20.runner.TrialExperimentDescriptor
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
+import org.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
+import org.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
+import org.opendc.format.environment.sc20.Sc20ClusterEnvironmentReader
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.io.File
+import kotlin.random.Random
/**
* The logger for the experiment scenario.
@@ -52,19 +46,15 @@ import mu.KotlinLogging
private val logger = KotlinLogging.logger {}
/**
- * The provider for the simulation engine to use.
- */
-private val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
-
-/**
* An experiment run represent a single invocation of a trial and is used to distinguish between repetitions of the
* same set of parameters.
*/
+@OptIn(ExperimentalCoroutinesApi::class)
public data class Run(override val parent: Scenario, val id: Int, val seed: Int) : TrialExperimentDescriptor() {
override suspend fun invoke(context: ExperimentExecutionContext) {
val experiment = parent.parent.parent
- val system = provider("experiment-$id")
- val root = system.newDomain("root")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
val seeder = Random(seed)
val environment = Sc20ClusterEnvironmentReader(File(experiment.environments, "${parent.topology.name}.txt"))
@@ -112,9 +102,10 @@ public data class Run(override val parent: Scenario, val id: Int, val seed: Int)
parent.parent.parent.bufferSize
)
- root.launch {
+ testScope.launch {
val (bareMetalProvisioner, scheduler) = createProvisioner(
- root,
+ this,
+ clock,
environment,
allocationPolicy
)
@@ -122,6 +113,8 @@ public data class Run(override val parent: Scenario, val id: Int, val seed: Int)
val failureDomain = if (parent.operationalPhenomena.failureFrequency > 0) {
logger.debug("ENABLING failures")
createFailureDomain(
+ this,
+ clock,
seeder.nextInt(),
parent.operationalPhenomena.failureFrequency,
bareMetalProvisioner,
@@ -131,8 +124,10 @@ public data class Run(override val parent: Scenario, val id: Int, val seed: Int)
null
}
- attachMonitor(scheduler, monitor)
+ attachMonitor(this, clock, scheduler, monitor)
processTrace(
+ this,
+ clock,
trace,
scheduler,
chan,
@@ -151,9 +146,8 @@ public data class Run(override val parent: Scenario, val id: Int, val seed: Int)
}
try {
- system.run()
+ testScope.advanceUntilIdle()
} finally {
- system.terminate()
monitor.close()
}
}
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Scenario.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt
index 98bc7fc2..5cffae63 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/Scenario.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,13 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment
+package org.opendc.experiments.sc20.experiment
-import com.atlarge.opendc.experiments.sc20.experiment.model.OperationalPhenomena
-import com.atlarge.opendc.experiments.sc20.experiment.model.Topology
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.experiment.model.OperationalPhenomena
+import org.opendc.experiments.sc20.experiment.model.Topology
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.experiments.sc20.runner.ContainerExperimentDescriptor
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
/**
* A scenario represents a single point in the design space (a unique combination of parameters).
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt
index af99df84..b22f4c9e 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/OperationalPhenomena.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment.model
+package org.opendc.experiments.sc20.experiment.model
/**
* Operation phenomena during experiments.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Topology.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Topology.kt
index ea09688b..95062fda 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Topology.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Topology.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment.model
+package org.opendc.experiments.sc20.experiment.model
/**
* The topology topology on which we test the workload.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Workload.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Workload.kt
index d75ca6f9..a9719114 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/model/Workload.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/model/Workload.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment.model
+package org.opendc.experiments.sc20.experiment.model
enum class SamplingStrategy {
REGULAR,
@@ -33,7 +31,11 @@ enum class SamplingStrategy {
/**
* A workload that is considered for a scenario.
*/
-public open class Workload(open val name: String, val fraction: Double, val samplingStrategy: SamplingStrategy = SamplingStrategy.REGULAR)
+public open class Workload(
+ open val name: String,
+ val fraction: Double,
+ val samplingStrategy: SamplingStrategy = SamplingStrategy.REGULAR
+)
/**
* A workload that is composed of multiple workloads.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt
index 1f674f00..8d41f29e 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ExperimentMonitor.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment.monitor
+package org.opendc.experiments.sc20.experiment.monitor
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import com.atlarge.opendc.compute.virt.service.VirtProvisioningEvent
+import org.opendc.compute.core.Server
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.compute.virt.service.VirtProvisioningEvent
import java.io.Closeable
/**
@@ -45,7 +43,8 @@ interface ExperimentMonitor : Closeable {
time: Long,
driver: VirtDriver,
server: Server
- ) {}
+ ) {
+ }
/**
* Report the power consumption of a host.
@@ -66,7 +65,8 @@ interface ExperimentMonitor : Closeable {
numberOfDeployedImages: Int,
hostServer: Server,
duration: Long = 5 * 60 * 1000L
- ) {}
+ ) {
+ }
/**
* This method is invoked for a provisioner event.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt
index b931fef9..b1583f87 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/monitor/ParquetExperimentMonitor.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,17 +20,17 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.experiment.monitor
+package org.opendc.experiments.sc20.experiment.monitor
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import com.atlarge.opendc.compute.virt.service.VirtProvisioningEvent
-import com.atlarge.opendc.experiments.sc20.telemetry.HostEvent
-import com.atlarge.opendc.experiments.sc20.telemetry.ProvisionerEvent
-import com.atlarge.opendc.experiments.sc20.telemetry.parquet.ParquetHostEventWriter
-import com.atlarge.opendc.experiments.sc20.telemetry.parquet.ParquetProvisionerEventWriter
-import java.io.File
import mu.KotlinLogging
+import org.opendc.compute.core.Server
+import org.opendc.compute.virt.driver.VirtDriver
+import org.opendc.compute.virt.service.VirtProvisioningEvent
+import org.opendc.experiments.sc20.telemetry.HostEvent
+import org.opendc.experiments.sc20.telemetry.ProvisionerEvent
+import org.opendc.experiments.sc20.telemetry.parquet.ParquetHostEventWriter
+import org.opendc.experiments.sc20.telemetry.parquet.ParquetProvisionerEventWriter
+import java.io.File
/**
* The logger instance to use.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt
index 4472def9..af61622a 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/reporter/ConsoleExperimentReporter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,15 +20,15 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.reporter
+package org.opendc.experiments.sc20.reporter
-import com.atlarge.opendc.experiments.sc20.experiment.Run
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
import me.tongfei.progressbar.ProgressBar
import me.tongfei.progressbar.ProgressBarBuilder
import mu.KotlinLogging
+import org.opendc.experiments.sc20.experiment.Run
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
/**
* A reporter that reports the experiment progress to the console.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt
index dac32586..d70e8c9a 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ContainerExperimentDescriptor.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner
+package org.opendc.experiments.sc20.runner
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
import kotlinx.coroutines.launch
import kotlinx.coroutines.supervisorScope
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
/**
* An abstract [ExperimentDescriptor] specifically for containers.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentDescriptor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt
index 64b6b767..e087c7fd 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentDescriptor.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner
+package org.opendc.experiments.sc20.runner
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
import java.io.Serializable
/**
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentRunner.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt
index 77f970fe..49d57629 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/ExperimentRunner.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner
+package org.opendc.experiments.sc20.runner
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
/**
* An [ExperimentRunner] facilitates discovery and execution of experiments.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt
index cf05416a..abc52997 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/TrialExperimentDescriptor.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner
+package org.opendc.experiments.sc20.runner
/**
* An abstract [ExperimentDescriptor] specifically for trials.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt
index 9a04c491..942eb891 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionContext.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.execution
+package org.opendc.experiments.sc20.runner.execution
/**
* The execution context of an experiment.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt
index f6df0524..9e8b46e9 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionListener.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.execution
+package org.opendc.experiments.sc20.runner.execution
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
/**
* Listener to be notified of experiment execution events by experiment runners.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt
index 057e1f92..a765c264 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentExecutionResult.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.execution
+package org.opendc.experiments.sc20.runner.execution
import java.io.Serializable
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt
index 96678abf..49a137cc 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ExperimentScheduler.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.execution
+package org.opendc.experiments.sc20.runner.execution
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
import java.io.Closeable
/**
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt
index a8ee59a8..fb684678 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/execution/ThreadPoolExperimentScheduler.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,22 +20,23 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.execution
+package org.opendc.experiments.sc20.runner.execution
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
-import java.util.concurrent.Executors
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.launch
import kotlinx.coroutines.supervisorScope
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.withContext
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
+import java.util.concurrent.Executors
/**
* An [ExperimentScheduler] that runs experiments using a local thread pool.
*
* @param parallelism The maximum amount of parallel workers (default is the number of available processors).
*/
-class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().availableProcessors() + 1) : ExperimentScheduler {
+class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().availableProcessors() + 1) :
+ ExperimentScheduler {
private val dispatcher = Executors.newCachedThreadPool().asCoroutineDispatcher()
private val tickets = Semaphore(parallelism)
@@ -54,7 +53,10 @@ class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().avai
launch { context.listener.descriptorRegistered(descriptor) }
}
- override fun executionFinished(descriptor: ExperimentDescriptor, result: ExperimentExecutionResult) {
+ override fun executionFinished(
+ descriptor: ExperimentDescriptor,
+ result: ExperimentExecutionResult
+ ) {
launch { context.listener.executionFinished(descriptor, result) }
}
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt
index 28a19172..953669dc 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/internal/DefaultExperimentRunner.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,16 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.runner.internal
+package org.opendc.experiments.sc20.runner.internal
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentDescriptor
-import com.atlarge.opendc.experiments.sc20.runner.ExperimentRunner
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
-import com.atlarge.opendc.experiments.sc20.runner.execution.ExperimentScheduler
-import java.util.concurrent.ConcurrentHashMap
import kotlinx.coroutines.runBlocking
+import org.opendc.experiments.sc20.runner.ExperimentDescriptor
+import org.opendc.experiments.sc20.runner.ExperimentRunner
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionContext
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionListener
+import org.opendc.experiments.sc20.runner.execution.ExperimentExecutionResult
+import org.opendc.experiments.sc20.runner.execution.ExperimentScheduler
+import java.util.concurrent.ConcurrentHashMap
/**
* The default implementation of the [ExperimentRunner] interface.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/Event.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt
index c1e14e2a..ba7d2f65 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/Event.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry
+package org.opendc.experiments.sc20.telemetry
/**
* An event that occurs within the system.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/HostEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt
index b9030172..1d491e53 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/HostEvent.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry
+package org.opendc.experiments.sc20.telemetry
-import com.atlarge.opendc.compute.core.Server
+import org.opendc.compute.core.Server
/**
* A periodic report of the host machine metrics.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt
index df619632..22795c8b 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry
+package org.opendc.experiments.sc20.telemetry
/**
* A periodic report of the provisioner's metrics.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/RunEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt
index 497d2c3f..b426fe11 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/RunEvent.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry
+package org.opendc.experiments.sc20.telemetry
-import com.atlarge.opendc.experiments.sc20.experiment.Run
+import org.opendc.experiments.sc20.experiment.Run
/**
* A periodic report of the host machine metrics.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/VmEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt
index 7289fb21..89ee2a5a 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/VmEvent.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry
+package org.opendc.experiments.sc20.telemetry
-import com.atlarge.opendc.compute.core.Server
+import org.opendc.compute.core.Server
/**
* A periodic report of a virtual machine's metrics.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt
index afa21f93..82ce8a22 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetEventWriter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,20 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry.parquet
+package org.opendc.experiments.sc20.telemetry.parquet
-import com.atlarge.opendc.experiments.sc20.telemetry.Event
-import java.io.Closeable
-import java.io.File
-import java.util.concurrent.ArrayBlockingQueue
-import java.util.concurrent.BlockingQueue
-import kotlin.concurrent.thread
import mu.KotlinLogging
import org.apache.avro.Schema
import org.apache.avro.generic.GenericData
import org.apache.hadoop.fs.Path
import org.apache.parquet.avro.AvroParquetWriter
import org.apache.parquet.hadoop.metadata.CompressionCodecName
+import org.opendc.experiments.sc20.telemetry.Event
+import java.io.Closeable
+import java.io.File
+import java.util.concurrent.ArrayBlockingQueue
+import java.util.concurrent.BlockingQueue
+import kotlin.concurrent.thread
/**
* The logging instance to use.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt
index 9fa4e0fb..3219bd0b 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetHostEventWriter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,13 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry.parquet
+package org.opendc.experiments.sc20.telemetry.parquet
-import com.atlarge.opendc.experiments.sc20.telemetry.HostEvent
-import java.io.File
import org.apache.avro.Schema
import org.apache.avro.SchemaBuilder
import org.apache.avro.generic.GenericData
+import org.opendc.experiments.sc20.telemetry.HostEvent
+import java.io.File
/**
* A Parquet event writer for [HostEvent]s.
@@ -60,7 +58,7 @@ public class ParquetHostEventWriter(path: File, bufferSize: Int) :
val schema: Schema = SchemaBuilder
.record("host_metrics")
- .namespace("com.atlarge.opendc.experiments.sc20")
+ .namespace("org.opendc.experiments.sc20")
.fields()
// .name("portfolio_id").type().intType().noDefault()
// .name("scenario_id").type().intType().noDefault()
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt
index 3d28860c..f17f9458 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetProvisionerEventWriter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,13 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry.parquet
+package org.opendc.experiments.sc20.telemetry.parquet
-import com.atlarge.opendc.experiments.sc20.telemetry.ProvisionerEvent
-import java.io.File
import org.apache.avro.Schema
import org.apache.avro.SchemaBuilder
import org.apache.avro.generic.GenericData
+import org.opendc.experiments.sc20.telemetry.ProvisionerEvent
+import java.io.File
/**
* A Parquet event writer for [ProvisionerEvent]s.
@@ -52,7 +50,7 @@ public class ParquetProvisionerEventWriter(path: File, bufferSize: Int) :
val schema: Schema = SchemaBuilder
.record("provisioner_metrics")
- .namespace("com.atlarge.opendc.experiments.sc20")
+ .namespace("org.opendc.experiments.sc20")
.fields()
.name("timestamp").type().longType().noDefault()
.name("host_total_count").type().intType().noDefault()
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt
index 043e4670..35f8e2b5 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/parquet/ParquetRunEventWriter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,13 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.telemetry.parquet
+package org.opendc.experiments.sc20.telemetry.parquet
-import com.atlarge.opendc.experiments.sc20.telemetry.RunEvent
-import java.io.File
import org.apache.avro.Schema
import org.apache.avro.SchemaBuilder
import org.apache.avro.generic.GenericData
+import org.opendc.experiments.sc20.telemetry.RunEvent
+import java.io.File
/**
* A Parquet event writer for [RunEvent]s.
@@ -60,7 +58,7 @@ public class ParquetRunEventWriter(path: File, bufferSize: Int) :
val schema: Schema = SchemaBuilder
.record("runs")
- .namespace("com.atlarge.opendc.experiments.sc20")
+ .namespace("org.opendc.experiments.sc20")
.fields()
.name("portfolio_id").type().intType().noDefault()
.name("portfolio_name").type().stringType().noDefault()
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt
index 06bececf..5045b2df 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,16 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.trace
+package org.opendc.experiments.sc20.trace
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.experiments.sc20.experiment.model.CompositeWorkload
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.experiments.sc20.experiment.model.CompositeWorkload
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
import java.util.TreeSet
/**
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt
index f9709b9f..def1c2f4 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,20 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.trace
+package org.opendc.experiments.sc20.trace
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
-import java.io.File
-import java.util.UUID
import mu.KotlinLogging
import org.apache.avro.generic.GenericData
import org.apache.hadoop.fs.Path
import org.apache.parquet.avro.AvroParquetReader
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
+import java.io.File
+import java.util.UUID
private val logger = KotlinLogging.logger {}
@@ -113,7 +111,8 @@ class Sc20RawParquetTraceReader(private val path: File) {
val vmFragments = fragments.getValue(id).asSequence()
val totalLoad = vmFragments.sumByDouble { it.usage } * 5 * 60 // avg MHz * duration = MFLOPs
val vmWorkload = VmWorkload(
- uid, id,
+ uid,
+ id,
UnnamedUser,
VmImage(
uid,
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt
index 8b7b222f..51108dda 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,24 +20,8 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.trace
+package org.opendc.experiments.sc20.trace
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
-import java.io.File
-import java.io.Serializable
-import java.util.SortedSet
-import java.util.TreeSet
-import java.util.UUID
-import java.util.concurrent.ArrayBlockingQueue
-import kotlin.concurrent.thread
-import kotlin.random.Random
import mu.KotlinLogging
import org.apache.avro.generic.GenericData
import org.apache.hadoop.fs.Path
@@ -49,6 +31,22 @@ import org.apache.parquet.filter2.predicate.FilterApi
import org.apache.parquet.filter2.predicate.Statistics
import org.apache.parquet.filter2.predicate.UserDefinedPredicate
import org.apache.parquet.io.api.Binary
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
+import java.io.File
+import java.io.Serializable
+import java.util.SortedSet
+import java.util.TreeSet
+import java.util.UUID
+import java.util.concurrent.ArrayBlockingQueue
+import kotlin.concurrent.thread
+import kotlin.random.Random
private val logger = KotlinLogging.logger {}
@@ -82,11 +80,14 @@ class Sc20StreamingParquetTraceReader(
if (selectedVms.isEmpty())
null
else
- FilterCompat.get(FilterApi.userDefined(FilterApi.binaryColumn("id"),
- SelectedVmFilter(
- TreeSet(selectedVms)
+ FilterCompat.get(
+ FilterApi.userDefined(
+ FilterApi.binaryColumn("id"),
+ SelectedVmFilter(
+ TreeSet(selectedVms)
+ )
)
- ))
+ )
/**
* A poisonous fragment.
@@ -203,7 +204,7 @@ class Sc20StreamingParquetTraceReader(
val externalBuffer = mutableListOf<FlopsHistoryFragment>()
buffers.getOrPut(id) { mutableListOf() }.add(externalBuffer)
val fragments = sequence<FlopsHistoryFragment> {
- repeat@while (true) {
+ repeat@ while (true) {
if (externalBuffer.isEmpty()) {
if (hasNext) {
pull(buffers)
@@ -235,7 +236,8 @@ class Sc20StreamingParquetTraceReader(
Random(random.nextInt())
)
val vmWorkload = VmWorkload(
- uid, "VM Workload $id",
+ uid,
+ "VM Workload $id",
UnnamedUser,
VmImage(
uid,
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20TraceConverter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt
index 56ddbb6d..26c27b68 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/Sc20TraceConverter.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,8 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.trace
+package org.opendc.experiments.sc20.trace
-import com.atlarge.opendc.format.trace.sc20.Sc20VmPlacementReader
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.groups.OptionGroup
@@ -37,12 +34,6 @@ import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.options.split
import com.github.ajalt.clikt.parameters.types.file
import com.github.ajalt.clikt.parameters.types.long
-import java.io.BufferedReader
-import java.io.File
-import java.io.FileReader
-import java.util.Random
-import kotlin.math.max
-import kotlin.math.min
import me.tongfei.progressbar.ProgressBar
import org.apache.avro.Schema
import org.apache.avro.SchemaBuilder
@@ -51,6 +42,13 @@ import org.apache.hadoop.fs.Path
import org.apache.parquet.avro.AvroParquetWriter
import org.apache.parquet.hadoop.ParquetWriter
import org.apache.parquet.hadoop.metadata.CompressionCodecName
+import org.opendc.format.trace.sc20.Sc20VmPlacementReader
+import java.io.BufferedReader
+import java.io.File
+import java.io.FileReader
+import java.util.Random
+import kotlin.math.max
+import kotlin.math.min
/**
* Represents the command for converting traces
@@ -81,7 +79,7 @@ class TraceConverterCli : CliktCommand(name = "trace-converter") {
override fun run() {
val metaSchema = SchemaBuilder
.record("meta")
- .namespace("com.atlarge.opendc.format.sc20")
+ .namespace("org.opendc.format.sc20")
.fields()
.name("id").type().stringType().noDefault()
.name("submissionTime").type().longType().noDefault()
@@ -91,7 +89,7 @@ class TraceConverterCli : CliktCommand(name = "trace-converter") {
.endRecord()
val schema = SchemaBuilder
.record("trace")
- .namespace("com.atlarge.opendc.format.sc20")
+ .namespace("org.opendc.format.sc20")
.fields()
.name("id").type().stringType().noDefault()
.name("time").type().longType().noDefault()
@@ -263,7 +261,8 @@ class SolvinityConversion : TraceConversion("Solvinity") {
continue
}
- val timestamp = (values[timestampCol].trim().toLong() - 5 * 60) * 1000L - minTimestamp
+ val timestamp =
+ (values[timestampCol].trim().toLong() - 5 * 60) * 1000L - minTimestamp
if (begin > timestamp || timestamp > end) {
continue
}
@@ -384,7 +383,8 @@ class BitbrainsConversion : TraceConversion("Bitbrains") {
val timestamp = (values[timestampCol].trim().toLong() - 5 * 60) * 1000L
cores = values[coreCol].trim().toInt()
- requiredMemory = max(requiredMemory, values[provisionedMemoryCol].trim().toDouble().toLong())
+ requiredMemory =
+ max(requiredMemory, values[provisionedMemoryCol].trim().toDouble().toLong())
maxCores = max(maxCores, cores)
minTime = min(minTime, timestamp)
val cpuUsage = values[cpuUsageCol].trim().toDouble() // MHz
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/WorkloadSampler.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt
index a46bb3e6..14e65eb6 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/trace/WorkloadSampler.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,17 +20,17 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20.trace
+package org.opendc.experiments.sc20.trace
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.experiments.sc20.experiment.model.CompositeWorkload
-import com.atlarge.opendc.experiments.sc20.experiment.model.SamplingStrategy
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.format.trace.TraceEntry
+import mu.KotlinLogging
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.experiments.sc20.experiment.model.CompositeWorkload
+import org.opendc.experiments.sc20.experiment.model.SamplingStrategy
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.format.trace.TraceEntry
import java.util.*
import kotlin.random.Random
-import mu.KotlinLogging
private val logger = KotlinLogging.logger {}
@@ -211,4 +209,5 @@ private fun sample(entry: TraceEntry<VmWorkload>, i: Int): TraceEntry<VmWorkload
return VmTraceEntry(vmWorkload, entry.submissionTime)
}
-private class VmTraceEntry(override val workload: VmWorkload, override val submissionTime: Long) : TraceEntry<VmWorkload>
+private class VmTraceEntry(override val workload: VmWorkload, override val submissionTime: Long) :
+ TraceEntry<VmWorkload>
diff --git a/simulator/opendc/opendc-experiments-sc20/src/main/resources/log4j2.xml b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/resources/log4j2.xml
index 6906bfc3..5ce99dfb 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/main/resources/log4j2.xml
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/resources/log4j2.xml
@@ -26,20 +26,17 @@
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="%d{HH:mm:ss.SSS} [%highlight{%-5level}] %logger{36} - %msg%n" disableAnsi="false" />
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%highlight{%-5level}] %logger{36} - %msg%n" disableAnsi="false"/>
</Console>
</Appenders>
<Loggers>
- <Logger name="com.atlarge.odcsim" level="info" additivity="false">
+ <Logger name="org.opendc" level="warn" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
- <Logger name="com.atlarge.opendc" level="warn" additivity="false">
+ <Logger name="org.opendc.experiments.sc20" level="info" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
- <Logger name="com.atlarge.opendc.experiments.sc20" level="info" additivity="false">
- <AppenderRef ref="Console"/>
- </Logger>
- <Logger name="com.atlarge.opendc.experiments.sc20.trace" level="debug" additivity="false">
+ <Logger name="org.opendc.experiments.sc20.trace" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.apache.hadoop" level="warn" additivity="false">
diff --git a/simulator/opendc/opendc-experiments-sc20/src/test/kotlin/com/atlarge/opendc/experiments/sc20/Sc20IntegrationTest.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/kotlin/org/opendc/experiments/sc20/Sc20IntegrationTest.kt
index a79e9a5a..230e7f36 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/test/kotlin/com/atlarge/opendc/experiments/sc20/Sc20IntegrationTest.kt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/kotlin/org/opendc/experiments/sc20/Sc20IntegrationTest.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,52 +20,51 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.experiments.sc20
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.SimulationEngine
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
-import com.atlarge.opendc.compute.virt.service.allocation.AvailableCoreMemoryAllocationPolicy
-import com.atlarge.opendc.experiments.sc20.experiment.attachMonitor
-import com.atlarge.opendc.experiments.sc20.experiment.createFailureDomain
-import com.atlarge.opendc.experiments.sc20.experiment.createProvisioner
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.experiments.sc20.experiment.monitor.ExperimentMonitor
-import com.atlarge.opendc.experiments.sc20.experiment.processTrace
-import com.atlarge.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
-import com.atlarge.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
-import com.atlarge.opendc.format.environment.EnvironmentReader
-import com.atlarge.opendc.format.environment.sc20.Sc20ClusterEnvironmentReader
-import com.atlarge.opendc.format.trace.TraceReader
-import java.io.File
-import java.util.ServiceLoader
+package org.opendc.experiments.sc20
+
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.cancel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.jupiter.api.AfterEach
-import org.junit.jupiter.api.Assertions.assertAll
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.compute.virt.service.SimpleVirtProvisioningService
+import org.opendc.compute.virt.service.allocation.AvailableCoreMemoryAllocationPolicy
+import org.opendc.experiments.sc20.experiment.attachMonitor
+import org.opendc.experiments.sc20.experiment.createFailureDomain
+import org.opendc.experiments.sc20.experiment.createProvisioner
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.experiments.sc20.experiment.monitor.ExperimentMonitor
+import org.opendc.experiments.sc20.experiment.processTrace
+import org.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
+import org.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
+import org.opendc.format.environment.EnvironmentReader
+import org.opendc.format.environment.sc20.Sc20ClusterEnvironmentReader
+import org.opendc.format.trace.TraceReader
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.io.File
+import java.time.Clock
/**
* An integration test suite for the SC20 experiments.
*/
+@OptIn(ExperimentalCoroutinesApi::class)
class Sc20IntegrationTest {
/**
- * The simulation engine to use.
+ * The [TestCoroutineScope] to use.
*/
- private lateinit var simulationEngine: SimulationEngine
+ private lateinit var testScope: TestCoroutineScope
/**
- * The root simulation domain to run in.
+ * The simulation clock to use.
*/
- private lateinit var root: Domain
+ private lateinit var clock: Clock
/**
* The monitor used to keep track of the metrics.
@@ -79,9 +76,9 @@ class Sc20IntegrationTest {
*/
@BeforeEach
fun setUp() {
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- simulationEngine = provider("test")
- root = simulationEngine.newDomain("root")
+ testScope = TestCoroutineScope()
+ clock = DelayControllerClockAdapter(testScope)
+
monitor = TestExperimentReporter()
}
@@ -89,9 +86,7 @@ class Sc20IntegrationTest {
* Tear down the experimental environment.
*/
@AfterEach
- fun tearDown() = runBlocking {
- simulationEngine.terminate()
- }
+ fun tearDown() = testScope.cleanupTestCoroutines()
@Test
fun smoke() {
@@ -103,9 +98,10 @@ class Sc20IntegrationTest {
val environmentReader = createTestEnvironmentReader()
lateinit var scheduler: SimpleVirtProvisioningService
- root.launch {
+ testScope.launch {
val res = createProvisioner(
- root,
+ this,
+ clock,
environmentReader,
allocationPolicy
)
@@ -115,6 +111,8 @@ class Sc20IntegrationTest {
val failureDomain = if (failures) {
println("ENABLING failures")
createFailureDomain(
+ this,
+ clock,
seed,
24.0 * 7,
bareMetalProvisioner,
@@ -124,8 +122,10 @@ class Sc20IntegrationTest {
null
}
- attachMonitor(scheduler, monitor)
+ attachMonitor(this, clock, scheduler, monitor)
processTrace(
+ this,
+ clock,
traceReader,
scheduler,
chan,
@@ -159,16 +159,19 @@ class Sc20IntegrationTest {
val environmentReader = createTestEnvironmentReader("single")
lateinit var scheduler: SimpleVirtProvisioningService
- root.launch {
+ testScope.launch {
val res = createProvisioner(
- root,
+ this,
+ clock,
environmentReader,
allocationPolicy
)
scheduler = res.second
- attachMonitor(scheduler, monitor)
+ attachMonitor(this, clock, scheduler, monitor)
processTrace(
+ this,
+ clock,
traceReader,
scheduler,
chan,
@@ -195,9 +198,7 @@ class Sc20IntegrationTest {
/**
* Run the simulation.
*/
- private fun runSimulation() = runBlocking {
- simulationEngine.run()
- }
+ private fun runSimulation() = testScope.advanceUntilIdle()
/**
* Obtain the trace reader for the test.
diff --git a/simulator/opendc/opendc-experiments-sc20/src/test/resources/env/single.txt b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/single.txt
index 53b3c2d7..53b3c2d7 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/test/resources/env/single.txt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/single.txt
diff --git a/simulator/opendc/opendc-experiments-sc20/src/test/resources/env/topology.txt b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/topology.txt
index 6b347bff..6b347bff 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/test/resources/env/topology.txt
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/env/topology.txt
diff --git a/simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/meta.parquet b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/meta.parquet
index ce7a812c..ce7a812c 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/meta.parquet
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/meta.parquet
Binary files differ
diff --git a/simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/trace.parquet b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/trace.parquet
index 1d7ce882..1d7ce882 100644
--- a/simulator/opendc/opendc-experiments-sc20/src/test/resources/trace/trace.parquet
+++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/test/resources/trace/trace.parquet
Binary files differ
diff --git a/simulator/opendc/opendc-format/build.gradle.kts b/simulator/opendc-format/build.gradle.kts
index 4cccd302..e44d68b9 100644
--- a/simulator/opendc/opendc-format/build.gradle.kts
+++ b/simulator/opendc-format/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2019 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
@@ -30,10 +28,12 @@ plugins {
}
dependencies {
- api(project(":opendc:opendc-core"))
- api(project(":opendc:opendc-compute"))
- api(project(":opendc:opendc-workflows"))
- api("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8")
+ api(project(":opendc-core"))
+ api(project(":opendc-compute"))
+ api(project(":opendc-workflows"))
+ api("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8") {
+ exclude("org.jetbrains.kotlin", module = "kotlin-reflect")
+ }
implementation(kotlin("reflect"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt
index 1c3f70e6..dd1f8edb 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/EnvironmentReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,18 +20,19 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.environment
+package org.opendc.format.environment
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.core.Environment
+import kotlinx.coroutines.CoroutineScope
+import org.opendc.core.Environment
import java.io.Closeable
+import java.time.Clock
/**
* An interface for reading descriptions of topology environments into memory as [Environment].
*/
interface EnvironmentReader : Closeable {
/**
- * Construct an [Environment] in the specified domain.
+ * Construct an [Environment] in the specified [CoroutineScope].
*/
- suspend fun construct(dom: Domain): Environment
+ suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment
}
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Model.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Model.kt
index f3e70982..c313467f 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Model.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Model.kt
@@ -1,4 +1,26 @@
-package com.atlarge.opendc.format.environment.sc18
+/*
+ * Copyright (c) 2020 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.format.environment.sc18
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt
index a9aa3337..16bb92c2 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,25 +20,26 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.environment.sc18
+package org.opendc.format.environment.sc18
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.compute.core.MemoryUnit
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.metal.service.SimpleProvisioningService
-import com.atlarge.opendc.core.Environment
-import com.atlarge.opendc.core.Platform
-import com.atlarge.opendc.core.Zone
-import com.atlarge.opendc.core.services.ServiceRegistry
-import com.atlarge.opendc.format.environment.EnvironmentReader
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
+import kotlinx.coroutines.CoroutineScope
+import org.opendc.compute.core.MemoryUnit
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.metal.service.SimpleProvisioningService
+import org.opendc.core.Environment
+import org.opendc.core.Platform
+import org.opendc.core.Zone
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.format.environment.EnvironmentReader
import java.io.InputStream
-import java.util.UUID
+import java.time.Clock
+import java.util.*
/**
* A parser for the JSON experiment setup files used for the SC18 paper: "A Reference Architecture for Topology
@@ -55,9 +54,7 @@ class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
*/
private val setup: Setup = mapper.readValue(input)
- override suspend fun construct(dom: Domain): Environment {
- val provisioningDomain = dom.newDomain("provisioner")
-
+ override suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment {
var counter = 0
val nodes = setup.rooms.flatMap { room ->
room.objects.flatMap { roomObject ->
@@ -78,7 +75,8 @@ class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
}
}
SimpleBareMetalDriver(
- dom.newDomain("node-$counter"),
+ coroutineScope,
+ clock,
UUID.randomUUID(),
"node-${counter++}",
emptyMap(),
@@ -91,14 +89,16 @@ class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
}
}
- val provisioningService = SimpleProvisioningService(provisioningDomain)
+ val provisioningService = SimpleProvisioningService()
for (node in nodes) {
provisioningService.create(node)
}
val serviceRegistry = ServiceRegistry().put(ProvisioningService, provisioningService)
val platform = Platform(
- UUID.randomUUID(), "sc18-platform", listOf(
+ UUID.randomUUID(),
+ "sc18-platform",
+ listOf(
Zone(UUID.randomUUID(), "zone", serviceRegistry)
)
)
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Model.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Model.kt
index 0a8f1c14..58af8453 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Model.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Model.kt
@@ -1,4 +1,26 @@
-package com.atlarge.opendc.format.environment.sc20
+/*
+ * Copyright (c) 2020 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.format.environment.sc20
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt
index e34ee2dc..2232b548 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,27 +20,27 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.environment.sc20
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.compute.core.MemoryUnit
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.metal.NODE_CLUSTER
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import com.atlarge.opendc.compute.metal.power.LinearLoadPowerModel
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.metal.service.SimpleProvisioningService
-import com.atlarge.opendc.core.Environment
-import com.atlarge.opendc.core.Platform
-import com.atlarge.opendc.core.Zone
-import com.atlarge.opendc.core.services.ServiceRegistry
-import com.atlarge.opendc.format.environment.EnvironmentReader
+package org.opendc.format.environment.sc20
+
+import kotlinx.coroutines.CoroutineScope
+import org.opendc.compute.core.MemoryUnit
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.metal.NODE_CLUSTER
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.compute.metal.power.LinearLoadPowerModel
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.metal.service.SimpleProvisioningService
+import org.opendc.core.Environment
+import org.opendc.core.Platform
+import org.opendc.core.Zone
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.format.environment.EnvironmentReader
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
-import java.util.Random
-import java.util.UUID
+import java.time.Clock
+import java.util.*
/**
* A [EnvironmentReader] for the internal environment format.
@@ -56,7 +54,7 @@ class Sc20ClusterEnvironmentReader(
constructor(file: File) : this(FileInputStream(file))
@Suppress("BlockingMethodInNonBlockingContext")
- override suspend fun construct(dom: Domain): Environment {
+ override suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment {
var clusterIdCol = 0
var speedCol = 0
var numberOfHostsCol = 0
@@ -105,7 +103,8 @@ class Sc20ClusterEnvironmentReader(
repeat(numberOfHosts) {
nodes.add(
SimpleBareMetalDriver(
- dom.newDomain("node-$clusterId-$it"),
+ coroutineScope,
+ clock,
UUID(random.nextLong(), random.nextLong()),
"node-$clusterId-$it",
mapOf(NODE_CLUSTER to clusterId),
@@ -123,7 +122,7 @@ class Sc20ClusterEnvironmentReader(
}
}
- val provisioningService = SimpleProvisioningService(dom.newDomain("provisioner"))
+ val provisioningService = SimpleProvisioningService()
for (node in nodes) {
provisioningService.create(node)
}
@@ -131,7 +130,9 @@ class Sc20ClusterEnvironmentReader(
val serviceRegistry = ServiceRegistry().put(ProvisioningService, provisioningService)
val platform = Platform(
- UUID.randomUUID(), "sc20-platform", listOf(
+ UUID.randomUUID(),
+ "sc20-platform",
+ listOf(
Zone(UUID.randomUUID(), "zone", serviceRegistry)
)
)
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt
index 4b5d6fb7..74afd8c4 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,26 +20,27 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.environment.sc20
+package org.opendc.format.environment.sc20
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.compute.core.MemoryUnit
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import com.atlarge.opendc.compute.metal.power.LinearLoadPowerModel
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.metal.service.SimpleProvisioningService
-import com.atlarge.opendc.core.Environment
-import com.atlarge.opendc.core.Platform
-import com.atlarge.opendc.core.Zone
-import com.atlarge.opendc.core.services.ServiceRegistry
-import com.atlarge.opendc.format.environment.EnvironmentReader
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
+import kotlinx.coroutines.CoroutineScope
+import org.opendc.compute.core.MemoryUnit
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.compute.metal.power.LinearLoadPowerModel
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.metal.service.SimpleProvisioningService
+import org.opendc.core.Environment
+import org.opendc.core.Platform
+import org.opendc.core.Zone
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.format.environment.EnvironmentReader
import java.io.InputStream
-import java.util.UUID
+import java.time.Clock
+import java.util.*
/**
* A parser for the JSON experiment setup files used for the SC20 paper.
@@ -55,7 +54,7 @@ class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
*/
private val setup: Setup = mapper.readValue(input)
- override suspend fun construct(dom: Domain): Environment {
+ override suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment {
var counter = 0
val nodes = setup.rooms.flatMap { room ->
room.objects.flatMap { roomObject ->
@@ -82,7 +81,8 @@ class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
}
}
SimpleBareMetalDriver(
- dom.newDomain("node-$counter"),
+ coroutineScope,
+ clock,
UUID.randomUUID(),
"node-${counter++}",
emptyMap(),
@@ -99,7 +99,7 @@ class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
}
}
- val provisioningService = SimpleProvisioningService(dom.newDomain("provisioner"))
+ val provisioningService = SimpleProvisioningService()
for (node in nodes) {
provisioningService.create(node)
}
@@ -107,7 +107,9 @@ class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb
val serviceRegistry = ServiceRegistry().put(ProvisioningService, provisioningService)
val platform = Platform(
- UUID.randomUUID(), "sc20-platform", listOf(
+ UUID.randomUUID(),
+ "sc20-platform",
+ listOf(
Zone(UUID.randomUUID(), "zone", serviceRegistry)
)
)
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt
index 407bc0b4..768974e1 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace
+package org.opendc.format.trace
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
import java.io.Closeable
import kotlin.random.Random
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceEntry.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt
index d4ad33f7..d532ab35 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceEntry.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt
@@ -22,9 +22,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace
+package org.opendc.format.trace
-import com.atlarge.opendc.core.workload.Workload
+import org.opendc.core.workload.Workload
/**
* An entry in a workload trace.
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt
index 6d29cdb4..81c1294a 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace
+package org.opendc.format.trace
-import com.atlarge.opendc.core.workload.Workload
+import org.opendc.core.workload.Workload
import java.io.Closeable
/**
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceWriter.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt
index 94ee6f31..56b1b025 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/TraceWriter.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt
@@ -22,9 +22,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace
+package org.opendc.format.trace
-import com.atlarge.opendc.core.workload.Workload
+import org.opendc.core.workload.Workload
import java.io.Closeable
/**
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/VmPlacementReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt
index 7caebb76..7f9e9960 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/VmPlacementReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace
+package org.opendc.format.trace
import java.io.Closeable
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt
index 1cabc8bc..26c599c2 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,20 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.bitbrains
+package org.opendc.format.trace.bitbrains
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
-import java.util.UUID
+import java.util.*
/**
* A [TraceReader] for the public VM workload trace format.
@@ -104,7 +102,15 @@ class BitbrainsTraceReader(
flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores))
} else {
if (flopsHistory.last().flops != flops) {
- flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores))
+ flopsHistory.add(
+ FlopsHistoryFragment(
+ timestamp,
+ flops,
+ traceInterval,
+ cpuUsage,
+ cores
+ )
+ )
} else {
val oldFragment = flopsHistory.removeAt(flopsHistory.size - 1)
flopsHistory.add(
@@ -125,11 +131,14 @@ class BitbrainsTraceReader(
val relevantPerformanceInterferenceModelItems =
PerformanceInterferenceModel(
- performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId.toString()) }.toSortedSet()
+ performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId.toString()) }
+ .toSortedSet()
)
val vmWorkload = VmWorkload(
- uuid, "VM Workload $vmId", UnnamedUser,
+ uuid,
+ "VM Workload $vmId",
+ UnnamedUser,
VmImage(
uuid,
vmId.toString(),
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/gwf/GwfTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt
index 3a4e2e89..4382e0b5 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/gwf/GwfTraceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,19 +20,36 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.gwf
+package org.opendc.format.trace.gwf
-import com.atlarge.opendc.compute.core.image.FlopsApplicationImage
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
-import com.atlarge.opendc.workflows.workload.Job
-import com.atlarge.opendc.workflows.workload.Task
-import com.atlarge.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
+import org.opendc.compute.core.image.FlopsApplicationImage
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
+import org.opendc.workflows.workload.Job
+import org.opendc.workflows.workload.Task
+import org.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
import java.io.BufferedReader
import java.io.File
import java.io.InputStream
-import java.util.UUID
+import java.util.*
+import kotlin.collections.HashSet
+import kotlin.collections.Iterator
+import kotlin.collections.List
+import kotlin.collections.MutableSet
+import kotlin.collections.component1
+import kotlin.collections.component2
+import kotlin.collections.emptyMap
+import kotlin.collections.filter
+import kotlin.collections.forEach
+import kotlin.collections.getOrPut
+import kotlin.collections.map
+import kotlin.collections.mapIndexed
+import kotlin.collections.mapOf
+import kotlin.collections.mutableMapOf
+import kotlin.collections.set
+import kotlin.collections.sortedBy
+import kotlin.collections.toMap
import kotlin.math.max
import kotlin.math.min
@@ -120,7 +135,8 @@ class GwfTraceReader(reader: BufferedReader) : TraceReader<Job> {
}
val workflow = entry.workload
val task = Task(
- UUID(0L, taskId), "<unnamed>",
+ UUID(0L, taskId),
+ "<unnamed>",
FlopsApplicationImage(UUID.randomUUID(), "<unnamed>", emptyMap(), flops, cores),
HashSet(),
mapOf(WORKFLOW_TASK_DEADLINE to runtime)
@@ -136,9 +152,11 @@ class GwfTraceReader(reader: BufferedReader) : TraceReader<Job> {
// Fix dependencies and dependents for all tasks
taskDependencies.forEach { (task, dependencies) ->
- (task.dependencies as MutableSet<Task>).addAll(dependencies.map { taskId ->
- tasks[taskId] ?: throw IllegalArgumentException("Dependency task with id $taskId not found")
- })
+ (task.dependencies as MutableSet<Task>).addAll(
+ dependencies.map { taskId ->
+ tasks[taskId] ?: throw IllegalArgumentException("Dependency task with id $taskId not found")
+ }
+ )
}
// Create the entry iterator
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt
index ade47e1b..0da1f7c2 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt
@@ -1,4 +1,4 @@
-package com.atlarge.opendc.format.trace.sc20
+package org.opendc.format.trace.sc20
internal data class PerformanceInterferenceEntry(
val vms: List<String>,
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt
index 0e8e1fd2..0ab7d035 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,16 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.sc20
+package org.opendc.format.trace.sc20
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModelItem
-import com.atlarge.opendc.format.trace.PerformanceInterferenceModelReader
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.PerformanceInterferenceModelItem
+import org.opendc.format.trace.PerformanceInterferenceModelReader
import java.io.InputStream
-import java.util.TreeSet
+import java.util.*
import kotlin.random.Random
/**
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt
index 8e34505a..e26e59a8 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,20 +20,20 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.sc20
+package org.opendc.format.trace.sc20
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
-import com.atlarge.opendc.compute.core.workload.PerformanceInterferenceModel
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import org.opendc.compute.core.workload.PerformanceInterferenceModel
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
-import java.util.UUID
+import java.util.*
import kotlin.math.max
import kotlin.math.min
import kotlin.random.Random
@@ -164,7 +162,9 @@ class Sc20TraceReader(
Random(random.nextInt())
)
val vmWorkload = VmWorkload(
- uuid, "VM Workload $vmId", UnnamedUser,
+ uuid,
+ "VM Workload $vmId",
+ UnnamedUser,
VmImage(
uuid,
vmId,
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt
index 5295ae03..93428d49 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20VmPlacementReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.sc20
+package org.opendc.format.trace.sc20
-import com.atlarge.opendc.format.trace.VmPlacementReader
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
+import org.opendc.format.trace.VmPlacementReader
import java.io.InputStream
/**
diff --git a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt
index 2f6ce238..6fb29a03 100644
--- a/simulator/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt
+++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,18 +20,18 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.format.trace.swf
+package org.opendc.format.trace.swf
-import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.compute.core.workload.VmWorkload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.format.trace.TraceEntry
-import com.atlarge.opendc.format.trace.TraceReader
+import org.opendc.compute.core.image.FlopsHistoryFragment
+import org.opendc.compute.core.image.VmImage
+import org.opendc.compute.core.workload.VmWorkload
+import org.opendc.core.User
+import org.opendc.format.trace.TraceEntry
+import org.opendc.format.trace.TraceReader
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
-import java.util.UUID
+import java.util.*
/**
* A [TraceReader] for reading SWF traces into VM-modeled workloads.
@@ -115,7 +113,11 @@ class SwfTraceReader(
for (tick in submitTime until (submitTime + waitTime - sliceDuration) step sliceDuration) {
flopsHistory.add(
FlopsHistoryFragment(
- tick * 1000L, 0L, sliceDuration * 1000L, 0.0, cores
+ tick * 1000L,
+ 0L,
+ sliceDuration * 1000L,
+ 0.0,
+ cores
)
)
slicedWaitTime += sliceDuration
@@ -129,12 +131,18 @@ class SwfTraceReader(
flopsPartialSlice = flopsPerSecond * runtimePartialSliceRemainder
flopsFullSlice = flopsPerSecond * runTime - flopsPartialSlice
- for (tick in (submitTime + slicedWaitTime)
- until (submitTime + slicedWaitTime + runTime - sliceDuration)
- step sliceDuration) {
+ for (
+ tick in (submitTime + slicedWaitTime)
+ until (submitTime + slicedWaitTime + runTime - sliceDuration)
+ step sliceDuration
+ ) {
flopsHistory.add(
FlopsHistoryFragment(
- tick * 1000L, flopsFullSlice / sliceDuration, sliceDuration * 1000L, 1.0, cores
+ tick * 1000L,
+ flopsFullSlice / sliceDuration,
+ sliceDuration * 1000L,
+ 1.0,
+ cores
)
)
}
@@ -153,7 +161,9 @@ class SwfTraceReader(
val uuid = UUID(0L, jobNumber)
val vmWorkload = VmWorkload(
- uuid, "SWF Workload $jobNumber", UnnamedUser,
+ uuid,
+ "SWF Workload $jobNumber",
+ UnnamedUser,
VmImage(
uuid,
jobNumber.toString(),
diff --git a/simulator/opendc-format/src/test/kotlin/org/opendc/format/trace/swf/SwfTraceReaderTest.kt b/simulator/opendc-format/src/test/kotlin/org/opendc/format/trace/swf/SwfTraceReaderTest.kt
new file mode 100644
index 00000000..40132ad3
--- /dev/null
+++ b/simulator/opendc-format/src/test/kotlin/org/opendc/format/trace/swf/SwfTraceReaderTest.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 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.format.trace.swf
+
+import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Test
+import java.io.File
+
+class SwfTraceReaderTest {
+ @Test
+ internal fun testParseSwf() {
+ val reader = SwfTraceReader(File(SwfTraceReaderTest::class.java.getResource("/swf_trace.txt").toURI()))
+ var entry = reader.next()
+ assertEquals(0, entry.submissionTime)
+ // 1961 slices for waiting, 3 full and 1 partial running slices
+ assertEquals(1965, entry.workload.image.flopsHistory.toList().size)
+
+ entry = reader.next()
+ assertEquals(164472, entry.submissionTime)
+ // 1188 slices for waiting, 0 full and 1 partial running slices
+ assertEquals(1189, entry.workload.image.flopsHistory.toList().size)
+ assertEquals(5_100_000L, entry.workload.image.flopsHistory.toList().last().flops)
+ assertEquals(0.25, entry.workload.image.flopsHistory.toList().last().usage)
+ }
+}
diff --git a/simulator/opendc/opendc-format/src/test/resources/swf_trace.txt b/simulator/opendc-format/src/test/resources/swf_trace.txt
index c3ecf890..c3ecf890 100644
--- a/simulator/opendc/opendc-format/src/test/resources/swf_trace.txt
+++ b/simulator/opendc-format/src/test/resources/swf_trace.txt
diff --git a/simulator/opendc/opendc-runner-web/build.gradle.kts b/simulator/opendc-runner-web/build.gradle.kts
index 6f725de1..7e81347c 100644
--- a/simulator/opendc/opendc-runner-web/build.gradle.kts
+++ b/simulator/opendc-runner-web/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -31,14 +29,15 @@ plugins {
}
application {
- mainClassName = "com.atlarge.opendc.runner.web.MainKt"
+ mainClassName = "org.opendc.runner.web.MainKt"
}
dependencies {
- api(project(":opendc:opendc-core"))
- implementation(project(":opendc:opendc-compute"))
- implementation(project(":opendc:opendc-format"))
- implementation(project(":opendc:opendc-experiments-sc20"))
+ api(project(":opendc-core"))
+ implementation(project(":opendc-compute"))
+ implementation(project(":opendc-format"))
+ implementation(project(":opendc-experiments:opendc-experiments-sc20"))
+ implementation(project(":opendc-simulator"))
implementation("com.github.ajalt:clikt:2.8.0")
implementation("io.github.microutils:kotlin-logging:1.7.10")
@@ -49,7 +48,6 @@ dependencies {
exclude(group = "log4j")
}
- runtimeOnly(project(":odcsim:odcsim-engine-omega"))
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.13.1")
runtimeOnly("org.apache.logging.log4j:log4j-1.2-api:2.13.1")
}
diff --git a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/Main.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt
index 807c119e..69b2e69d 100644
--- a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/Main.kt
+++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt
@@ -1,16 +1,27 @@
-package com.atlarge.opendc.runner.web
-
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.opendc.compute.virt.service.allocation.*
-import com.atlarge.opendc.experiments.sc20.experiment.attachMonitor
-import com.atlarge.opendc.experiments.sc20.experiment.createFailureDomain
-import com.atlarge.opendc.experiments.sc20.experiment.createProvisioner
-import com.atlarge.opendc.experiments.sc20.experiment.model.Workload
-import com.atlarge.opendc.experiments.sc20.experiment.monitor.ParquetExperimentMonitor
-import com.atlarge.opendc.experiments.sc20.experiment.processTrace
-import com.atlarge.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
-import com.atlarge.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
-import com.atlarge.opendc.format.trace.sc20.Sc20PerformanceInterferenceReader
+/*
+ * Copyright (c) 2020 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.runner.web
+
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.*
import com.github.ajalt.clikt.parameters.types.file
@@ -22,24 +33,32 @@ import com.mongodb.client.MongoClients
import com.mongodb.client.MongoCollection
import com.mongodb.client.MongoDatabase
import com.mongodb.client.model.Filters
-import java.io.File
-import java.util.*
-import kotlin.random.Random
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
+import kotlinx.coroutines.test.TestCoroutineScope
import mu.KotlinLogging
import org.bson.Document
+import org.opendc.compute.virt.service.allocation.*
+import org.opendc.experiments.sc20.experiment.attachMonitor
+import org.opendc.experiments.sc20.experiment.createFailureDomain
+import org.opendc.experiments.sc20.experiment.createProvisioner
+import org.opendc.experiments.sc20.experiment.model.Workload
+import org.opendc.experiments.sc20.experiment.monitor.ParquetExperimentMonitor
+import org.opendc.experiments.sc20.experiment.processTrace
+import org.opendc.experiments.sc20.trace.Sc20ParquetTraceReader
+import org.opendc.experiments.sc20.trace.Sc20RawParquetTraceReader
+import org.opendc.format.trace.sc20.Sc20PerformanceInterferenceReader
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import java.io.File
+import java.util.*
+import kotlin.random.Random
private val logger = KotlinLogging.logger {}
/**
- * The provider for the simulation engine to use.
- */
-private val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
-
-/**
* Represents the CLI command for starting the OpenDC web runner.
*/
+@OptIn(ExperimentalCoroutinesApi::class)
class RunnerCli : CliktCommand(name = "runner") {
/**
* The name of the database to use.
@@ -195,8 +214,8 @@ class RunnerCli : CliktCommand(name = "runner") {
val workloadFraction = traceDocument.get("loadSamplingFraction", Number::class.java).toDouble()
val seeder = Random(seed)
- val system = provider("experiment-$id")
- val root = system.newDomain("root")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
val chan = Channel<Unit>(Channel.CONFLATED)
@@ -230,9 +249,10 @@ class RunnerCli : CliktCommand(name = "runner") {
4096
)
- root.launch {
+ testScope.launch {
val (bareMetalProvisioner, scheduler) = createProvisioner(
- root,
+ this,
+ clock,
environment,
allocationPolicy
)
@@ -240,6 +260,8 @@ class RunnerCli : CliktCommand(name = "runner") {
val failureDomain = if (operational.getBoolean("failuresEnabled")) {
logger.debug("ENABLING failures")
createFailureDomain(
+ testScope,
+ clock,
seeder.nextInt(),
operational.get("failureFrequency", Number::class.java)?.toDouble() ?: 24.0 * 7,
bareMetalProvisioner,
@@ -249,8 +271,10 @@ class RunnerCli : CliktCommand(name = "runner") {
null
}
- attachMonitor(scheduler, monitor)
+ attachMonitor(this, clock, scheduler, monitor)
processTrace(
+ this,
+ clock,
trace,
scheduler,
chan,
@@ -269,9 +293,8 @@ class RunnerCli : CliktCommand(name = "runner") {
}
try {
- system.run()
+ testScope.advanceUntilIdle()
} finally {
- system.terminate()
monitor.close()
}
}
diff --git a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ResultProcessor.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt
index 39092653..5cae6aa8 100644
--- a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ResultProcessor.kt
+++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt
@@ -1,11 +1,33 @@
-package com.atlarge.opendc.runner.web
+/*
+ * Copyright (c) 2020 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.runner.web
-import java.io.File
import org.apache.spark.sql.Column
import org.apache.spark.sql.Dataset
import org.apache.spark.sql.Row
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.functions.*
+import java.io.File
/**
* A helper class for processing the experiment results using Apache Spark.
@@ -175,13 +197,19 @@ class ResultProcessor(private val master: String, private val outputPath: File)
val sliceLength = 5 * 60 * 1000
val states = map(
- lit("ERROR"), lit(1),
- lit("ACTIVE"), lit(0),
- lit("SHUTOFF"), lit(0)
+ lit("ERROR"),
+ lit(1),
+ lit("ACTIVE"),
+ lit(0),
+ lit("SHUTOFF"),
+ lit(0)
)
val oppositeStates = map(
- lit("ERROR"), lit(0),
- lit("ACTIVE"), lit(1),
- lit("SHUTOFF"), lit(1)
+ lit("ERROR"),
+ lit(0),
+ lit("ACTIVE"),
+ lit(1),
+ lit("SHUTOFF"),
+ lit(1)
)
}
diff --git a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ScenarioManager.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt
index 40ffd282..0c6c8fee 100644
--- a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/ScenarioManager.kt
+++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt
@@ -1,10 +1,32 @@
-package com.atlarge.opendc.runner.web
+/*
+ * Copyright (c) 2020 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.runner.web
import com.mongodb.client.MongoCollection
import com.mongodb.client.model.Filters
import com.mongodb.client.model.Updates
-import java.time.Instant
import org.bson.Document
+import java.time.Instant
/**
* Manages the queue of scenarios that need to be processed.
diff --git a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/TopologyParser.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
index 499585ec..884833cb 100644
--- a/simulator/opendc/opendc-runner-web/src/main/kotlin/com/atlarge/opendc/runner/web/TopologyParser.kt
+++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
@@ -1,28 +1,51 @@
-package com.atlarge.opendc.runner.web
+/*
+ * Copyright (c) 2020 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.runner.web
-import com.atlarge.odcsim.Domain
-import com.atlarge.opendc.compute.core.MemoryUnit
-import com.atlarge.opendc.compute.core.ProcessingNode
-import com.atlarge.opendc.compute.core.ProcessingUnit
-import com.atlarge.opendc.compute.metal.NODE_CLUSTER
-import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver
-import com.atlarge.opendc.compute.metal.power.LinearLoadPowerModel
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.compute.metal.service.SimpleProvisioningService
-import com.atlarge.opendc.core.Environment
-import com.atlarge.opendc.core.Platform
-import com.atlarge.opendc.core.Zone
-import com.atlarge.opendc.core.services.ServiceRegistry
-import com.atlarge.opendc.format.environment.EnvironmentReader
import com.mongodb.client.AggregateIterable
import com.mongodb.client.MongoCollection
import com.mongodb.client.model.Aggregates
import com.mongodb.client.model.Field
import com.mongodb.client.model.Filters
import com.mongodb.client.model.Projections
-import java.util.*
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import org.bson.Document
+import org.opendc.compute.core.MemoryUnit
+import org.opendc.compute.core.ProcessingNode
+import org.opendc.compute.core.ProcessingUnit
+import org.opendc.compute.metal.NODE_CLUSTER
+import org.opendc.compute.metal.driver.SimpleBareMetalDriver
+import org.opendc.compute.metal.power.LinearLoadPowerModel
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.compute.metal.service.SimpleProvisioningService
+import org.opendc.core.Environment
+import org.opendc.core.Platform
+import org.opendc.core.Zone
+import org.opendc.core.services.ServiceRegistry
+import org.opendc.format.environment.EnvironmentReader
+import java.time.Clock
+import java.util.*
/**
* A helper class that converts the MongoDB topology into an OpenDC environment.
@@ -31,7 +54,7 @@ class TopologyParser(private val collection: MongoCollection<Document>, private
/**
* Parse the topology with the specified [id].
*/
- override suspend fun construct(dom: Domain): Environment {
+ override suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment {
val nodes = mutableListOf<SimpleBareMetalDriver>()
val random = Random(0)
@@ -59,7 +82,8 @@ class TopologyParser(private val collection: MongoCollection<Document>, private
}
nodes.add(
SimpleBareMetalDriver(
- dom.newDomain(machineId),
+ coroutineScope,
+ clock,
UUID(random.nextLong(), random.nextLong()),
"node-$clusterId-$position",
mapOf(NODE_CLUSTER to clusterId),
@@ -73,8 +97,8 @@ class TopologyParser(private val collection: MongoCollection<Document>, private
)
}
- val provisioningService = SimpleProvisioningService(dom.newDomain("provisioner"))
- dom.launch {
+ val provisioningService = SimpleProvisioningService()
+ coroutineScope.launch {
for (node in nodes) {
provisioningService.create(node)
}
@@ -83,7 +107,9 @@ class TopologyParser(private val collection: MongoCollection<Document>, private
val serviceRegistry = ServiceRegistry().put(ProvisioningService, provisioningService)
val platform = Platform(
- UUID.randomUUID(), "opendc-platform", listOf(
+ UUID.randomUUID(),
+ "opendc-platform",
+ listOf(
Zone(UUID.randomUUID(), "zone", serviceRegistry)
)
)
diff --git a/simulator/opendc/opendc-runner-web/src/main/resources/log4j2.xml b/simulator/opendc-runner-web/src/main/resources/log4j2.xml
index 1d873554..16cedf34 100644
--- a/simulator/opendc/opendc-runner-web/src/main/resources/log4j2.xml
+++ b/simulator/opendc-runner-web/src/main/resources/log4j2.xml
@@ -26,17 +26,14 @@
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="%d{HH:mm:ss.SSS} [%highlight{%-5level}] %logger{36} - %msg%n" disableAnsi="false" />
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%highlight{%-5level}] %logger{36} - %msg%n" disableAnsi="false"/>
</Console>
</Appenders>
<Loggers>
- <Logger name="com.atlarge.odcsim" level="info" additivity="false">
+ <Logger name="org.opendc" level="warn" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
- <Logger name="com.atlarge.opendc" level="warn" additivity="false">
- <AppenderRef ref="Console"/>
- </Logger>
- <Logger name="com.atlarge.opendc.runner" level="info" additivity="false">
+ <Logger name="org.opendc.runner" level="info" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.apache.hadoop" level="warn" additivity="false">
diff --git a/simulator/opendc-simulator/build.gradle.kts b/simulator/opendc-simulator/build.gradle.kts
new file mode 100644
index 00000000..a740dcf3
--- /dev/null
+++ b/simulator/opendc-simulator/build.gradle.kts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2020 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.
+ */
+
+description = "Simulation-specific code for use in OpenDC"
+
+/* Build configuration */
+plugins {
+ `kotlin-library-convention`
+}
+
+dependencies {
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Library.KOTLINX_COROUTINES}")
+}
diff --git a/simulator/opendc-simulator/src/main/kotlin/org/opendc/simulator/utils/DelayControllerClockAdapter.kt b/simulator/opendc-simulator/src/main/kotlin/org/opendc/simulator/utils/DelayControllerClockAdapter.kt
new file mode 100644
index 00000000..84c18e87
--- /dev/null
+++ b/simulator/opendc-simulator/src/main/kotlin/org/opendc/simulator/utils/DelayControllerClockAdapter.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2020 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.simulator.utils
+
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.DelayController
+import java.time.Clock
+import java.time.Instant
+import java.time.ZoneId
+
+/**
+ * A virtual [Clock] that abstracts accesses to [DelayController]'s virtual clock.
+ */
+@OptIn(ExperimentalCoroutinesApi::class)
+public class DelayControllerClockAdapter(
+ private val delayController: DelayController,
+ private val zone: ZoneId = ZoneId.systemDefault()
+) : Clock() {
+ override fun getZone(): ZoneId = zone
+
+ override fun withZone(zone: ZoneId): Clock = DelayControllerClockAdapter(delayController, zone)
+
+ override fun instant(): Instant = Instant.ofEpochMilli(millis())
+
+ override fun millis(): Long = delayController.currentTime
+}
diff --git a/simulator/opendc-utils/build.gradle.kts b/simulator/opendc-utils/build.gradle.kts
new file mode 100644
index 00000000..d66148c4
--- /dev/null
+++ b/simulator/opendc-utils/build.gradle.kts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2020 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.
+ */
+
+description = "Utilities used across OpenDC modules"
+
+/* Build configuration */
+plugins {
+ `kotlin-library-convention`
+}
+
+dependencies {
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}")
+}
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/EventFlow.kt b/simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/EventFlow.kt
index 0e18f82f..948595b1 100644
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/EventFlow.kt
+++ b/simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/EventFlow.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,8 @@
* SOFTWARE.
*/
-package com.atlarge.odcsim.flow
+package org.opendc.utils.flow
-import java.util.WeakHashMap
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.InternalCoroutinesApi
@@ -61,7 +58,7 @@ public fun <T> EventFlow(): EventFlow<T> = EventFlowImpl()
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
private class EventFlowImpl<T> : EventFlow<T> {
private var closed: Boolean = false
- private val subscribers = WeakHashMap<SendChannel<T>, Unit>()
+ private val subscribers = HashMap<SendChannel<T>, Unit>()
override fun emit(event: T) {
synchronized(this) {
diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/StateFlow.kt b/simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/StateFlow.kt
index 50add0ad..996e7700 100644
--- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/StateFlow.kt
+++ b/simulator/opendc-utils/src/main/kotlin/org/opendc/utils/flow/StateFlow.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.odcsim.flow
+package org.opendc.utils.flow
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
diff --git a/simulator/opendc/opendc-workflows/build.gradle.kts b/simulator/opendc-workflows/build.gradle.kts
index 893c9020..97c588da 100644
--- a/simulator/opendc/opendc-workflows/build.gradle.kts
+++ b/simulator/opendc-workflows/build.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2019 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
@@ -30,11 +28,12 @@ plugins {
}
dependencies {
- api(project(":opendc:opendc-core"))
- api(project(":opendc:opendc-compute"))
+ api(project(":opendc-core"))
+ api(project(":opendc-compute"))
+ implementation(project(":opendc-utils"))
- testRuntimeOnly(project(":odcsim:odcsim-engine-omega"))
- testImplementation(project(":opendc:opendc-format"))
+ testImplementation(project(":opendc-simulator"))
+ testImplementation(project(":opendc-format"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}")
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/JobState.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt
index 1cb2de97..a8d10d22 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/JobState.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.opendc.workflows.workload.Job
+import org.opendc.workflows.workload.Job
class JobState(val job: Job, val submittedAt: Long) {
/**
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerListener.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt
index 73c3e752..d03a646c 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerListener.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,7 +20,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
interface StageWorkflowSchedulerListener {
fun cycleStarted(scheduler: StageWorkflowService) {}
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt
index 1193f7b2..6262c61f 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,39 +20,37 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
-
-import com.atlarge.odcsim.Domain
-import com.atlarge.odcsim.flow.EventFlow
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.ServerEvent
-import com.atlarge.opendc.compute.core.ServerState
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.workflows.service.stage.job.JobAdmissionPolicy
-import com.atlarge.opendc.workflows.service.stage.job.JobOrderPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.ResourceFilterPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.ResourceSelectionPolicy
-import com.atlarge.opendc.workflows.service.stage.task.TaskEligibilityPolicy
-import com.atlarge.opendc.workflows.service.stage.task.TaskOrderPolicy
-import com.atlarge.opendc.workflows.workload.Job
-import java.util.PriorityQueue
-import java.util.Queue
+package org.opendc.workflows.service
+
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
+import org.opendc.compute.core.Server
+import org.opendc.compute.core.ServerEvent
+import org.opendc.compute.core.ServerState
+import org.opendc.compute.metal.Node
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.utils.flow.EventFlow
+import org.opendc.workflows.service.stage.job.JobAdmissionPolicy
+import org.opendc.workflows.service.stage.job.JobOrderPolicy
+import org.opendc.workflows.service.stage.resource.ResourceFilterPolicy
+import org.opendc.workflows.service.stage.resource.ResourceSelectionPolicy
+import org.opendc.workflows.service.stage.task.TaskEligibilityPolicy
+import org.opendc.workflows.service.stage.task.TaskOrderPolicy
+import org.opendc.workflows.workload.Job
+import java.time.Clock
+import java.util.*
/**
* A [WorkflowService] that distributes work through a multi-stage process based on the Reference Architecture for
* Topology Scheduling.
*/
class StageWorkflowService(
- private val domain: Domain,
+ internal val coroutineScope: CoroutineScope,
+ internal val clock: Clock,
private val provisioningService: ProvisioningService,
mode: WorkflowSchedulerMode,
jobAdmissionPolicy: JobAdmissionPolicy,
@@ -63,7 +59,7 @@ class StageWorkflowService(
taskOrderPolicy: TaskOrderPolicy,
resourceFilterPolicy: ResourceFilterPolicy,
resourceSelectionPolicy: ResourceSelectionPolicy
-) : WorkflowService, CoroutineScope by domain {
+) : WorkflowService {
/**
* The incoming jobs ready to be processed by the scheduler.
@@ -175,7 +171,7 @@ class StageWorkflowService(
private val eventFlow = EventFlow<WorkflowEvent>()
init {
- domain.launch {
+ coroutineScope.launch {
nodes = provisioningService.nodes().toList()
available.addAll(nodes)
}
@@ -191,9 +187,9 @@ class StageWorkflowService(
override val events: Flow<WorkflowEvent> = eventFlow
- override suspend fun submit(job: Job) = withContext(domain.coroutineContext) {
+ override suspend fun submit(job: Job) {
// J1 Incoming Jobs
- val jobInstance = JobState(job, simulationContext.clock.millis())
+ val jobInstance = JobState(job, clock.millis())
val instances = job.tasks.associateWith {
TaskState(jobInstance, it)
}
@@ -241,7 +237,7 @@ class StageWorkflowService(
iterator.remove()
jobQueue.add(jobInstance)
activeJobs += jobInstance
- eventFlow.emit(WorkflowEvent.JobStarted(this, jobInstance.job, simulationContext.clock.millis()))
+ eventFlow.emit(WorkflowEvent.JobStarted(this, jobInstance.job, clock.millis()))
rootListener.jobStarted(jobInstance)
}
@@ -295,7 +291,7 @@ class StageWorkflowService(
taskByServer[server] = instance
server.events
.onEach { event -> if (event is ServerEvent.StateChanged) stateChanged(event.server) }
- .launchIn(this)
+ .launchIn(coroutineScope)
activeTasks += instance
taskQueue.poll()
@@ -310,19 +306,33 @@ class StageWorkflowService(
when (server.state) {
ServerState.ACTIVE -> {
val task = taskByServer.getValue(server)
- task.startedAt = simulationContext.clock.millis()
- eventFlow.emit(WorkflowEvent.TaskStarted(this@StageWorkflowService, task.job.job, task.task, simulationContext.clock.millis()))
+ task.startedAt = clock.millis()
+ eventFlow.emit(
+ WorkflowEvent.TaskStarted(
+ this@StageWorkflowService,
+ task.job.job,
+ task.task,
+ clock.millis()
+ )
+ )
rootListener.taskStarted(task)
}
ServerState.SHUTOFF, ServerState.ERROR -> {
val task = taskByServer.remove(server) ?: throw IllegalStateException()
val job = task.job
task.state = TaskStatus.FINISHED
- task.finishedAt = simulationContext.clock.millis()
+ task.finishedAt = clock.millis()
job.tasks.remove(task)
available += task.host!!
activeTasks -= task
- eventFlow.emit(WorkflowEvent.TaskFinished(this@StageWorkflowService, task.job.job, task.task, simulationContext.clock.millis()))
+ eventFlow.emit(
+ WorkflowEvent.TaskFinished(
+ this@StageWorkflowService,
+ task.job.job,
+ task.task,
+ clock.millis()
+ )
+ )
rootListener.taskFinished(task)
// Add job roots to the scheduling queue
@@ -347,7 +357,7 @@ class StageWorkflowService(
private suspend fun finishJob(job: JobState) {
activeJobs -= job
- eventFlow.emit(WorkflowEvent.JobFinished(this, job.job, simulationContext.clock.millis()))
+ eventFlow.emit(WorkflowEvent.JobFinished(this, job.job, clock.millis()))
rootListener.jobFinished(job)
}
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskState.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt
index acd5731b..e7795dd5 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskState.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.workload.Task
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.workload.Task
class TaskState(val job: JobState, val task: Task) {
/**
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskStatus.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskStatus.kt
index c53c6171..99f5bb87 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/TaskStatus.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskStatus.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
/**
* The state of a workflow task.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowEvent.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowEvent.kt
index 2ca5a19d..dadccb50 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowEvent.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowEvent.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.opendc.workflows.workload.Job
-import com.atlarge.opendc.workflows.workload.Task
+import org.opendc.workflows.workload.Job
+import org.opendc.workflows.workload.Task
/**
* An event emitted by the [WorkflowService].
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowSchedulerMode.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt
index 776f0b07..3eff0062 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowSchedulerMode.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.yield
+import org.opendc.workflows.service.stage.StagePolicy
/**
* The operating mode of a workflow scheduler.
@@ -66,13 +63,12 @@ sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> {
override fun invoke(scheduler: StageWorkflowService): Logic = object : Logic {
override suspend fun requestCycle() {
- val ctx = simulationContext
if (next == null) {
// In batch mode, we assume that the scheduler runs at a fixed slot every time
// quantum (e.g t=0, t=60, t=120). We calculate here the delay until the next scheduling slot.
- val delay = quantum - (ctx.clock.millis() % quantum)
+ val delay = quantum - (scheduler.clock.millis() % quantum)
- val job = ctx.domain.launch {
+ val job = scheduler.coroutineScope.launch {
delay(delay)
next = null
scheduler.schedule()
@@ -93,11 +89,10 @@ sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> {
override fun invoke(scheduler: StageWorkflowService): Logic = object : Logic {
override suspend fun requestCycle() {
- val ctx = simulationContext
if (next == null) {
val delay = random.nextInt(200).toLong()
- val job = ctx.domain.launch {
+ val job = scheduler.coroutineScope.launch {
delay(delay)
next = null
scheduler.schedule()
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowService.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt
index a60ba0e2..17a2d875 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/WorkflowService.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.opendc.core.services.AbstractServiceKey
-import com.atlarge.opendc.workflows.workload.Job
-import java.util.UUID
import kotlinx.coroutines.flow.Flow
+import org.opendc.core.services.AbstractServiceKey
+import org.opendc.workflows.workload.Job
+import java.util.*
/**
* A service for cloud workflow management.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/StagePolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt
index c7cc3d84..68a8a424 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/StagePolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,9 +20,9 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage
+package org.opendc.workflows.service.stage
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.StageWorkflowService
import java.io.Serializable
/**
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt
index bbdb9f71..9ac6a97f 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,14 +20,14 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.workload.Job
-import com.atlarge.opendc.workflows.workload.Task
-import com.atlarge.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.workload.Job
+import org.opendc.workflows.workload.Task
+import org.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
/**
* A [JobOrderPolicy] that orders jobs based on its critical path length.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt
index 535d7792..8d45918b 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.stage.StagePolicy
/**
* A policy interface for admitting [JobState]s to a scheduling cycle.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt
index ba57f064..e65a2ea7 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/JobOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.stage.StagePolicy
/**
* A policy interface for ordering admitted workflows in the scheduling queue.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt
index 6b1faf20..7ee15e6b 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [JobAdmissionPolicy] that limits the amount of active jobs in the system.
@@ -34,9 +32,7 @@ import com.atlarge.opendc.workflows.service.StageWorkflowService
*/
data class LimitJobAdmissionPolicy(val limit: Int) : JobAdmissionPolicy {
override fun invoke(scheduler: StageWorkflowService) = object : JobAdmissionPolicy.Logic {
- override fun invoke(
- job: JobState
- ): JobAdmissionPolicy.Advice =
+ override fun invoke(job: JobState): JobAdmissionPolicy.Advice =
if (scheduler.activeJobs.size < limit)
JobAdmissionPolicy.Advice.ADMIT
else
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt
index e1c27472..31e6d043 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [JobAdmissionPolicy] that limits the amount of jobs based on the average system load.
@@ -34,9 +32,7 @@ import com.atlarge.opendc.workflows.service.StageWorkflowService
*/
data class LoadJobAdmissionPolicy(val limit: Double) : JobAdmissionPolicy {
override fun invoke(scheduler: StageWorkflowService) = object : JobAdmissionPolicy.Logic {
- override fun invoke(
- job: JobState
- ): JobAdmissionPolicy.Advice =
+ override fun invoke(job: JobState): JobAdmissionPolicy.Advice =
if (scheduler.load < limit)
JobAdmissionPolicy.Advice.ADMIT
else
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt
index 46888467..e671db52 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,17 +20,18 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [JobAdmissionPolicy] that admits all jobs.
*/
object NullJobAdmissionPolicy : JobAdmissionPolicy {
override fun invoke(scheduler: StageWorkflowService) = object : JobAdmissionPolicy.Logic {
- override fun invoke(job: JobState): JobAdmissionPolicy.Advice = JobAdmissionPolicy.Advice.ADMIT
+ override fun invoke(job: JobState): JobAdmissionPolicy.Advice =
+ JobAdmissionPolicy.Advice.ADMIT
}
override fun toString(): String = "Always"
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt
index 14a3d98d..7f5abd68 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,16 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.workload.Job
-import java.util.Random
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.workload.Job
+import java.util.*
+import kotlin.collections.HashMap
+import kotlin.collections.getValue
+import kotlin.collections.set
/**
* A [JobOrderPolicy] that randomly orders jobs.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt
index 3bce43cf..05953a9b 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [SizeJobOrderPolicy] that orders jobs based on the number of tasks it has.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt
index d6e24b2b..9a48f934 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.job
+package org.opendc.workflows.service.stage.job
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [JobOrderPolicy] orders jobs in FIFO order.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt
index a5671d45..64b46330 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.resource
+package org.opendc.workflows.service.stage.resource
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.service.StageWorkflowService
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.service.StageWorkflowService
/**
* A [ResourceSelectionPolicy] that selects the first machine that is available.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt
index 0e83d8d7..e505539d 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.resource
+package org.opendc.workflows.service.stage.resource
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [ResourceFilterPolicy] based on the amount of cores available on the machine and the cores required for
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt
index 9b05cbac..68c78cd6 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.resource
+package org.opendc.workflows.service.stage.resource
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import java.util.Random
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.service.StageWorkflowService
+import java.util.*
/**
* A [ResourceSelectionPolicy] that randomly orders the machines.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt
index 28ef970f..43744417 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.resource
+package org.opendc.workflows.service.stage.resource
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.service.TaskState
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.stage.StagePolicy
/**
* This interface represents stages **R2**, **R3** and **R4** stage of the Reference Architecture for Schedulers and
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt
index 43053097..2cc9bc3b 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.resource
+package org.opendc.workflows.service.stage.resource
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.compute.metal.Node
+import org.opendc.workflows.service.stage.StagePolicy
/**
* This interface represents the **R5** stage of the Reference Architecture for Schedulers and matches the the selected
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt
index b084d26c..ef2f9db4 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the number of active relative tasks (w.r.t. its job) in the system.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt
index 2255d40c..11ac612e 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
import kotlin.math.max
/**
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt
index d0cf1374..c3e3720a 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the number of completed relative tasks.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt
index 73d83d21..60e27118 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the number of dependency tasks it has.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt
index 85b3543f..97a6dfb0 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the number of dependent tasks it has.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt
index 426a76a4..9cd83eac 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the average duration of the preceding tasks in the job.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt
index 23b47891..d5a8a104 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,13 +20,17 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
-import com.atlarge.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
-import java.util.UUID
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
+import org.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE
+import java.util.*
+import kotlin.collections.HashMap
+import kotlin.collections.getValue
+import kotlin.collections.minusAssign
+import kotlin.collections.set
/**
* A [TaskOrderPolicy] orders tasks based on the pre-specified (approximate) duration of the task.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt
index c039bf6f..9b06f7d9 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,12 +20,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.JobState
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.JobState
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskEligibilityPolicy] that limits the number of active tasks of a job in the system.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt
index 75322ef5..e0ac3bc4 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskEligibilityPolicy] that limits the total number of active tasks in the system.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt
index 090f7be7..e1f0a0b7 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskEligibilityPolicy] that limits the number of active tasks in the system based on the average system load.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt
index 889f2ab5..4f34b692 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,10 +20,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskEligibilityPolicy] that always allows new tasks to enter.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt
index d6f49d14..8a2e26ad 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2020 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
-import java.util.Random
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
+import java.util.*
/**
* A [TaskEligibilityPolicy] that randomly accepts tasks in the system with some [probability].
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt
index 4c309085..df03ba80 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt
@@ -22,12 +22,12 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowSchedulerListener
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
-import com.atlarge.opendc.workflows.workload.Task
+import org.opendc.workflows.service.StageWorkflowSchedulerListener
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
+import org.opendc.workflows.workload.Task
import kotlin.random.Random
/**
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt
index a261965f..e6727e8a 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt
@@ -22,10 +22,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.StageWorkflowService
-import com.atlarge.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.StageWorkflowService
+import org.opendc.workflows.service.TaskState
/**
* A [TaskOrderPolicy] that orders tasks based on the order of arrival in the queue.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt
index 72a7fdd0..1eb2fab0 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt
@@ -22,10 +22,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.TaskState
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.stage.StagePolicy
/**
* A policy interface for determining the eligibility of tasks in a scheduling cycle.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt
index e74082c2..0a3ce077 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/stage/task/TaskOrderPolicy.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt
@@ -22,10 +22,10 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service.stage.task
+package org.opendc.workflows.service.stage.task
-import com.atlarge.opendc.workflows.service.TaskState
-import com.atlarge.opendc.workflows.service.stage.StagePolicy
+import org.opendc.workflows.service.TaskState
+import org.opendc.workflows.service.stage.StagePolicy
/**
* This interface represents the **T2** stage of the Reference Architecture for Topology Schedulers and provides the
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Job.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt
index 02969d8a..30285507 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Job.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2019 atlarge-research
+ * Copyright (c) 2020 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
@@ -22,11 +20,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.workload
+package org.opendc.workflows.workload
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.core.workload.Workload
-import java.util.UUID
+import org.opendc.core.User
+import org.opendc.core.workload.Workload
+import java.util.*
/**
* A workload that represents a directed acyclic graph (DAG) of tasks with control and data dependencies between tasks.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Metadata.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt
index 067f1179..99bd1cd3 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Metadata.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.workload
+package org.opendc.workflows.workload
/**
* Meta-data key for the deadline of a task.
diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Task.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt
index 82521faa..864eede5 100644
--- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/workload/Task.kt
+++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt
@@ -22,11 +22,11 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.workload
+package org.opendc.workflows.workload
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.core.Identity
-import java.util.UUID
+import org.opendc.compute.core.image.Image
+import org.opendc.core.Identity
+import java.util.*
/**
* A stage of a [Job].
diff --git a/simulator/opendc/opendc-workflows/src/test/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt b/simulator/opendc-workflows/src/test/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt
index 5c129e37..6e9e7430 100644
--- a/simulator/opendc/opendc-workflows/src/test/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt
+++ b/simulator/opendc-workflows/src/test/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerIntegrationTest.kt
@@ -22,35 +22,36 @@
* SOFTWARE.
*/
-package com.atlarge.opendc.workflows.service
+package org.opendc.workflows.service
-import com.atlarge.odcsim.SimulationEngineProvider
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.metal.service.ProvisioningService
-import com.atlarge.opendc.format.environment.sc18.Sc18EnvironmentReader
-import com.atlarge.opendc.format.trace.gwf.GwfTraceReader
-import com.atlarge.opendc.workflows.service.stage.job.NullJobAdmissionPolicy
-import com.atlarge.opendc.workflows.service.stage.job.SubmissionTimeJobOrderPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.FirstFitResourceSelectionPolicy
-import com.atlarge.opendc.workflows.service.stage.resource.FunctionalResourceFilterPolicy
-import com.atlarge.opendc.workflows.service.stage.task.NullTaskEligibilityPolicy
-import com.atlarge.opendc.workflows.service.stage.task.SubmissionTimeTaskOrderPolicy
-import java.util.ServiceLoader
-import kotlin.math.max
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Assertions.assertNotEquals
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
+import org.opendc.compute.metal.service.ProvisioningService
+import org.opendc.format.environment.sc18.Sc18EnvironmentReader
+import org.opendc.format.trace.gwf.GwfTraceReader
+import org.opendc.simulator.utils.DelayControllerClockAdapter
+import org.opendc.workflows.service.stage.job.NullJobAdmissionPolicy
+import org.opendc.workflows.service.stage.job.SubmissionTimeJobOrderPolicy
+import org.opendc.workflows.service.stage.resource.FirstFitResourceSelectionPolicy
+import org.opendc.workflows.service.stage.resource.FunctionalResourceFilterPolicy
+import org.opendc.workflows.service.stage.task.NullTaskEligibilityPolicy
+import org.opendc.workflows.service.stage.task.SubmissionTimeTaskOrderPolicy
+import kotlin.math.max
/**
* Integration test suite for the [StageWorkflowService].
*/
@DisplayName("StageWorkflowService")
+@OptIn(ExperimentalCoroutinesApi::class)
internal class StageWorkflowSchedulerIntegrationTest {
/**
* A large integration test where we check whether all tasks in some trace are executed correctly.
@@ -63,16 +64,16 @@ internal class StageWorkflowSchedulerIntegrationTest {
var tasksStarted = 0L
var tasksFinished = 0L
- val provider = ServiceLoader.load(SimulationEngineProvider::class.java).first()
- val system = provider(name = "sim")
+ val testScope = TestCoroutineScope()
+ val clock = DelayControllerClockAdapter(testScope)
- val schedulerDomain = system.newDomain(name = "scheduler")
- val schedulerAsync = schedulerDomain.async {
+ val schedulerAsync = testScope.async {
val environment = Sc18EnvironmentReader(object {}.javaClass.getResourceAsStream("/environment.json"))
- .use { it.construct(system.newDomain("topology")) }
+ .use { it.construct(testScope, clock) }
StageWorkflowService(
- schedulerDomain,
+ testScope,
+ clock,
environment.platforms[0].zones[0].services[ProvisioningService],
mode = WorkflowSchedulerMode.Batch(100),
jobAdmissionPolicy = NullJobAdmissionPolicy,
@@ -84,9 +85,7 @@ internal class StageWorkflowSchedulerIntegrationTest {
)
}
- val broker = system.newDomain(name = "broker")
-
- broker.launch {
+ testScope.launch {
val scheduler = schedulerAsync.await()
scheduler.events
.onEach { event ->
@@ -100,24 +99,21 @@ internal class StageWorkflowSchedulerIntegrationTest {
.collect()
}
- broker.launch {
- val ctx = simulationContext
+ testScope.launch {
val reader = GwfTraceReader(object {}.javaClass.getResourceAsStream("/trace.gwf"))
val scheduler = schedulerAsync.await()
while (reader.hasNext()) {
val (time, job) = reader.next()
jobsSubmitted++
- delay(max(0, time * 1000 - ctx.clock.millis()))
+ delay(max(0, time * 1000 - clock.millis()))
scheduler.submit(job)
}
}
- runBlocking {
- system.run()
- system.terminate()
- }
+ testScope.advanceUntilIdle()
+ assertNotEquals(0, jobsSubmitted, "No jobs submitted")
assertEquals(jobsSubmitted, jobsStarted, "Not all submitted jobs started")
assertEquals(jobsSubmitted, jobsFinished, "Not all started jobs finished")
assertEquals(tasksStarted, tasksFinished, "Not all started tasks finished")
diff --git a/simulator/opendc/opendc-workflows/src/test/resources/environment.json b/simulator/opendc-workflows/src/test/resources/environment.json
index 0965b250..0965b250 100644
--- a/simulator/opendc/opendc-workflows/src/test/resources/environment.json
+++ b/simulator/opendc-workflows/src/test/resources/environment.json
diff --git a/simulator/opendc/opendc-workflows/src/test/resources/trace.gwf b/simulator/opendc-workflows/src/test/resources/trace.gwf
index d264b9c3..d264b9c3 100644
--- a/simulator/opendc/opendc-workflows/src/test/resources/trace.gwf
+++ b/simulator/opendc-workflows/src/test/resources/trace.gwf
diff --git a/simulator/opendc/README.md b/simulator/opendc/README.md
deleted file mode 100644
index e3c65ba7..00000000
--- a/simulator/opendc/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-<h1 align="center">
- <a href="http://opendc.org/">
- <img src="../misc/artwork/logo.png" width="100" alt="OpenDC">
- </a>
- <br>
- OpenDC
-</h1>
-
diff --git a/simulator/opendc/build.gradle.kts b/simulator/opendc/build.gradle.kts
deleted file mode 100644
index cc3f3add..00000000
--- a/simulator/opendc/build.gradle.kts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2019 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.
- */
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/VmImage.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/VmImage.kt
deleted file mode 100644
index c615d865..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/image/VmImage.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.atlarge.opendc.compute.core.image
-
-import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.execution.ServerContext
-import com.atlarge.opendc.core.resource.TagContainer
-import java.util.UUID
-import kotlin.math.min
-
-class VmImage(
- public override val uid: UUID,
- public override val name: String,
- public override val tags: TagContainer,
- public val flopsHistory: Sequence<FlopsHistoryFragment>,
- public val maxCores: Int,
- public val requiredMemory: Long
-) : Image {
-
- override suspend fun invoke(ctx: ServerContext) {
- val clock = simulationContext.clock
- var offset = clock.millis()
-
- val batch = flopsHistory.map { fragment ->
- val cores = min(fragment.cores, ctx.server.flavor.cpuCount)
- val burst = LongArray(cores) { fragment.flops / cores }
- val usage = DoubleArray(cores) { fragment.usage / cores }
- offset += fragment.duration
- ServerContext.Slice(burst, usage, offset)
- }
-
- ctx.run(batch)
- }
-
- override fun toString(): String = "VmImage(uid=$uid, name=$name, cores=$maxCores, requiredMemory=$requiredMemory)"
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/VmWorkload.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/VmWorkload.kt
deleted file mode 100644
index 098eb8ca..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/VmWorkload.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.atlarge.opendc.compute.core.workload
-
-import com.atlarge.opendc.compute.core.image.VmImage
-import com.atlarge.opendc.core.User
-import com.atlarge.opendc.core.workload.Workload
-import java.util.UUID
-
-/**
- * A workload that represents a VM.
- *
- * @property uid A unique identified of this VM.
- * @property name The name of this VM.
- * @property owner The owner of the VM.
- * @property image The image of the VM.
- */
-data class VmWorkload(
- override val uid: UUID,
- override val name: String,
- override val owner: User,
- val image: VmImage
-) : Workload {
- override fun equals(other: Any?): Boolean = other is VmWorkload && uid == other.uid
-
- override fun hashCode(): Int = uid.hashCode()
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/HypervisorView.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/HypervisorView.kt
deleted file mode 100644
index e52a1698..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/HypervisorView.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.atlarge.opendc.compute.virt.service
-
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import java.util.UUID
-
-class HypervisorView(
- val uid: UUID,
- var server: Server,
- var numberOfActiveServers: Int,
- var availableMemory: Long,
- var provisionedCores: Int
-) {
- lateinit var driver: VirtDriver
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningService.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningService.kt
deleted file mode 100644
index c4cbd711..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/VirtProvisioningService.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.atlarge.opendc.compute.virt.service
-
-import com.atlarge.opendc.compute.core.Flavor
-import com.atlarge.opendc.compute.core.Server
-import com.atlarge.opendc.compute.core.image.Image
-import com.atlarge.opendc.compute.virt.driver.VirtDriver
-import com.atlarge.opendc.compute.virt.service.allocation.AllocationPolicy
-import kotlinx.coroutines.flow.Flow
-
-/**
- * A service for VM provisioning on a cloud.
- */
-interface VirtProvisioningService {
- /**
- * The policy used for allocating a VM on the available hypervisors.
- */
- val allocationPolicy: AllocationPolicy
-
- /**
- * The events emitted by the service.
- */
- public val events: Flow<VirtProvisioningEvent>
-
- /**
- * Obtain the active hypervisors for this provisioner.
- */
- public suspend fun drivers(): Set<VirtDriver>
-
- /**
- * Submit the specified [Image] to the provisioning service.
- *
- * @param name The name of the server to deploy.
- * @param image The image to be deployed.
- * @param flavor The flavor of the machine instance to run this [image] on.
- */
- public suspend fun deploy(name: String, image: Image, flavor: Flavor): Server
-
- /**
- * Terminate the provisioning service releasing all the leased bare-metal machines.
- */
- public suspend fun terminate()
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AllocationPolicy.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AllocationPolicy.kt
deleted file mode 100644
index b7c9388d..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AllocationPolicy.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.atlarge.opendc.compute.virt.service.allocation
-
-import com.atlarge.opendc.compute.metal.Node
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService
-
-/**
- * A policy for selecting the [Node] an image should be deployed to,
- */
-public interface AllocationPolicy {
- /**
- * The logic of the allocation policy.
- */
- public interface Logic {
- /**
- * Select the node on which the server should be scheduled.
- */
- public fun select(hypervisors: Set<HypervisorView>, image: SimpleVirtProvisioningService.ImageView): HypervisorView?
- }
-
- /**
- * Builds the logic of the policy.
- */
- operator fun invoke(): Logic
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt
deleted file mode 100644
index c081244f..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/AvailableMemoryAllocationPolicy.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.atlarge.opendc.compute.virt.service.allocation
-
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-
-/**
- * Allocation policy that selects the node with the most available memory.
- *
- * @param reversed A flag to reverse the order (least amount of memory scores the best).
- */
-public class AvailableMemoryAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy {
- override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic {
- override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { -it.availableMemory }
- .run { if (reversed) reversed() else this }
- }
-}
diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt
deleted file mode 100644
index 7e3e5864..00000000
--- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/allocation/NumberOfActiveServersAllocationPolicy.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.atlarge.opendc.compute.virt.service.allocation
-
-import com.atlarge.opendc.compute.virt.service.HypervisorView
-
-/**
- * Allocation policy that selects the node with the least amount of active servers.
- *
- * @param reversed A flag to reverse the order, such that the node with the most active servers is selected.
- */
-public class NumberOfActiveServersAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy {
- override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic {
- override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { it.numberOfActiveServers }
- .run { if (reversed) reversed() else this }
- }
-}
diff --git a/simulator/opendc/opendc-core/build.gradle.kts b/simulator/opendc/opendc-core/build.gradle.kts
deleted file mode 100644
index 45c38ffd..00000000
--- a/simulator/opendc/opendc-core/build.gradle.kts
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2017 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.
- */
-
-description = "Base model for topology simulation"
-
-/* Build configuration */
-plugins {
- `kotlin-library-convention`
-}
-
-dependencies {
- api(project(":odcsim:odcsim-api"))
-
- testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}")
- testImplementation("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}")
-}
diff --git a/simulator/opendc/opendc-format/src/test/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReaderTest.kt b/simulator/opendc/opendc-format/src/test/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReaderTest.kt
deleted file mode 100644
index 94e4b0fc..00000000
--- a/simulator/opendc/opendc-format/src/test/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReaderTest.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.atlarge.opendc.format.trace.swf
-
-import java.io.File
-import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.Test
-
-class SwfTraceReaderTest {
- @Test
- internal fun testParseSwf() {
- val reader = SwfTraceReader(File(SwfTraceReaderTest::class.java.getResource("/swf_trace.txt").toURI()))
- var entry = reader.next()
- assertEquals(0, entry.submissionTime)
- // 1961 slices for waiting, 3 full and 1 partial running slices
- assertEquals(1965, entry.workload.image.flopsHistory.toList().size)
-
- entry = reader.next()
- assertEquals(164472, entry.submissionTime)
- // 1188 slices for waiting, 0 full and 1 partial running slices
- assertEquals(1189, entry.workload.image.flopsHistory.toList().size)
- assertEquals(5_100_000L, entry.workload.image.flopsHistory.toList().last().flops)
- assertEquals(0.25, entry.workload.image.flopsHistory.toList().last().usage)
- }
-}
diff --git a/simulator/settings.gradle.kts b/simulator/settings.gradle.kts
index 9411d882..e5e218b8 100644
--- a/simulator/settings.gradle.kts
+++ b/simulator/settings.gradle.kts
@@ -1,7 +1,5 @@
/*
- * MIT License
- *
- * Copyright (c) 2017 atlarge-research
+ * Copyright (c) 2017 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
@@ -23,12 +21,12 @@
*/
rootProject.name = "opendc-simulator"
-include(":odcsim:odcsim-api")
-include(":odcsim:odcsim-engine-omega")
-include(":opendc:opendc-core")
-include(":opendc:opendc-compute")
-include(":opendc:opendc-format")
-include(":opendc:opendc-workflows")
-include(":opendc:opendc-experiments-sc18")
-include(":opendc:opendc-experiments-sc20")
-include(":opendc:opendc-runner-web")
+include(":opendc-core")
+include(":opendc-compute")
+include(":opendc-workflows")
+include(":opendc-format")
+include(":opendc-experiments:opendc-experiments-sc18")
+include(":opendc-experiments:opendc-experiments-sc20")
+include(":opendc-runner-web")
+include(":opendc-simulator")
+include(":opendc-utils")