diff options
128 files changed, 396 insertions, 395 deletions
diff --git a/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts b/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts index c0c37a09..452db573 100644 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts @@ -40,6 +40,10 @@ java { sourceCompatibility = JavaVersion.VERSION_1_8 } +kotlin { + explicitApi() +} + tasks.withType<KotlinCompile>().configureEach { kotlinOptions.jvmTarget = "1.8" kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" @@ -56,7 +60,3 @@ tasks.jacocoTestReport { html.isEnabled = true } } - -dependencies { - implementation(kotlin("stdlib")) -} diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt index 23c82816..7e4694d4 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/ProcessingNode.kt @@ -32,9 +32,9 @@ package org.opendc.compute.core * @property arch The micro-architecture of the processor node. * @property coreCount The number of logical CPUs in the processor node. */ -data class ProcessingNode( - val vendor: String, - val arch: String, - val modelName: String, - val coreCount: Int +public data class ProcessingNode( + public val vendor: String, + public val arch: String, + public val modelName: String, + public val coreCount: Int ) diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt index 3cab94c0..9674c98d 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/execution/ServerContext.kt @@ -65,7 +65,7 @@ public interface ServerContext { * @param slice The representation of work to run on the processors. * @param triggerMode The trigger condition to resume execution. */ - public suspend fun run(slice: Slice, triggerMode: TriggerMode = TriggerMode.FIRST) = + public suspend fun run(slice: Slice, triggerMode: TriggerMode = TriggerMode.FIRST): Unit = select<Unit> { onRun(slice, triggerMode).invoke {} } /** @@ -88,7 +88,7 @@ public interface ServerContext { batch: Sequence<Slice>, triggerMode: TriggerMode = TriggerMode.FIRST, merge: (Slice, Slice) -> Slice = { _, r -> r } - ) = select<Unit> { onRun(batch, triggerMode, merge).invoke {} } + ): Unit = select<Unit> { onRun(batch, triggerMode, merge).invoke {} } /** * Ask the processor cores to run the specified [slice] and select when the trigger condition is met as specified @@ -137,7 +137,7 @@ public interface ServerContext { * @param limit The maximum usage in terms of MHz that the processing core may use while running the burst. * @param deadline The instant at which this slice needs to be fulfilled. */ - public class Slice(val burst: LongArray, val limit: DoubleArray, val deadline: Long) { + public class Slice(public val burst: LongArray, public val limit: DoubleArray, public val deadline: Long) { init { require(burst.size == limit.size) { "Incompatible array dimensions" } } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt index 1f760978..2b9158bf 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/EmptyImage.kt @@ -29,7 +29,7 @@ import java.util.UUID /** * An empty boot disk [Image] that exits immediately on start. */ -object EmptyImage : Image { +public object EmptyImage : Image { override val uid: UUID = UUID.randomUUID() override val name: String = "empty" override val tags: TagContainer = emptyMap() diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt index 9a95520e..58c00e13 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsApplicationImage.kt @@ -38,7 +38,7 @@ import kotlin.math.min * @property cores The number of cores that the image is able to utilize. * @property utilization A model of the CPU utilization of the application. */ -data class FlopsApplicationImage( +public data class FlopsApplicationImage( public override val uid: UUID, public override val name: String, public override val tags: TagContainer, diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsHistoryFragment.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/image/FlopsHistoryFragment.kt index 7097c818..5472e4e0 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/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 org.opendc.compute.core.image -data class FlopsHistoryFragment(val tick: Long, val flops: Long, val duration: Long, val usage: Double, val cores: Int) +public data class FlopsHistoryFragment(val tick: Long, val flops: Long, val duration: Long, val usage: Double, val cores: Int) 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 index b6622fa4..72efbe0b 100644 --- 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 @@ -27,7 +27,7 @@ import org.opendc.core.resource.TagContainer import java.util.* import kotlin.math.min -class VmImage( +public class VmImage( public override val uid: UUID, public override val name: String, public override val tags: TagContainer, diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt index f84366b2..7956c095 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/core/workload/PerformanceInterferenceModel.kt @@ -29,26 +29,26 @@ import kotlin.random.Random /** * Meta-data key for the [PerformanceInterferenceModel] of an image. */ -const val IMAGE_PERF_INTERFERENCE_MODEL = "image:performance-interference" +public const val IMAGE_PERF_INTERFERENCE_MODEL: String = "image:performance-interference" /** * Performance Interference Model describing the variability incurred by different sets of workloads if colocated. * * @param items The [PerformanceInterferenceModelItem]s that make up this model. */ -class PerformanceInterferenceModel( - val items: SortedSet<PerformanceInterferenceModelItem>, - val random: Random = Random(0) +public class PerformanceInterferenceModel( + public val items: SortedSet<PerformanceInterferenceModelItem>, + private val random: Random = Random(0) ) { private var intersectingItems: List<PerformanceInterferenceModelItem> = emptyList() private val colocatedWorkloads = TreeMap<String, Int>() - fun vmStarted(server: Server) { + internal fun vmStarted(server: Server) { colocatedWorkloads.merge(server.image.name, 1, Int::plus) intersectingItems = items.filter { item -> doesMatch(item) } } - fun vmStopped(server: Server) { + internal fun vmStopped(server: Server) { colocatedWorkloads.computeIfPresent(server.image.name) { _, v -> (v - 1).takeUnless { it == 0 } } intersectingItems = items.filter { item -> doesMatch(item) } } @@ -68,7 +68,7 @@ class PerformanceInterferenceModel( return false } - fun apply(currentServerLoad: Double): Double { + internal fun apply(currentServerLoad: Double): Double { if (intersectingItems.isEmpty()) { return 1.0 } @@ -92,10 +92,10 @@ class PerformanceInterferenceModel( * @param performanceScore The performance score that should be applied to each workload's performance. 1 means no * influence, <1 means that performance degrades, and >1 means that performance improves. */ -data class PerformanceInterferenceModelItem( - val workloadNames: SortedSet<String>, - val minServerLoad: Double, - val performanceScore: Double +public data class PerformanceInterferenceModelItem( + public val workloadNames: SortedSet<String>, + public val minServerLoad: Double, + public val performanceScore: Double ) : Comparable<PerformanceInterferenceModelItem> { override fun equals(other: Any?): Boolean { if (this === other) 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 index d8edb416..6ab8da2a 100644 --- 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 @@ -35,7 +35,7 @@ import java.util.UUID * @property owner The owner of the VM. * @property image The image of the VM. */ -data class VmWorkload( +public data class VmWorkload( override val uid: UUID, override val name: String, override val owner: User, diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt index 389f4ab9..61a992b2 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/Metadata.kt @@ -31,4 +31,4 @@ package org.opendc.compute.metal /** * The cluster to which the node belongs. */ -const val NODE_CLUSTER = "bare-metal:cluster" +public const val NODE_CLUSTER: String = "bare-metal:cluster" diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt index 2d7ba2ed..5d8521ae 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/BareMetalDriver.kt @@ -82,5 +82,5 @@ public interface BareMetalDriver : Powerable, FailureDomain { /** * A key that allows access to the [BareMetalDriver] instance from a [Server] that runs on the bare-metal machine. */ - companion object Key : AbstractServiceKey<BareMetalDriver>(UUID.randomUUID(), "bare-metal:driver") + public companion object Key : AbstractServiceKey<BareMetalDriver>(UUID.randomUUID(), "bare-metal:driver") } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt index 98ba8994..817528f6 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/driver/SimpleBareMetalDriver.kt @@ -83,8 +83,8 @@ public class SimpleBareMetalDriver( uid: UUID, name: String, metadata: Map<String, Any>, - val cpus: List<ProcessingUnit>, - val memoryUnits: List<MemoryUnit>, + private val cpus: List<ProcessingUnit>, + private val memoryUnits: List<MemoryUnit>, powerModel: PowerModel<SimpleBareMetalDriver> = ConstantPowerModel( 0.0 ) diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt index 9b056adf..c8b38912 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/metal/service/ProvisioningService.kt @@ -60,5 +60,5 @@ public interface ProvisioningService { /** * The service key of this service. */ - companion object Key : AbstractServiceKey<ProvisioningService>(UUID.randomUUID(), "provisioner") + public companion object Key : AbstractServiceKey<ProvisioningService>(UUID.randomUUID(), "provisioner") } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt index 84d26593..ff88f0dc 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/HypervisorImage.kt @@ -34,7 +34,7 @@ import java.util.UUID /** * A hypervisor managing the VMs of a node. */ -object HypervisorImage : Image { +public object HypervisorImage : Image { override val uid: UUID = UUID.randomUUID() override val name: String = "vmm" override val tags: TagContainer = emptyMap() diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt index 4d39dc4b..fb3d5f84 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/SimpleVirtDriver.kt @@ -60,14 +60,14 @@ private val logger = KotlinLogging.logger {} * A [VirtDriver] that is backed by a simple hypervisor implementation. */ @OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class) -class SimpleVirtDriver( +public class SimpleVirtDriver( private val hostContext: ServerContext, scope: CoroutineScope ) : VirtDriver, CoroutineScope by scope { /** * The [Server] on which this hypervisor runs. */ - val server: Server + public val server: Server get() = hostContext.server /** diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt index b169a00b..9663f4da 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/driver/VirtDriver.kt @@ -54,5 +54,5 @@ public interface VirtDriver { flavor: Flavor ): Server - companion object Key : AbstractServiceKey<VirtDriver>(UUID.randomUUID(), "virtual-driver") + public 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 index 197b4392..cf6b4487 100644 --- 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 @@ -26,12 +26,12 @@ 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 +public class HypervisorView( + public val uid: UUID, + public var server: Server, + public var numberOfActiveServers: Int, + public var availableMemory: Long, + public var provisionedCores: Int ) { - lateinit var driver: VirtDriver + public lateinit var driver: VirtDriver } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt index c5d2fd66..3141529f 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/SimpleVirtProvisioningService.kt @@ -49,7 +49,7 @@ import kotlin.math.max private val logger = KotlinLogging.logger {} @OptIn(ExperimentalCoroutinesApi::class) -class SimpleVirtProvisioningService( +public class SimpleVirtProvisioningService( private val coroutineScope: CoroutineScope, private val clock: Clock, private val provisioningService: ProvisioningService, @@ -75,11 +75,11 @@ class SimpleVirtProvisioningService( */ private val activeImages: MutableSet<ImageView> = mutableSetOf() - var submittedVms = 0 - var queuedVms = 0 - var runningVms = 0 - var finishedVms = 0 - var unscheduledVms = 0 + public var submittedVms: Int = 0 + public var queuedVms: Int = 0 + public var runningVms: Int = 0 + public var finishedVms: Int = 0 + public var unscheduledVms: Int = 0 private var maxCores = 0 private var maxMemory = 0L @@ -370,11 +370,11 @@ class SimpleVirtProvisioningService( } } - data class ImageView( - val name: String, - val image: Image, - val flavor: Flavor, - val continuation: Continuation<Server>, - var server: Server? = null + public data class ImageView( + public val name: String, + public val image: Image, + public val flavor: Flavor, + public val continuation: Continuation<Server>, + public var server: Server? = null ) } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt index 13930320..31f5d2c9 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningEvent.kt @@ -36,7 +36,7 @@ public sealed class VirtProvisioningEvent { /** * An event emitted for writing metrics. */ - data class MetricsAvailable( + public data class MetricsAvailable( override val provisioner: VirtProvisioningService, public val totalHostCount: Int, public val availableHostCount: Int, diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt index a111603f..7ed577c4 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/VirtProvisioningService.kt @@ -32,11 +32,11 @@ import org.opendc.compute.virt.service.allocation.AllocationPolicy /** * A service for VM provisioning on a cloud. */ -interface VirtProvisioningService { +public interface VirtProvisioningService { /** * The policy used for allocating a VM on the available hypervisors. */ - val allocationPolicy: AllocationPolicy + public val allocationPolicy: AllocationPolicy /** * The events emitted by the service. 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 index c2f730b9..099d1740 100644 --- 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 @@ -46,5 +46,5 @@ public interface AllocationPolicy { /** * Builds the logic of the policy. */ - operator fun invoke(): Logic + public operator fun invoke(): Logic } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt index 80debff7..cfbf3cd3 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/AvailableCoreMemoryAllocationPolicy.kt @@ -29,7 +29,7 @@ import org.opendc.compute.virt.service.HypervisorView * * @param reversed An option to reverse the order of the machines (lower amount of memory scores better). */ -public class AvailableCoreMemoryAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy { +public class AvailableCoreMemoryAllocationPolicy(private val reversed: Boolean = false) : AllocationPolicy { override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic { override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { -it.availableMemory / it.server.flavor.cpuCount } 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 index 259077aa..48172765 100644 --- 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 @@ -29,7 +29,7 @@ import org.opendc.compute.virt.service.HypervisorView * * @param reversed A flag to reverse the order (least amount of memory scores the best). */ -public class AvailableMemoryAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy { +public class AvailableMemoryAllocationPolicy(public 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-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt index 4bccaef8..8803009d 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ComparableAllocationPolicyLogic.kt @@ -29,7 +29,7 @@ import org.opendc.compute.virt.service.SimpleVirtProvisioningService /** * The logic for an [AllocationPolicy] that uses a [Comparator] to select the appropriate node. */ -interface ComparableAllocationPolicyLogic : AllocationPolicy.Logic { +public interface ComparableAllocationPolicyLogic : AllocationPolicy.Logic { /** * The comparator to use. */ 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 index c385e686..63ba64ce 100644 --- 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 @@ -29,7 +29,7 @@ import org.opendc.compute.virt.service.HypervisorView * * @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 { +public class NumberOfActiveServersAllocationPolicy(public 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-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt index f5d4abc5..d76e9c82 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ProvisionedCoresAllocationPolicy.kt @@ -31,7 +31,7 @@ import org.opendc.compute.virt.service.HypervisorView * @param reversed A flag to reverse the order of the policy, such that the machine with the most provisioned cores * is selected. */ -class ProvisionedCoresAllocationPolicy(val reversed: Boolean = false) : AllocationPolicy { +public class ProvisionedCoresAllocationPolicy(private val reversed: Boolean = false) : AllocationPolicy { override fun invoke(): AllocationPolicy.Logic = object : ComparableAllocationPolicyLogic { override val comparator: Comparator<HypervisorView> = compareBy<HypervisorView> { it.provisionedCores / it.server.flavor.cpuCount } diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt index d40b2bc2..d143ffe6 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/RandomAllocationPolicy.kt @@ -30,7 +30,7 @@ import kotlin.random.Random /** * An [AllocationPolicy] that select a random node on which the server fits. */ -public class RandomAllocationPolicy(val random: Random = Random(0)) : AllocationPolicy { +public class RandomAllocationPolicy(private val random: Random = Random(0)) : AllocationPolicy { @OptIn(ExperimentalStdlibApi::class) override fun invoke(): AllocationPolicy.Logic = object : AllocationPolicy.Logic { override fun select( diff --git a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt index fb086027..a623633d 100644 --- a/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt +++ b/simulator/opendc-compute/src/main/kotlin/org/opendc/compute/virt/service/allocation/ReplayAllocationPolicy.kt @@ -34,7 +34,7 @@ private val logger = KotlinLogging.logger {} * Within each cluster, the active servers on each node determine which node gets * assigned the VM image. */ -class ReplayAllocationPolicy(val vmPlacements: Map<String, String>) : AllocationPolicy { +public class ReplayAllocationPolicy(private val vmPlacements: Map<String, String>) : AllocationPolicy { override fun invoke(): AllocationPolicy.Logic = object : AllocationPolicy.Logic { override fun select( hypervisors: Set<HypervisorView>, diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt index 3baef092..a5055cff 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt @@ -31,4 +31,4 @@ package org.opendc.core * @property description A small textual description about the environment that is being modeled. * @property platforms The cloud platforms (such as AWS or GCE) in this environment. */ -data class Environment(val name: String, val description: String?, val platforms: List<Platform>) +public data class Environment(val name: String, val description: String?, val platforms: List<Platform>) diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt index 9c1464af..252c40f5 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt @@ -27,14 +27,14 @@ import java.util.* /** * An object that has a unique identity. */ -interface Identity { +public interface Identity { /** * A unique, opaque, system-generated value, representing the object. */ - val uid: UUID + public val uid: UUID /** * A non-empty, human-readable string representing the object. */ - val name: String + public val name: String } diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt index 076df255..5550ffed 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt @@ -31,4 +31,4 @@ import java.util.* * @property name the name of the platform. * @property zones The availability zones available on this platform. */ -data class Platform(override val uid: UUID, override val name: String, val zones: List<Zone>) : Identity +public data class Platform(override val uid: UUID, override val name: String, val zones: List<Zone>) : Identity diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt index d4b237e7..fc542cef 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt @@ -25,7 +25,7 @@ package org.opendc.core /** * A user of the cloud network. */ -interface User : Identity { +public interface User : Identity { /** * The name of the user. */ diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt index 0bca4ee5..834f6cf2 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt @@ -36,7 +36,7 @@ import java.util.* * @property name The name of the zone within its platform. * @property services The service registry containing the services of the zone. */ -data class Zone( +public data class Zone( override val uid: UUID, override val name: String, val services: ServiceRegistry diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt index 6c019763..f64b8815 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/failure/UncorrelatedFaultInjector.kt @@ -33,7 +33,7 @@ import kotlin.random.Random * A [FaultInjector] that injects uncorrelated faults into the system, meaning that failures of the subsystems are * independent. */ -class UncorrelatedFaultInjector( +public class UncorrelatedFaultInjector( private val clock: Clock, private val alpha: Double, private val beta: Double, diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt index 4a225d9d..4b73ad92 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/power/Powerable.kt @@ -33,5 +33,5 @@ public interface Powerable { /** * The power draw at the device's power supply in watts (W).w */ - val powerDraw: Flow<Double> + public val powerDraw: Flow<Double> } diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt index 842710d2..6a4ff102 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt @@ -25,10 +25,10 @@ package org.opendc.core.resource /** * An immutable map containing the tags of some resource. */ -typealias TagContainer = Map<String, Any> +public typealias TagContainer = Map<String, Any> /** * Obtain the value of the tag with the specified [key] of type [T]. If the tag does not exist or the tag is of * different type, `null` is returned. */ -inline fun <reified T : Any> TagContainer.typed(key: String): T? = this[key] as? T +public inline fun <reified T : Any> TagContainer.typed(key: String): T? = this[key] as? T diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt index 6d475f87..9078ecdd 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt @@ -30,7 +30,7 @@ import java.util.* * * @param T The shape of the messages the service responds to. */ -interface ServiceKey<T : Any> : Identity +public interface ServiceKey<T : Any> : Identity /** * Helper class for constructing a [ServiceKey]. @@ -38,7 +38,7 @@ interface ServiceKey<T : Any> : Identity * @property uid The unique identifier of the service. * @property name The name of the service. */ -abstract class AbstractServiceKey<T : Any>(override val uid: UUID, override val name: String) : ServiceKey<T> { +public abstract class AbstractServiceKey<T : Any>(override val uid: UUID, override val name: String) : ServiceKey<T> { override fun equals(other: Any?): Boolean = other is ServiceKey<*> && uid == other.uid override fun hashCode(): Int = uid.hashCode() override fun toString(): String = "ServiceKey[uid=$uid, name=$name]" diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt index 656020ef..f0bd1137 100644 --- a/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt +++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt @@ -29,9 +29,9 @@ import org.opendc.core.User * A high-level abstraction that represents the actual work that a set of compute resources perform, such * as running an application on a machine or a whole workflow running multiple tasks on numerous machines. */ -interface Workload : Identity { +public interface Workload : Identity { /** * The owner of this workload. */ - val owner: User + public val owner: User } diff --git a/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt index 18dce054..4aef5be3 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc18/src/main/kotlin/org/opendc/experiments/sc18/TestExperiment.kt @@ -47,7 +47,7 @@ import kotlin.math.max * Main entry point of the experiment. */ @OptIn(ExperimentalCoroutinesApi::class) -fun main(args: Array<String>) { +public fun main(args: Array<String>) { if (args.isEmpty()) { println("error: Please provide path to GWF trace") return diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt index 9f096038..b7bb0c23 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/Main.kt @@ -51,7 +51,7 @@ private val logger = KotlinLogging.logger {} /** * Represents the command for running the experiment. */ -class ExperimentCli : CliktCommand(name = "sc20-experiment", help = "Run experiments from the Capelin paper") { +public class ExperimentCli : CliktCommand(name = "sc20-experiment") { /** * The path to the directory where the topology descriptions are located. */ @@ -157,4 +157,4 @@ class ExperimentCli : CliktCommand(name = "sc20-experiment", help = "Run experim /** * Main entry point of the experiment. */ -fun main(args: Array<String>) = ExperimentCli().main(args) +public fun main(args: Array<String>): Unit = ExperimentCli().main(args) diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt index e93d8c1e..34d7301b 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Experiment.kt @@ -42,12 +42,12 @@ import java.io.File * @param bufferSize The buffer size of the event reporters. */ public abstract class Experiment( - val environments: File, - val traces: File, - val output: File, - val performanceInterferenceModel: PerformanceInterferenceModelReader?, - val vmPlacements: Map<String, String>, - val bufferSize: Int + public val environments: File, + public val traces: File, + public val output: File, + public val performanceInterferenceModel: PerformanceInterferenceModelReader?, + public val vmPlacements: Map<String, String>, + public val bufferSize: Int ) : ContainerExperimentDescriptor() { override val parent: ExperimentDescriptor? = null diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt index c2e5b619..97d7d5da 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/ExperimentHelpers.kt @@ -65,7 +65,7 @@ private val logger = KotlinLogging.logger {} /** * Construct the failure domain for the experiments. */ -suspend fun createFailureDomain( +public suspend fun createFailureDomain( coroutineScope: CoroutineScope, clock: Clock, seed: Int, @@ -97,7 +97,7 @@ suspend fun createFailureDomain( /** * Obtain the [FaultInjector] to use for the experiments. */ -fun createFaultInjector( +public fun createFaultInjector( coroutineScope: CoroutineScope, clock: Clock, random: Random, @@ -118,7 +118,7 @@ fun createFaultInjector( /** * Create the trace reader from which the VM workloads are read. */ -fun createTraceReader( +public fun createTraceReader( path: File, performanceInterferenceModel: PerformanceInterferenceModel, vms: List<String>, @@ -135,7 +135,7 @@ fun createTraceReader( /** * Construct the environment for a VM provisioner and return the provisioner instance. */ -suspend fun createProvisioner( +public suspend fun createProvisioner( coroutineScope: CoroutineScope, clock: Clock, environmentReader: EnvironmentReader, @@ -159,12 +159,13 @@ suspend fun createProvisioner( * Attach the specified monitor to the VM provisioner. */ @OptIn(ExperimentalCoroutinesApi::class) -suspend fun attachMonitor( +public suspend fun attachMonitor( coroutineScope: CoroutineScope, clock: Clock, scheduler: SimpleVirtProvisioningService, monitor: ExperimentMonitor ) { + val hypervisors = scheduler.drivers() // Monitor hypervisor events @@ -218,7 +219,7 @@ suspend fun attachMonitor( /** * Process the trace. */ -suspend fun processTrace( +public suspend fun processTrace( coroutineScope: CoroutineScope, clock: Clock, reader: TraceReader<VmWorkload>, diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt index fb58e651..37cf2880 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolio.kt @@ -32,8 +32,8 @@ import org.opendc.experiments.sc20.runner.ContainerExperimentDescriptor */ public abstract class Portfolio( override val parent: Experiment, - val id: Int, - val name: String + public val id: Int, + public val name: String ) : ContainerExperimentDescriptor() { /** * The topologies to consider. @@ -58,7 +58,7 @@ public abstract class Portfolio( /** * The number of repetitions to perform. */ - open val repetitions: Int = 32 + public open val repetitions: Int = 32 /** * Resolve the children of this container. diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt index 53d6fc21..249a63b9 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Portfolios.kt @@ -25,7 +25,7 @@ package org.opendc.experiments.sc20.experiment import org.opendc.experiments.sc20.experiment.model.* public class HorVerPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "horizontal_vs_vertical") { - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base"), Topology("rep-vol-hor-hom"), Topology("rep-vol-hor-het"), @@ -37,24 +37,24 @@ public class HorVerPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id Topology("exp-vol-ver-het") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( Workload("solvinity", 0.1), Workload("solvinity", 0.25), Workload("solvinity", 0.5), Workload("solvinity", 1.0) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = true) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "active-servers" ) } public class MoreVelocityPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "more_velocity") { - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base"), Topology("rep-vel-ver-hom"), Topology("rep-vel-ver-het"), @@ -62,18 +62,18 @@ public class MoreVelocityPortfolio(parent: Experiment, id: Int) : Portfolio(pare Topology("exp-vel-ver-het") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( Workload("solvinity", 0.1), Workload("solvinity", 0.25), Workload("solvinity", 0.5), Workload("solvinity", 1.0) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = true) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "active-servers" ) } @@ -81,14 +81,14 @@ public class MoreVelocityPortfolio(parent: Experiment, id: Int) : Portfolio(pare public class CompositeWorkloadPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "composite-workload") { private val totalSampleLoad = 1.3301733005049648E12 - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base"), Topology("exp-vol-hor-hom"), Topology("exp-vol-ver-hom"), Topology("exp-vel-ver-hom") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( CompositeWorkload( "all-azure", listOf(Workload("solvinity-short", 0.0), Workload("azure", 1.0)), @@ -116,36 +116,36 @@ public class CompositeWorkloadPortfolio(parent: Experiment, id: Int) : Portfolio ) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = false) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "active-servers" ) } public class OperationalPhenomenaPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "operational_phenomena") { - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( Workload("solvinity", 0.1), Workload("solvinity", 0.25), Workload("solvinity", 0.5), Workload("solvinity", 1.0) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = true), OperationalPhenomena(failureFrequency = 0.0, hasInterference = true), OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = false), OperationalPhenomena(failureFrequency = 0.0, hasInterference = false) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "mem", "mem-inv", "core-mem", @@ -157,19 +157,19 @@ public class OperationalPhenomenaPortfolio(parent: Experiment, id: Int) : } public class ReplayPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "replay") { - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( Workload("solvinity", 1.0) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 0.0, hasInterference = false) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "replay", "active-servers" ) @@ -194,14 +194,14 @@ public class TestPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, } public class MoreHpcPortfolio(parent: Experiment, id: Int) : Portfolio(parent, id, "more_hpc") { - override val topologies = listOf( + override val topologies: List<Topology> = listOf( Topology("base"), Topology("exp-vol-hor-hom"), Topology("exp-vol-ver-hom"), Topology("exp-vel-ver-hom") ) - override val workloads = listOf( + override val workloads: List<Workload> = listOf( Workload("solvinity", 0.0, samplingStrategy = SamplingStrategy.HPC), Workload("solvinity", 0.25, samplingStrategy = SamplingStrategy.HPC), Workload("solvinity", 0.5, samplingStrategy = SamplingStrategy.HPC), @@ -211,11 +211,11 @@ public class MoreHpcPortfolio(parent: Experiment, id: Int) : Portfolio(parent, i Workload("solvinity", 1.0, samplingStrategy = SamplingStrategy.HPC_LOAD) ) - override val operationalPhenomenas = listOf( + override val operationalPhenomenas: List<OperationalPhenomena> = listOf( OperationalPhenomena(failureFrequency = 24.0 * 7, hasInterference = true) ) - override val allocationPolicies = listOf( + override val allocationPolicies: List<String> = listOf( "active-servers" ) } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt index 5cffae63..d092ddd5 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/experiment/Scenario.kt @@ -33,12 +33,12 @@ import org.opendc.experiments.sc20.runner.ExperimentDescriptor */ public class Scenario( override val parent: Portfolio, - val id: Int, - val repetitions: Int, - val topology: Topology, - val workload: Workload, - val allocationPolicy: String, - val operationalPhenomena: OperationalPhenomena + public val id: Int, + public val repetitions: Int, + public val topology: Topology, + public val workload: Workload, + public val allocationPolicy: String, + public val operationalPhenomena: OperationalPhenomena ) : ContainerExperimentDescriptor() { override val children: Sequence<ExperimentDescriptor> = sequence { repeat(repetitions) { i -> yield(Run(this@Scenario, i, i)) } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 a9719114..ba95f544 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -22,7 +22,7 @@ package org.opendc.experiments.sc20.experiment.model -enum class SamplingStrategy { +public enum class SamplingStrategy { REGULAR, HPC, HPC_LOAD @@ -32,13 +32,13 @@ 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 val name: String, + public val fraction: Double, + public val samplingStrategy: SamplingStrategy = SamplingStrategy.REGULAR ) /** * A workload that is composed of multiple workloads. */ -public class CompositeWorkload(override val name: String, val workloads: List<Workload>, val totalLoad: Double) : +public class CompositeWorkload(override val name: String, public val workloads: List<Workload>, public val totalLoad: Double) : Workload(name, -1.0) diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 8d41f29e..0ac532a4 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -30,16 +30,16 @@ import java.io.Closeable /** * A monitor watches the events of an experiment. */ -interface ExperimentMonitor : Closeable { +public interface ExperimentMonitor : Closeable { /** * This method is invoked when the state of a VM changes. */ - fun reportVmStateChange(time: Long, server: Server) {} + public fun reportVmStateChange(time: Long, server: Server) {} /** * This method is invoked when the state of a host changes. */ - fun reportHostStateChange( + public fun reportHostStateChange( time: Long, driver: VirtDriver, server: Server @@ -49,12 +49,12 @@ interface ExperimentMonitor : Closeable { /** * Report the power consumption of a host. */ - fun reportPowerConsumption(host: Server, draw: Double) {} + public fun reportPowerConsumption(host: Server, draw: Double) {} /** * This method is invoked for a host for each slice that is finishes. */ - fun reportHostSlice( + public fun reportHostSlice( time: Long, requestedBurst: Long, grantedBurst: Long, @@ -71,5 +71,5 @@ interface ExperimentMonitor : Closeable { /** * This method is invoked for a provisioner event. */ - fun reportProvisionerMetrics(time: Long, event: VirtProvisioningEvent.MetricsAvailable) {} + public fun reportProvisionerMetrics(time: Long, event: VirtProvisioningEvent.MetricsAvailable) {} } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 b1583f87..bb512ef7 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -40,7 +40,7 @@ private val logger = KotlinLogging.logger {} /** * An [ExperimentMonitor] that logs the events to a Parquet file. */ -class ParquetExperimentMonitor(base: File, partition: String, bufferSize: Int) : ExperimentMonitor { +public class ParquetExperimentMonitor(base: File, partition: String, bufferSize: Int) : ExperimentMonitor { private val hostWriter = ParquetHostEventWriter( File(base, "host-metrics/$partition/data.parquet"), bufferSize diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt index e087c7fd..1e67c086 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentDescriptor.kt @@ -41,7 +41,7 @@ public abstract class ExperimentDescriptor : Serializable { /** * The type of descriptor. */ - abstract val type: Type + public abstract val type: Type /** * A flag to indicate that this descriptor is a root descriptor. @@ -52,7 +52,7 @@ public abstract class ExperimentDescriptor : Serializable { /** * A flag to indicate that this descriptor describes an experiment trial. */ - val isTrial: Boolean + public val isTrial: Boolean get() = type == Type.TRIAL /** @@ -65,7 +65,7 @@ public abstract class ExperimentDescriptor : Serializable { /** * The types of experiment descriptors. */ - enum class Type { + public enum class Type { /** * A composition of multiple experiment descriptions whose invocation happens on a single thread. */ diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt index 49d57629..a59481c0 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/runner/ExperimentRunner.kt @@ -31,12 +31,12 @@ public interface ExperimentRunner { /** * The unique identifier of this runner. */ - val id: String + public val id: String /** * The version of this runner. */ - val version: String? + public val version: String? get() = null /** diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 9e8b46e9..42fef164 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -27,20 +27,20 @@ import org.opendc.experiments.sc20.runner.ExperimentDescriptor /** * Listener to be notified of experiment execution events by experiment runners. */ -interface ExperimentExecutionListener { +public interface ExperimentExecutionListener { /** * A method that is invoked when a new [ExperimentDescriptor] is registered. */ - fun descriptorRegistered(descriptor: ExperimentDescriptor) + public fun descriptorRegistered(descriptor: ExperimentDescriptor) /** * A method that is invoked when when the execution of a leaf or subtree of the experiment tree has finished, * regardless of the outcome. */ - fun executionFinished(descriptor: ExperimentDescriptor, result: ExperimentExecutionResult) + public fun executionFinished(descriptor: ExperimentDescriptor, result: ExperimentExecutionResult) /** * A method that is invoked when the execution of a leaf or subtree of the experiment tree is about to be started. */ - fun executionStarted(descriptor: ExperimentDescriptor) + public fun executionStarted(descriptor: ExperimentDescriptor) } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 49a137cc..70095ccd 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -28,19 +28,19 @@ import java.io.Closeable /** * A interface for scheduling the execution of experiment trials over compute resources (threads/containers/vms) */ -interface ExperimentScheduler : Closeable { +public interface ExperimentScheduler : Closeable { /** * Allocate a [Worker] for executing an experiment trial. This method may suspend in case no resources are directly * available at the moment. * * @return The available worker. */ - suspend fun allocate(): ExperimentScheduler.Worker + public suspend fun allocate(): ExperimentScheduler.Worker /** * An isolated worker of an [ExperimentScheduler] that is responsible for executing a single experiment trial. */ - interface Worker { + public interface Worker { /** * Dispatch the specified [ExperimentDescriptor] to execute some time in the future and return the results of * the trial. @@ -48,7 +48,7 @@ interface ExperimentScheduler : Closeable { * @param descriptor The descriptor to execute. * @param context The context to execute the descriptor in. */ - suspend operator fun invoke( + public suspend operator fun invoke( descriptor: ExperimentDescriptor, context: ExperimentExecutionContext ) diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 fb684678..942faed1 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -35,8 +35,7 @@ import java.util.concurrent.Executors * * @param parallelism The maximum amount of parallel workers (default is the number of available processors). */ -class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().availableProcessors() + 1) : - ExperimentScheduler { +public class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().availableProcessors() + 1) : ExperimentScheduler { private val dispatcher = Executors.newCachedThreadPool().asCoroutineDispatcher() private val tickets = Semaphore(parallelism) @@ -80,5 +79,5 @@ class ThreadPoolExperimentScheduler(parallelism: Int = Runtime.getRuntime().avai } } - override fun close() = dispatcher.close() + override fun close(): Unit = dispatcher.close() } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 953669dc..26e4df89 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -36,12 +36,12 @@ import java.util.concurrent.ConcurrentHashMap * * @param scheduler The scheduler to use. */ -public class DefaultExperimentRunner(val scheduler: ExperimentScheduler) : ExperimentRunner { +public class DefaultExperimentRunner(private val scheduler: ExperimentScheduler) : ExperimentRunner { override val id: String = "default" override val version: String? = "1.0" - override fun execute(root: ExperimentDescriptor, listener: ExperimentExecutionListener) = runBlocking { + override fun execute(root: ExperimentDescriptor, listener: ExperimentExecutionListener): Unit = runBlocking { val context = object : ExperimentExecutionContext { override val listener: ExperimentExecutionListener = listener override val scheduler: ExperimentScheduler = this@DefaultExperimentRunner.scheduler diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt index ba7d2f65..38a4a227 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/Event.kt @@ -27,7 +27,7 @@ package org.opendc.experiments.sc20.telemetry /** * An event that occurs within the system. */ -public abstract class Event(val name: String) { +public abstract class Event(public val name: String) { /** * The time of occurrence of this event. */ diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt index 1d491e53..042d204e 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/HostEvent.kt @@ -27,17 +27,17 @@ import org.opendc.compute.core.Server /** * A periodic report of the host machine metrics. */ -data class HostEvent( +public data class HostEvent( override val timestamp: Long, - val duration: Long, - val host: Server, - val vmCount: Int, - val requestedBurst: Long, - val grantedBurst: Long, - val overcommissionedBurst: Long, - val interferedBurst: Long, - val cpuUsage: Double, - val cpuDemand: Double, - val powerDraw: Double, - val cores: Int + public val duration: Long, + public val host: Server, + public val vmCount: Int, + public val requestedBurst: Long, + public val grantedBurst: Long, + public val overcommissionedBurst: Long, + public val interferedBurst: Long, + public val cpuUsage: Double, + public val cpuDemand: Double, + public val powerDraw: Double, + public val cores: Int ) : Event("host-metrics") diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt index 22795c8b..d063bc54 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/ProvisionerEvent.kt @@ -27,13 +27,13 @@ package org.opendc.experiments.sc20.telemetry /** * A periodic report of the provisioner's metrics. */ -data class ProvisionerEvent( +public data class ProvisionerEvent( override val timestamp: Long, - val totalHostCount: Int, - val availableHostCount: Int, - val totalVmCount: Int, - val activeVmCount: Int, - val inactiveVmCount: Int, - val waitingVmCount: Int, - val failedVmCount: Int + public val totalHostCount: Int, + public val availableHostCount: Int, + public val totalVmCount: Int, + public val activeVmCount: Int, + public val inactiveVmCount: Int, + public val waitingVmCount: Int, + public val failedVmCount: Int ) : Event("provisioner-metrics") diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt index b426fe11..3bcd10a1 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/RunEvent.kt @@ -27,7 +27,7 @@ import org.opendc.experiments.sc20.experiment.Run /** * A periodic report of the host machine metrics. */ -data class RunEvent( - val run: Run, +public data class RunEvent( + public val run: Run, override val timestamp: Long ) : Event("run") diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt index 89ee2a5a..c18069c9 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/telemetry/VmEvent.kt @@ -27,15 +27,15 @@ import org.opendc.compute.core.Server /** * A periodic report of a virtual machine's metrics. */ -data class VmEvent( +public data class VmEvent( override val timestamp: Long, - val duration: Long, - val vm: Server, - val host: Server, - val requestedBurst: Long, - val grantedBurst: Long, - val overcommissionedBurst: Long, - val interferedBurst: Long, - val cpuUsage: Double, - val cpuDemand: Double + public val duration: Long, + public val vm: Server, + public val host: Server, + public val requestedBurst: Long, + public val grantedBurst: Long, + public val overcommissionedBurst: Long, + public val interferedBurst: Long, + public val cpuUsage: Double, + public val cpuDemand: Double ) : Event("vm-metrics") diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 82ce8a22..79bc23db 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -112,15 +112,15 @@ public open class ParquetEventWriter<in T : Event>( } } - sealed class Action { + public sealed class Action { /** * A poison pill that will stop the writer thread. */ - object Stop : Action() + public object Stop : Action() /** * Write the specified metrics to the database. */ - data class Write<out T : Event>(val event: T) : Action() + public data class Write<out T : Event>(val event: T) : Action() } } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 3219bd0b..bd4eae37 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -36,8 +36,8 @@ public class ParquetHostEventWriter(path: File, bufferSize: Int) : override fun toString(): String = "host-writer" - companion object { - val convert: (HostEvent, GenericData.Record) -> Unit = { event, record -> + public companion object { + private val convert: (HostEvent, GenericData.Record) -> Unit = { event, record -> // record.put("portfolio_id", event.run.parent.parent.id) // record.put("scenario_id", event.run.parent.id) // record.put("run_id", event.run.id) @@ -56,7 +56,7 @@ public class ParquetHostEventWriter(path: File, bufferSize: Int) : record.put("cores", event.cores) } - val schema: Schema = SchemaBuilder + private val schema: Schema = SchemaBuilder .record("host_metrics") .namespace("org.opendc.experiments.sc20") .fields() diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 f17f9458..5d53a7bb 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -36,8 +36,8 @@ public class ParquetProvisionerEventWriter(path: File, bufferSize: Int) : override fun toString(): String = "provisioner-writer" - companion object { - val convert: (ProvisionerEvent, GenericData.Record) -> Unit = { event, record -> + public companion object { + private val convert: (ProvisionerEvent, GenericData.Record) -> Unit = { event, record -> record.put("timestamp", event.timestamp) record.put("host_total_count", event.totalHostCount) record.put("host_available_count", event.availableHostCount) @@ -48,7 +48,7 @@ public class ParquetProvisionerEventWriter(path: File, bufferSize: Int) : record.put("vm_failed_count", event.failedVmCount) } - val schema: Schema = SchemaBuilder + private val schema: Schema = SchemaBuilder .record("provisioner_metrics") .namespace("org.opendc.experiments.sc20") .fields() diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 35f8e2b5..74efb660 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/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 @@ -36,8 +36,8 @@ public class ParquetRunEventWriter(path: File, bufferSize: Int) : override fun toString(): String = "run-writer" - companion object { - val convert: (RunEvent, GenericData.Record) -> Unit = { event, record -> + public companion object { + private val convert: (RunEvent, GenericData.Record) -> Unit = { event, record -> val run = event.run val scenario = run.parent val portfolio = scenario.parent @@ -56,7 +56,7 @@ public class ParquetRunEventWriter(path: File, bufferSize: Int) : record.put("seed", run.seed) } - val schema: Schema = SchemaBuilder + private val schema: Schema = SchemaBuilder .record("runs") .namespace("org.opendc.experiments.sc20") .fields() diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt index 5045b2df..5a336865 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20ParquetTraceReader.kt @@ -40,7 +40,7 @@ import java.util.TreeSet * @param run The run to which this reader belongs. */ @OptIn(ExperimentalStdlibApi::class) -class Sc20ParquetTraceReader( +public class Sc20ParquetTraceReader( rawReaders: List<Sc20RawParquetTraceReader>, performanceInterferenceModel: Map<String, PerformanceInterferenceModel>, workload: Workload, diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt index def1c2f4..8965cf43 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20RawParquetTraceReader.kt @@ -43,7 +43,7 @@ private val logger = KotlinLogging.logger {} * @param path The directory of the traces. */ @OptIn(ExperimentalStdlibApi::class) -class Sc20RawParquetTraceReader(private val path: File) { +public class Sc20RawParquetTraceReader(private val path: File) { /** * Read the fragments into memory. */ diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt index 51108dda..41dc4b49 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20StreamingParquetTraceReader.kt @@ -57,7 +57,7 @@ private val logger = KotlinLogging.logger {} * @param performanceInterferenceModel The performance model covering the workload in the VM trace. */ @OptIn(ExperimentalStdlibApi::class) -class Sc20StreamingParquetTraceReader( +public class Sc20StreamingParquetTraceReader( traceFile: File, performanceInterferenceModel: PerformanceInterferenceModel, selectedVms: List<String>, diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt index 26c27b68..dd6b15d0 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/Sc20TraceConverter.kt @@ -53,7 +53,7 @@ import kotlin.math.min /** * Represents the command for converting traces */ -class TraceConverterCli : CliktCommand(name = "trace-converter") { +public class TraceConverterCli : CliktCommand(name = "trace-converter") { /** * The directory where the trace should be stored. */ @@ -70,7 +70,7 @@ class TraceConverterCli : CliktCommand(name = "trace-converter") { /** * The input type of the trace. */ - val type by option("-t", "--type", help = "input type of trace").groupChoice( + private val type by option("-t", "--type", help = "input type of trace").groupChoice( "solvinity" to SolvinityConversion(), "bitbrains" to BitbrainsConversion(), "azure" to AzureConversion() @@ -149,22 +149,22 @@ class TraceConverterCli : CliktCommand(name = "trace-converter") { /** * The supported trace conversions. */ -sealed class TraceConversion(name: String) : OptionGroup(name) { +public sealed class TraceConversion(name: String) : OptionGroup(name) { /** * Read the fragments of the trace. */ - abstract fun read( + public abstract fun read( traceDirectory: File, metaSchema: Schema, metaWriter: ParquetWriter<GenericData.Record> ): MutableList<Fragment> } -class SolvinityConversion : TraceConversion("Solvinity") { - val clusters by option() +public class SolvinityConversion : TraceConversion("Solvinity") { + private val clusters by option() .split(",") - val vmPlacements by option("--vm-placements", help = "file containing the VM placements") + private val vmPlacements by option("--vm-placements", help = "file containing the VM placements") .file(canBeDir = false) .convert { it.inputStream().buffered().use { Sc20VmPlacementReader(it).construct() } } .required() @@ -335,7 +335,7 @@ class SolvinityConversion : TraceConversion("Solvinity") { /** * Conversion of the Bitbrains public trace. */ -class BitbrainsConversion : TraceConversion("Bitbrains") { +public class BitbrainsConversion : TraceConversion("Bitbrains") { override fun read( traceDirectory: File, metaSchema: Schema, @@ -447,8 +447,8 @@ class BitbrainsConversion : TraceConversion("Bitbrains") { /** * Conversion of the Azure public VM trace. */ -class AzureConversion : TraceConversion("Azure") { - val seed by option(help = "seed for trace sampling") +public class AzureConversion : TraceConversion("Azure") { + private val seed by option(help = "seed for trace sampling") .long() .default(0) @@ -604,18 +604,18 @@ class AzureConversion : TraceConversion("Azure") { } } -data class Fragment( - val id: String, - val tick: Long, - val flops: Long, - val duration: Long, - val usage: Double, - val cores: Int +public data class Fragment( + public val id: String, + public val tick: Long, + public val flops: Long, + public val duration: Long, + public val usage: Double, + public val cores: Int ) -class VmInfo(val cores: Int, val requiredMemory: Long, var minTime: Long, var maxTime: Long) +public class VmInfo(public val cores: Int, public val requiredMemory: Long, public var minTime: Long, public var maxTime: Long) /** * A script to convert a trace in text format into a Parquet trace. */ -fun main(args: Array<String>) = TraceConverterCli().main(args) +public fun main(args: Array<String>): Unit = TraceConverterCli().main(args) diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt index 14e65eb6..19da97bb 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt +++ b/simulator/opendc-experiments/opendc-experiments-sc20/src/main/kotlin/org/opendc/experiments/sc20/trace/WorkloadSampler.kt @@ -37,7 +37,7 @@ private val logger = KotlinLogging.logger {} /** * Sample the workload for the specified [run]. */ -fun sampleWorkload( +public fun sampleWorkload( trace: List<TraceEntry<VmWorkload>>, workload: Workload, subWorkload: Workload, @@ -57,7 +57,7 @@ fun sampleWorkload( /** * Sample a regular (non-HPC) workload. */ -fun sampleRegularWorkload( +public fun sampleRegularWorkload( trace: List<TraceEntry<VmWorkload>>, workload: Workload, subWorkload: Workload, @@ -92,7 +92,7 @@ fun sampleRegularWorkload( /** * Sample a HPC workload. */ -fun sampleHpcWorkload( +public fun sampleHpcWorkload( trace: List<TraceEntry<VmWorkload>>, workload: Workload, seed: Int, diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt index dd1f8edb..1f73bb61 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/EnvironmentReader.kt @@ -30,9 +30,9 @@ import java.time.Clock /** * An interface for reading descriptions of topology environments into memory as [Environment]. */ -interface EnvironmentReader : Closeable { +public interface EnvironmentReader : Closeable { /** * Construct an [Environment] in the specified [CoroutineScope]. */ - suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment + public suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment } diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt index 16bb92c2..027548a8 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt @@ -48,7 +48,7 @@ import java.util.* * @param input The input stream to read from. * @param mapper The Jackson object mapper to use. */ -class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : EnvironmentReader { +public class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : EnvironmentReader { /** * The environment that was read from the file. */ diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt index 2232b548..634d5de6 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt @@ -47,11 +47,11 @@ import java.util.* * * @param environmentFile The file describing the physical cluster. */ -class Sc20ClusterEnvironmentReader( +public class Sc20ClusterEnvironmentReader( private val input: InputStream ) : EnvironmentReader { - constructor(file: File) : this(FileInputStream(file)) + public constructor(file: File) : this(FileInputStream(file)) @Suppress("BlockingMethodInNonBlockingContext") override suspend fun construct(coroutineScope: CoroutineScope, clock: Clock): Environment { diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt index 74afd8c4..9fd38d13 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt @@ -48,7 +48,7 @@ import java.util.* * @param input The input stream to read from. * @param mapper The Jackson object mapper to use. */ -class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : EnvironmentReader { +public class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : EnvironmentReader { /** * The environment that was read from the file. */ diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt index 768974e1..7f60cd90 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/PerformanceInterferenceModelReader.kt @@ -29,9 +29,9 @@ import kotlin.random.Random /** * An interface for reading descriptions of performance interference models into memory. */ -interface PerformanceInterferenceModelReader : Closeable { +public interface PerformanceInterferenceModelReader : Closeable { /** * Construct a [PerformanceInterferenceModel]. */ - fun construct(random: Random): Map<String, PerformanceInterferenceModel> + public fun construct(random: Random): Map<String, PerformanceInterferenceModel> } diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt index d532ab35..ec547e84 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceEntry.kt @@ -31,24 +31,24 @@ import org.opendc.core.workload.Workload * * @param T The shape of the workload in this entry. */ -interface TraceEntry<T : Workload> { +public interface TraceEntry<T : Workload> { /** * The time of submission of the workload. */ - val submissionTime: Long + public val submissionTime: Long /** * The workload in this trace entry. */ - val workload: T + public val workload: T /** * Extract the submission time from this entry. */ - operator fun component1() = submissionTime + public operator fun component1(): Long = submissionTime /** * Extract the workload from this entry. */ - operator fun component2() = workload + public operator fun component2(): T = workload } diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt index 81c1294a..a0beec3e 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceReader.kt @@ -32,4 +32,4 @@ import java.io.Closeable * * @param T The shape of the workloads supported by this reader. */ -interface TraceReader<T : Workload> : Iterator<TraceEntry<T>>, Closeable +public interface TraceReader<T : Workload> : Iterator<TraceEntry<T>>, Closeable diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt index 56b1b025..54fb6214 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/TraceWriter.kt @@ -32,7 +32,7 @@ import java.io.Closeable * * @param T The type of [Workload] supported by this writer. */ -interface TraceWriter<T : Workload> : Closeable { +public interface TraceWriter<T : Workload> : Closeable { /** * Write an entry to the trace. * @@ -41,5 +41,5 @@ interface TraceWriter<T : Workload> : Closeable { * @param submissionTime The time of submission of the workload. * @param workload The workload to write to the trace. */ - fun write(submissionTime: Long, workload: T) + public fun write(submissionTime: Long, workload: T) } diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt index 7f9e9960..6861affe 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/VmPlacementReader.kt @@ -29,9 +29,9 @@ import java.io.Closeable /** * An interface for reading VM placement data into memory. */ -interface VmPlacementReader : Closeable { +public interface VmPlacementReader : Closeable { /** * Construct a map of VMs to clusters. */ - fun construct(): Map<String, String> + public fun construct(): Map<String, String> } diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt index 26c599c2..89d4246d 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt @@ -41,7 +41,7 @@ import java.util.* * @param traceDirectory The directory of the traces. * @param performanceInterferenceModel The performance model covering the workload in the VM trace. */ -class BitbrainsTraceReader( +public class BitbrainsTraceReader( traceDirectory: File, performanceInterferenceModel: PerformanceInterferenceModel ) : TraceReader<VmWorkload> { diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt index 4382e0b5..9f8fb558 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/gwf/GwfTraceReader.kt @@ -63,7 +63,7 @@ import kotlin.math.min * * @param reader The buffered reader to read the trace with. */ -class GwfTraceReader(reader: BufferedReader) : TraceReader<Job> { +public class GwfTraceReader(reader: BufferedReader) : TraceReader<Job> { /** * The internal iterator to use for this reader. */ @@ -74,14 +74,14 @@ class GwfTraceReader(reader: BufferedReader) : TraceReader<Job> { * * @param file The file to read from. */ - constructor(file: File) : this(file.bufferedReader()) + public constructor(file: File) : this(file.bufferedReader()) /** * Create a [GwfTraceReader] instance from the specified [InputStream]. * * @param input The input stream to read from. */ - constructor(input: InputStream) : this(input.bufferedReader()) + public constructor(input: InputStream) : this(input.bufferedReader()) /** * Initialize the reader. diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt index 0ab7d035..fd8cdfce 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt @@ -38,7 +38,7 @@ import kotlin.random.Random * @param input The input stream to read from. * @param mapper The Jackson object mapper to use. */ -class Sc20PerformanceInterferenceReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : +public class Sc20PerformanceInterferenceReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : PerformanceInterferenceModelReader { /** * The computed value from the file. diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt index e26e59a8..bfcc30ce 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20TraceReader.kt @@ -44,7 +44,7 @@ import kotlin.random.Random * @param traceDirectory The directory of the traces. * @param performanceInterferenceModel The performance model covering the workload in the VM trace. */ -class Sc20TraceReader( +public class Sc20TraceReader( traceDirectory: File, performanceInterferenceModel: PerformanceInterferenceModel, selectedVms: List<String>, diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt index 93428d49..61bdea60 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/sc20/Sc20VmPlacementReader.kt @@ -34,7 +34,7 @@ import java.io.InputStream * @param input The input stream to read from. * @param mapper The Jackson object mapper to use. */ -class Sc20VmPlacementReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : +public class Sc20VmPlacementReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : VmPlacementReader { /** * The environment that was read from the file. diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt index 6fb29a03..13bd7ac3 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt @@ -40,7 +40,7 @@ import java.util.* * * @param file The trace file. */ -class SwfTraceReader( +public class SwfTraceReader( file: File, maxNumCores: Int = -1 ) : TraceReader<VmWorkload> { diff --git a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/wtf/WtfTraceReader.kt b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/wtf/WtfTraceReader.kt index 12a60aec..de6647d0 100644 --- a/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/wtf/WtfTraceReader.kt +++ b/simulator/opendc-format/src/main/kotlin/org/opendc/format/trace/wtf/WtfTraceReader.kt @@ -41,7 +41,7 @@ import kotlin.math.min * * @param path The path to the trace. */ -class WtfTraceReader(path: String) : TraceReader<Job> { +public class WtfTraceReader(path: String) : TraceReader<Job> { /** * The internal iterator to use for this reader. */ diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt index 69b2e69d..67ec046a 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt @@ -59,7 +59,7 @@ private val logger = KotlinLogging.logger {} * Represents the CLI command for starting the OpenDC web runner. */ @OptIn(ExperimentalCoroutinesApi::class) -class RunnerCli : CliktCommand(name = "runner") { +public class RunnerCli : CliktCommand(name = "runner") { /** * The name of the database to use. */ @@ -299,10 +299,10 @@ class RunnerCli : CliktCommand(name = "runner") { } } - val POLL_INTERVAL = 5000L // ms = 5 s - val HEARTBEAT_INTERVAL = 60000L // ms = 1 min + private val POLL_INTERVAL = 5000L // ms = 5 s + private val HEARTBEAT_INTERVAL = 60000L // ms = 1 min - override fun run() = runBlocking(Dispatchers.Default) { + override fun run(): Unit = runBlocking(Dispatchers.Default) { logger.info { "Starting OpenDC web runner" } logger.info { "Connecting to MongoDB instance" } val database = createDatabase() @@ -365,4 +365,4 @@ class RunnerCli : CliktCommand(name = "runner") { /** * Main entry point of the runner. */ -fun main(args: Array<String>) = RunnerCli().main(args) +public fun main(args: Array<String>): Unit = RunnerCli().main(args) diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt index 5cae6aa8..f9a3cd2b 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt @@ -32,11 +32,11 @@ import java.io.File /** * A helper class for processing the experiment results using Apache Spark. */ -class ResultProcessor(private val master: String, private val outputPath: File) { +public class ResultProcessor(private val master: String, private val outputPath: File) { /** * Process the results of the scenario with the given [id]. */ - fun process(id: String): Result { + public fun process(id: String): Result { val spark = SparkSession.builder() .master(master) .appName("opendc-simulator-$id") @@ -70,22 +70,22 @@ class ResultProcessor(private val master: String, private val outputPath: File) } } - data class Result( - val totalRequestedBurst: List<Long>, - val totalGrantedBurst: List<Long>, - val totalOvercommittedBurst: List<Long>, - val totalInterferedBurst: List<Long>, - val meanCpuUsage: List<Double>, - val meanCpuDemand: List<Double>, - val meanNumDeployedImages: List<Double>, - val maxNumDeployedImages: List<Int>, - val totalPowerDraw: List<Long>, - val totalFailureSlices: List<Long>, - val totalFailureVmSlices: List<Long>, - val totalVmsSubmitted: List<Int>, - val totalVmsQueued: List<Int>, - val totalVmsFinished: List<Int>, - val totalVmsFailed: List<Int> + public data class Result( + public val totalRequestedBurst: List<Long>, + public val totalGrantedBurst: List<Long>, + public val totalOvercommittedBurst: List<Long>, + public val totalInterferedBurst: List<Long>, + public val meanCpuUsage: List<Double>, + public val meanCpuDemand: List<Double>, + public val meanNumDeployedImages: List<Double>, + public val maxNumDeployedImages: List<Int>, + public val totalPowerDraw: List<Long>, + public val totalFailureSlices: List<Long>, + public val totalFailureVmSlices: List<Long>, + public val totalVmsSubmitted: List<Int>, + public val totalVmsQueued: List<Int>, + public val totalVmsFinished: List<Int>, + public val totalVmsFailed: List<Int> ) /** @@ -191,12 +191,12 @@ class ResultProcessor(private val master: String, private val outputPath: File) } // Spark helper functions - operator fun Column.times(other: Column): Column = `$times`(other) - operator fun Column.div(other: Column): Column = `$div`(other) - operator fun Column.get(other: Column): Column = this.apply(other) + private operator fun Column.times(other: Column): Column = `$times`(other) + private operator fun Column.div(other: Column): Column = `$div`(other) + private operator fun Column.get(other: Column): Column = this.apply(other) - val sliceLength = 5 * 60 * 1000 - val states = map( + private val sliceLength = 5 * 60 * 1000 + private val states = map( lit("ERROR"), lit(1), lit("ACTIVE"), @@ -204,7 +204,7 @@ class ResultProcessor(private val master: String, private val outputPath: File) lit("SHUTOFF"), lit(0) ) - val oppositeStates = map( + private val oppositeStates = map( lit("ERROR"), lit(0), lit("ACTIVE"), diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt index 0c6c8fee..504fccdc 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ScenarioManager.kt @@ -31,11 +31,11 @@ import java.time.Instant /** * Manages the queue of scenarios that need to be processed. */ -class ScenarioManager(private val collection: MongoCollection<Document>) { +public class ScenarioManager(private val collection: MongoCollection<Document>) { /** * Find the next scenario that the simulator needs to process. */ - fun findNext(): Document? { + public fun findNext(): Document? { return collection .find(Filters.eq("simulation.state", "QUEUED")) .first() @@ -44,7 +44,7 @@ class ScenarioManager(private val collection: MongoCollection<Document>) { /** * Claim the scenario in the database with the specified id. */ - fun claim(id: String): Boolean { + public fun claim(id: String): Boolean { val res = collection.findOneAndUpdate( Filters.and( Filters.eq("_id", id), @@ -61,7 +61,7 @@ class ScenarioManager(private val collection: MongoCollection<Document>) { /** * Update the heartbeat of the specified scenario. */ - fun heartbeat(id: String) { + public fun heartbeat(id: String) { collection.findOneAndUpdate( Filters.and( Filters.eq("_id", id), @@ -74,7 +74,7 @@ class ScenarioManager(private val collection: MongoCollection<Document>) { /** * Mark the scenario as failed. */ - fun fail(id: String) { + public fun fail(id: String) { collection.findOneAndUpdate( Filters.eq("_id", id), Updates.combine( @@ -87,7 +87,7 @@ class ScenarioManager(private val collection: MongoCollection<Document>) { /** * Persist the specified results. */ - fun finish(id: String, result: ResultProcessor.Result) { + public fun finish(id: String, result: ResultProcessor.Result) { collection.findOneAndUpdate( Filters.eq("_id", id), Updates.combine( diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt index 884833cb..de9ece75 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt @@ -50,7 +50,7 @@ import java.util.* /** * A helper class that converts the MongoDB topology into an OpenDC environment. */ -class TopologyParser(private val collection: MongoCollection<Document>, private val id: String) : EnvironmentReader { +public class TopologyParser(private val collection: MongoCollection<Document>, private val id: String) : EnvironmentReader { /** * Parse the topology with the specified [id]. */ diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt index a8d10d22..89849f6a 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt @@ -24,14 +24,14 @@ package org.opendc.workflows.service import org.opendc.workflows.workload.Job -class JobState(val job: Job, val submittedAt: Long) { +public class JobState(public val job: Job, public val submittedAt: Long) { /** * A flag to indicate whether this job is finished. */ - val isFinished: Boolean + public val isFinished: Boolean get() = tasks.isEmpty() - val tasks: MutableSet<TaskState> = mutableSetOf() + internal val tasks: MutableSet<TaskState> = mutableSetOf() override fun equals(other: Any?): Boolean = other is JobState && other.job == job diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt index d03a646c..18721889 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt @@ -22,16 +22,16 @@ package org.opendc.workflows.service -interface StageWorkflowSchedulerListener { - fun cycleStarted(scheduler: StageWorkflowService) {} - fun cycleFinished(scheduler: StageWorkflowService) {} +public interface StageWorkflowSchedulerListener { + public fun cycleStarted(scheduler: StageWorkflowService) {} + public fun cycleFinished(scheduler: StageWorkflowService) {} - fun jobSubmitted(job: JobState) {} - fun jobStarted(job: JobState) {} - fun jobFinished(job: JobState) {} + public fun jobSubmitted(job: JobState) {} + public fun jobStarted(job: JobState) {} + public fun jobFinished(job: JobState) {} - fun taskReady(task: TaskState) {} - fun taskAssigned(task: TaskState) {} - fun taskStarted(task: TaskState) {} - fun taskFinished(task: TaskState) {} + public fun taskReady(task: TaskState) {} + public fun taskAssigned(task: TaskState) {} + public fun taskStarted(task: TaskState) {} + public fun taskFinished(task: TaskState) {} } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt index 6262c61f..bc08b22d 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt @@ -48,7 +48,7 @@ import java.util.* * A [WorkflowService] that distributes work through a multi-stage process based on the Reference Architecture for * Topology Scheduling. */ -class StageWorkflowService( +public class StageWorkflowService( internal val coroutineScope: CoroutineScope, internal val clock: Clock, private val provisioningService: ProvisioningService, @@ -361,11 +361,11 @@ class StageWorkflowService( rootListener.jobFinished(job) } - fun addListener(listener: StageWorkflowSchedulerListener) { + public fun addListener(listener: StageWorkflowSchedulerListener) { rootListener.listeners += listener } - fun removeListener(listener: StageWorkflowSchedulerListener) { + public fun removeListener(listener: StageWorkflowSchedulerListener) { rootListener.listeners -= listener } } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt index e7795dd5..ddfbeae3 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt @@ -25,34 +25,34 @@ package org.opendc.workflows.service import org.opendc.compute.metal.Node import org.opendc.workflows.workload.Task -class TaskState(val job: JobState, val task: Task) { +public class TaskState(public val job: JobState, public val task: Task) { /** * The moment in time the task was started. */ - var startedAt: Long = Long.MIN_VALUE + public var startedAt: Long = Long.MIN_VALUE /** * The moment in time the task was finished. */ - var finishedAt: Long = Long.MIN_VALUE + public var finishedAt: Long = Long.MIN_VALUE /** * The dependencies of this task. */ - val dependencies = HashSet<TaskState>() + public val dependencies: HashSet<TaskState> = HashSet<TaskState>() /** * The dependents of this task. */ - val dependents = HashSet<TaskState>() + public val dependents: HashSet<TaskState> = HashSet<TaskState>() /** * A flag to indicate whether this workflow task instance is a workflow root. */ - val isRoot: Boolean + public val isRoot: Boolean get() = dependencies.isEmpty() - var state: TaskStatus = TaskStatus.CREATED + public var state: TaskStatus = TaskStatus.CREATED set(value) { field = value @@ -62,7 +62,7 @@ class TaskState(val job: JobState, val task: Task) { } } - var host: Node? = null + public var host: Node? = null /** * Mark the specified [TaskView] as terminated. diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt index 3eff0062..d03adc61 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt @@ -30,21 +30,21 @@ import org.opendc.workflows.service.stage.StagePolicy /** * The operating mode of a workflow scheduler. */ -sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> { +public sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> { /** * The logic for operating the cycles of a workflow scheduler. */ - interface Logic { + public interface Logic { /** * Request a new scheduling cycle to be performed. */ - suspend fun requestCycle() + public suspend fun requestCycle() } /** * An interactive scheduler immediately triggers a new scheduling cycle when a workflow is received. */ - object Interactive : WorkflowSchedulerMode() { + public object Interactive : WorkflowSchedulerMode() { override fun invoke(scheduler: StageWorkflowService): Logic = object : Logic { override suspend fun requestCycle() { yield() @@ -58,7 +58,7 @@ sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> { /** * A batch scheduler triggers a scheduling cycle every time quantum if needed. */ - data class Batch(val quantum: Long) : WorkflowSchedulerMode() { + public data class Batch(val quantum: Long) : WorkflowSchedulerMode() { private var next: kotlinx.coroutines.Job? = null override fun invoke(scheduler: StageWorkflowService): Logic = object : Logic { @@ -84,7 +84,7 @@ sealed class WorkflowSchedulerMode : StagePolicy<WorkflowSchedulerMode.Logic> { /** * A scheduling cycle is triggered at a random point in time. */ - data class Random(private val random: java.util.Random = java.util.Random(123)) : WorkflowSchedulerMode() { + public data class Random(private val random: java.util.Random = java.util.Random(123)) : WorkflowSchedulerMode() { private var next: kotlinx.coroutines.Job? = null override fun invoke(scheduler: StageWorkflowService): Logic = object : Logic { diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt index 17a2d875..319a8b85 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt @@ -46,5 +46,5 @@ public interface WorkflowService { /** * The service key for the workflow scheduler. */ - companion object Key : AbstractServiceKey<WorkflowService>(UUID.randomUUID(), "workflows") + public companion object Key : AbstractServiceKey<WorkflowService>(UUID.randomUUID(), "workflows") } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt index 68a8a424..d76579f9 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt @@ -28,9 +28,9 @@ import java.io.Serializable /** * A scheduling stage policy. */ -interface StagePolicy<T : Any> : Serializable { +public interface StagePolicy<T : Any> : Serializable { /** * Build the logic of the stage policy. */ - operator fun invoke(scheduler: StageWorkflowService): T + public operator fun invoke(scheduler: StageWorkflowService): T } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt index 9ac6a97f..1190a408 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt @@ -32,7 +32,7 @@ import org.opendc.workflows.workload.WORKFLOW_TASK_DEADLINE /** * A [JobOrderPolicy] that orders jobs based on its critical path length. */ -data class DurationJobOrderPolicy(val ascending: Boolean = true) : JobOrderPolicy { +public data class DurationJobOrderPolicy(val ascending: Boolean = true) : JobOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<JobState> = object : Comparator<JobState>, StageWorkflowSchedulerListener { private val results = HashMap<Job, Long>() @@ -70,7 +70,7 @@ data class DurationJobOrderPolicy(val ascending: Boolean = true) : JobOrderPolic * * @return The list of tasks within the job topologically sorted. */ -fun Job.toposort(): List<Task> { +public fun Job.toposort(): List<Task> { val res = mutableListOf<Task>() val visited = mutableSetOf<Task>() val adjacent = mutableMapOf<Task, MutableList<Task>>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt index 8d45918b..0e5a42c0 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt @@ -28,15 +28,15 @@ import org.opendc.workflows.service.stage.StagePolicy /** * A policy interface for admitting [JobState]s to a scheduling cycle. */ -interface JobAdmissionPolicy : StagePolicy<JobAdmissionPolicy.Logic> { - interface Logic { +public interface JobAdmissionPolicy : StagePolicy<JobAdmissionPolicy.Logic> { + public interface Logic { /** * Determine whether the specified [JobState] should be admitted to the scheduling cycle. * * @param job The workflow that has been submitted. * @return The advice for admitting the job. */ - operator fun invoke(job: JobState): Advice + public operator fun invoke(job: JobState): Advice } /** @@ -46,7 +46,7 @@ interface JobAdmissionPolicy : StagePolicy<JobAdmissionPolicy.Logic> { * @property stop A flag to indicate the scheduler should immediately stop admitting jobs to the scheduling queue and wait * for the next scheduling cycle. */ - enum class Advice(val admit: Boolean, val stop: Boolean) { + public enum class Advice(public val admit: Boolean, public val stop: Boolean) { /** * Admit the current job to the scheduling queue and continue admitting jobs. */ diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt index e65a2ea7..83d42b2d 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt @@ -28,4 +28,4 @@ import org.opendc.workflows.service.stage.StagePolicy /** * A policy interface for ordering admitted workflows in the scheduling queue. */ -interface JobOrderPolicy : StagePolicy<Comparator<JobState>> +public interface JobOrderPolicy : StagePolicy<Comparator<JobState>> diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt index 7ee15e6b..6f6ccb50 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt @@ -30,9 +30,11 @@ import org.opendc.workflows.service.StageWorkflowService * * @property limit The maximum number of concurrent jobs in the system. */ -data class LimitJobAdmissionPolicy(val limit: Int) : JobAdmissionPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : JobAdmissionPolicy.Logic { - override fun invoke(job: JobState): JobAdmissionPolicy.Advice = +public data class LimitJobAdmissionPolicy(public val limit: Int) : JobAdmissionPolicy { + override fun invoke(scheduler: StageWorkflowService): JobAdmissionPolicy.Logic = object : JobAdmissionPolicy.Logic { + override fun invoke( + job: JobState + ): JobAdmissionPolicy.Advice = if (scheduler.activeJobs.size < limit) JobAdmissionPolicy.Advice.ADMIT else diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt index 31e6d043..4f0c269a 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt @@ -30,9 +30,11 @@ import org.opendc.workflows.service.StageWorkflowService * * @property limit The maximum load before stopping admission. */ -data class LoadJobAdmissionPolicy(val limit: Double) : JobAdmissionPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : JobAdmissionPolicy.Logic { - override fun invoke(job: JobState): JobAdmissionPolicy.Advice = +public data class LoadJobAdmissionPolicy(public val limit: Double) : JobAdmissionPolicy { + override fun invoke(scheduler: StageWorkflowService): JobAdmissionPolicy.Logic = object : JobAdmissionPolicy.Logic { + override fun invoke( + job: JobState + ): JobAdmissionPolicy.Advice = if (scheduler.load < limit) JobAdmissionPolicy.Advice.ADMIT else diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt index e671db52..ac74f090 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt @@ -28,10 +28,9 @@ 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 +public object NullJobAdmissionPolicy : JobAdmissionPolicy { + override fun invoke(scheduler: StageWorkflowService): JobAdmissionPolicy.Logic = object : JobAdmissionPolicy.Logic { + override fun invoke(job: JobState): JobAdmissionPolicy.Advice = JobAdmissionPolicy.Advice.ADMIT } override fun toString(): String = "Always" diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt index 7f5abd68..6c747261 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt @@ -34,7 +34,7 @@ import kotlin.collections.set /** * A [JobOrderPolicy] that randomly orders jobs. */ -object RandomJobOrderPolicy : JobOrderPolicy { +public object RandomJobOrderPolicy : JobOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<JobState> = object : Comparator<JobState>, StageWorkflowSchedulerListener { private val random = Random(123) diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt index 05953a9b..c1c244c3 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt @@ -28,9 +28,9 @@ import org.opendc.workflows.service.StageWorkflowService /** * A [SizeJobOrderPolicy] that orders jobs based on the number of tasks it has. */ -data class SizeJobOrderPolicy(val ascending: Boolean = true) : JobOrderPolicy { - override fun invoke(scheduler: StageWorkflowService) = - compareBy<JobState> { it.tasks.size.let { if (ascending) it else -it } } +public data class SizeJobOrderPolicy(public val ascending: Boolean = true) : JobOrderPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<JobState> = + compareBy { it.tasks.size.let { if (ascending) it else -it } } override fun toString(): String { return "Job-Size(${if (ascending) "asc" else "desc"})" diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt index 9a48f934..005f8153 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt @@ -28,9 +28,9 @@ import org.opendc.workflows.service.StageWorkflowService /** * A [JobOrderPolicy] orders jobs in FIFO order. */ -data class SubmissionTimeJobOrderPolicy(val ascending: Boolean = true) : JobOrderPolicy { - override fun invoke(scheduler: StageWorkflowService) = - compareBy<JobState> { it.submittedAt.let { if (ascending) it else -it } } +public data class SubmissionTimeJobOrderPolicy(public val ascending: Boolean = true) : JobOrderPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<JobState> = + compareBy { it.submittedAt.let { if (ascending) it else -it } } override fun toString(): String { return "Submission-Time(${if (ascending) "asc" else "desc"})" diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt index 64b46330..38b37140 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt @@ -28,10 +28,9 @@ import org.opendc.workflows.service.StageWorkflowService /** * A [ResourceSelectionPolicy] that selects the first machine that is available. */ -object FirstFitResourceSelectionPolicy : ResourceSelectionPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : Comparator<Node> { - override fun compare(o1: Node, o2: Node): Int = 1 - } +public object FirstFitResourceSelectionPolicy : ResourceSelectionPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<Node> = + Comparator<Node> { _, _ -> 1 } override fun toString(): String = "First-Fit" } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt index e505539d..9381ffd7 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt @@ -30,7 +30,7 @@ import org.opendc.workflows.service.TaskState * A [ResourceFilterPolicy] based on the amount of cores available on the machine and the cores required for * the task. */ -object FunctionalResourceFilterPolicy : ResourceFilterPolicy { +public object FunctionalResourceFilterPolicy : ResourceFilterPolicy { override fun invoke(scheduler: StageWorkflowService): ResourceFilterPolicy.Logic = object : ResourceFilterPolicy.Logic { override fun invoke(hosts: Sequence<Node>, task: TaskState): Sequence<Node> = diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt index 68c78cd6..b31a6217 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt @@ -29,8 +29,8 @@ import java.util.* /** * A [ResourceSelectionPolicy] that randomly orders the machines. */ -object RandomResourceSelectionPolicy : ResourceSelectionPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : Comparator<Node> { +public object RandomResourceSelectionPolicy : ResourceSelectionPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<Node> = object : Comparator<Node> { private val ids: Map<Node, Long> init { diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt index 43744417..9f44fddf 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt @@ -31,8 +31,8 @@ import org.opendc.workflows.service.stage.StagePolicy * acts as a filter yielding a list of resources with sufficient resource-capacities, based on fixed or dynamic * requirements, and on predicted or monitored information about processing unit availability, memory occupancy, etc. */ -interface ResourceFilterPolicy : StagePolicy<ResourceFilterPolicy.Logic> { - interface Logic { +public interface ResourceFilterPolicy : StagePolicy<ResourceFilterPolicy.Logic> { + public interface Logic { /** * Filter the list of machines based on dynamic information. * @@ -40,6 +40,6 @@ interface ResourceFilterPolicy : StagePolicy<ResourceFilterPolicy.Logic> { * @param task The task that is to be scheduled. * @return The machines on which the task can be scheduled. */ - operator fun invoke(hosts: Sequence<Node>, task: TaskState): Sequence<Node> + public operator fun invoke(hosts: Sequence<Node>, task: TaskState): Sequence<Node> } } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt index 2cc9bc3b..3682844a 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt @@ -29,4 +29,4 @@ import org.opendc.workflows.service.stage.StagePolicy * This interface represents the **R5** stage of the Reference Architecture for Schedulers and matches the the selected * task with a (set of) resource(s), using policies such as First-Fit, Worst-Fit, and Best-Fit. */ -interface ResourceSelectionPolicy : StagePolicy<Comparator<Node>> +public interface ResourceSelectionPolicy : StagePolicy<Comparator<Node>> diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt index ef2f9db4..6a465746 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt @@ -30,7 +30,7 @@ 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. */ -data class ActiveTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { +public data class ActiveTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = object : Comparator<TaskState>, StageWorkflowSchedulerListener { private val active = mutableMapOf<JobState, Int>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt index 11ac612e..f3f19ef5 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt @@ -35,7 +35,7 @@ import kotlin.math.max * @property tolerance The maximum difference from the average number of tasks per job in the system as a fraction of * the average. */ -data class BalancingTaskEligibilityPolicy(val tolerance: Double = 1.5) : TaskEligibilityPolicy { +public data class BalancingTaskEligibilityPolicy(public val tolerance: Double = 1.5) : TaskEligibilityPolicy { override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = object : TaskEligibilityPolicy.Logic, StageWorkflowSchedulerListener { private val active = mutableMapOf<JobState, Int>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt index c3e3720a..0020023f 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt @@ -30,7 +30,7 @@ import org.opendc.workflows.service.TaskState /** * A [TaskOrderPolicy] that orders tasks based on the number of completed relative tasks. */ -data class CompletionTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { +public data class CompletionTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = object : Comparator<TaskState>, StageWorkflowSchedulerListener { private val finished = mutableMapOf<JobState, Int>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt index 60e27118..a9f5eb84 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt @@ -28,8 +28,8 @@ import org.opendc.workflows.service.TaskState /** * A [TaskOrderPolicy] that orders tasks based on the number of dependency tasks it has. */ -data class DependenciesTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { - override fun invoke(scheduler: StageWorkflowService) = compareBy<TaskState> { +public data class DependenciesTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = compareBy<TaskState> { it.task.dependencies.size.let { if (ascending) it else -it } } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt index 97a6dfb0..e5a9f159 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt @@ -28,8 +28,8 @@ import org.opendc.workflows.service.TaskState /** * A [TaskOrderPolicy] that orders tasks based on the number of dependent tasks it has. */ -data class DependentsTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { - override fun invoke(scheduler: StageWorkflowService) = compareBy<TaskState> { +public data class DependentsTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = compareBy<TaskState> { it.dependents.size.let { if (ascending) it else -it } } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt index 9cd83eac..7ce8ccce 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt @@ -30,8 +30,7 @@ import org.opendc.workflows.service.TaskState /** * A [TaskOrderPolicy] that orders tasks based on the average duration of the preceding tasks in the job. */ -data class DurationHistoryTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { - +public data class DurationHistoryTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = object : Comparator<TaskState>, StageWorkflowSchedulerListener { private val results = HashMap<JobState, MutableList<Long>>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt index d5a8a104..3674eb01 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt @@ -35,7 +35,7 @@ import kotlin.collections.set /** * A [TaskOrderPolicy] orders tasks based on the pre-specified (approximate) duration of the task. */ -data class DurationTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { +public data class DurationTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = object : Comparator<TaskState>, StageWorkflowSchedulerListener { diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt index 9b06f7d9..2dddbc7c 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt @@ -30,7 +30,7 @@ import org.opendc.workflows.service.TaskState /** * A [TaskEligibilityPolicy] that limits the number of active tasks of a job in the system. */ -data class LimitPerJobTaskEligibilityPolicy(val limit: Int) : TaskEligibilityPolicy { +public data class LimitPerJobTaskEligibilityPolicy(public val limit: Int) : TaskEligibilityPolicy { override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = object : TaskEligibilityPolicy.Logic, StageWorkflowSchedulerListener { private val active = mutableMapOf<JobState, Int>() diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt index e0ac3bc4..fdc1fd5e 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt @@ -28,8 +28,8 @@ import org.opendc.workflows.service.TaskState /** * A [TaskEligibilityPolicy] that limits the total number of active tasks in the system. */ -data class LimitTaskEligibilityPolicy(val limit: Int) : TaskEligibilityPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : TaskEligibilityPolicy.Logic { +public data class LimitTaskEligibilityPolicy(val limit: Int) : TaskEligibilityPolicy { + override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = object : TaskEligibilityPolicy.Logic { override fun invoke( task: TaskState ): TaskEligibilityPolicy.Advice = diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt index e1f0a0b7..a80a8c63 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt @@ -28,8 +28,8 @@ import org.opendc.workflows.service.TaskState /** * A [TaskEligibilityPolicy] that limits the number of active tasks in the system based on the average system load. */ -data class LoadTaskEligibilityPolicy(val limit: Double) : TaskEligibilityPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : TaskEligibilityPolicy.Logic { +public data class LoadTaskEligibilityPolicy(val limit: Double) : TaskEligibilityPolicy { + override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = object : TaskEligibilityPolicy.Logic { override fun invoke( task: TaskState ): TaskEligibilityPolicy.Advice = diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt index 4f34b692..b40f9823 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt @@ -28,7 +28,7 @@ import org.opendc.workflows.service.TaskState /** * A [TaskEligibilityPolicy] that always allows new tasks to enter. */ -object NullTaskEligibilityPolicy : TaskEligibilityPolicy { +public object NullTaskEligibilityPolicy : TaskEligibilityPolicy { override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = Logic private object Logic : TaskEligibilityPolicy.Logic { diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt index 8a2e26ad..a0691b23 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt @@ -29,8 +29,8 @@ import java.util.* /** * A [TaskEligibilityPolicy] that randomly accepts tasks in the system with some [probability]. */ -data class RandomTaskEligibilityPolicy(val probability: Double = 0.5) : TaskEligibilityPolicy { - override fun invoke(scheduler: StageWorkflowService) = object : TaskEligibilityPolicy.Logic { +public data class RandomTaskEligibilityPolicy(val probability: Double = 0.5) : TaskEligibilityPolicy { + override fun invoke(scheduler: StageWorkflowService): TaskEligibilityPolicy.Logic = object : TaskEligibilityPolicy.Logic { val random = Random(123) override fun invoke(task: TaskState): TaskEligibilityPolicy.Advice = diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt index df03ba80..890e7165 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt @@ -33,7 +33,7 @@ import kotlin.random.Random /** * A [TaskOrderPolicy] that orders the tasks randomly. */ -object RandomTaskOrderPolicy : TaskOrderPolicy { +public object RandomTaskOrderPolicy : TaskOrderPolicy { override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = object : Comparator<TaskState>, StageWorkflowSchedulerListener { private val random = Random(123) diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt index e6727e8a..6b0199b8 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt @@ -30,8 +30,8 @@ import org.opendc.workflows.service.TaskState /** * A [TaskOrderPolicy] that orders tasks based on the order of arrival in the queue. */ -data class SubmissionTimeTaskOrderPolicy(val ascending: Boolean = true) : TaskOrderPolicy { - override fun invoke(scheduler: StageWorkflowService) = compareBy<TaskState> { +public data class SubmissionTimeTaskOrderPolicy(public val ascending: Boolean = true) : TaskOrderPolicy { + override fun invoke(scheduler: StageWorkflowService): Comparator<TaskState> = compareBy<TaskState> { it.job.submittedAt.let { if (ascending) it else -it } } diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt index 1eb2fab0..37597709 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt @@ -30,15 +30,15 @@ import org.opendc.workflows.service.stage.StagePolicy /** * A policy interface for determining the eligibility of tasks in a scheduling cycle. */ -interface TaskEligibilityPolicy : StagePolicy<TaskEligibilityPolicy.Logic> { - interface Logic { +public interface TaskEligibilityPolicy : StagePolicy<TaskEligibilityPolicy.Logic> { + public interface Logic { /** * Determine whether the specified [TaskState] is eligible to be scheduled. * * @param task The task instance to schedule. * @return The advice for marking the task. */ - operator fun invoke(task: TaskState): Advice + public operator fun invoke(task: TaskState): Advice } /** @@ -48,7 +48,7 @@ interface TaskEligibilityPolicy : StagePolicy<TaskEligibilityPolicy.Logic> { * @property stop A flag to indicate the scheduler should immediately stop admitting jobs to the scheduling queue and wait * for the next scheduling cycle. */ - enum class Advice(val admit: Boolean, val stop: Boolean) { + public enum class Advice(public val admit: Boolean, public val stop: Boolean) { /** * Admit the current job to the scheduling queue and continue admitting jobs. */ diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt index 0a3ce077..5feac6d0 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt @@ -31,4 +31,4 @@ import org.opendc.workflows.service.stage.StagePolicy * This interface represents the **T2** stage of the Reference Architecture for Topology Schedulers and provides the * scheduler with a sorted list of tasks to schedule. */ -interface TaskOrderPolicy : StagePolicy<Comparator<TaskState>> +public interface TaskOrderPolicy : StagePolicy<Comparator<TaskState>> diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt index 30285507..f1cfdf65 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt @@ -35,12 +35,12 @@ import java.util.* * @property tasks The tasks that are part of this workflow. * @property metadata Additional metadata for the job. */ -data class Job( +public data class Job( override val uid: UUID, override val name: String, override val owner: User, - val tasks: Set<Task>, - val metadata: Map<String, Any> = emptyMap() + public val tasks: Set<Task>, + public val metadata: Map<String, Any> = emptyMap() ) : Workload { override fun equals(other: Any?): Boolean = other is Job && uid == other.uid diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt index 99bd1cd3..d02e2b4e 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt @@ -27,4 +27,4 @@ package org.opendc.workflows.workload /** * Meta-data key for the deadline of a task. */ -const val WORKFLOW_TASK_DEADLINE = "workflow:task:deadline" +public const val WORKFLOW_TASK_DEADLINE: String = "workflow:task:deadline" diff --git a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt index 864eede5..1834a4c8 100644 --- a/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt +++ b/simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt @@ -37,12 +37,12 @@ import java.util.* * @property dependencies The dependencies of this task in order for it to execute. * @property metadata Additional metadata for this task. */ -data class Task( +public data class Task( override val uid: UUID, override val name: String, - val image: Image, - val dependencies: Set<Task>, - val metadata: Map<String, Any> = emptyMap() + public val image: Image, + public val dependencies: Set<Task>, + public val metadata: Map<String, Any> = emptyMap() ) : Identity { override fun equals(other: Any?): Boolean = other is Task && uid == other.uid |
