summaryrefslogtreecommitdiff
path: root/simulator/opendc-workflows
diff options
context:
space:
mode:
Diffstat (limited to 'simulator/opendc-workflows')
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/JobState.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowSchedulerListener.kt20
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/TaskState.kt16
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowSchedulerMode.kt12
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/WorkflowService.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/StagePolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/DurationJobOrderPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobAdmissionPolicy.kt8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/JobOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LimitJobAdmissionPolicy.kt8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/LoadJobAdmissionPolicy.kt8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/NullJobAdmissionPolicy.kt7
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/RandomJobOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SizeJobOrderPolicy.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/job/SubmissionTimeJobOrderPolicy.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FirstFitResourceSelectionPolicy.kt7
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/FunctionalResourceFilterPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/RandomResourceSelectionPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceFilterPolicy.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/resource/ResourceSelectionPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/ActiveTaskOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/BalancingTaskEligibilityPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/CompletionTaskOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependenciesTaskOrderPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DependentsTaskOrderPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationHistoryTaskOrderPolicy.kt3
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/DurationTaskOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitPerJobTaskEligibilityPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LimitTaskEligibilityPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/LoadTaskEligibilityPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/NullTaskEligibilityPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskEligibilityPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/RandomTaskOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/SubmissionTimeTaskOrderPolicy.kt4
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskEligibilityPolicy.kt8
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/stage/task/TaskOrderPolicy.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Job.kt6
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Metadata.kt2
-rw-r--r--simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt8
40 files changed, 103 insertions, 102 deletions
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