diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-03-09 19:38:29 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-03-09 20:33:27 +0100 |
| commit | b3f390be783cad21cd4925bcbe8077b91f869b5d (patch) | |
| tree | dadd8b4eb8af12120e8b334270f0d49c725b54e6 /simulator/opendc-workflows/src/main | |
| parent | b3a271794d64bd97ef93abf650137c5a0a1785df (diff) | |
compute: Model storage of VM images
Diffstat (limited to 'simulator/opendc-workflows/src/main')
| -rw-r--r-- | simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/service/StageWorkflowService.kt | 8 | ||||
| -rw-r--r-- | simulator/opendc-workflows/src/main/kotlin/org/opendc/workflows/workload/Task.kt | 2 |
2 files changed, 6 insertions, 4 deletions
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 5ae503a7..34d19e4f 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 @@ -145,6 +145,7 @@ public class StageWorkflowService( private val mode: WorkflowSchedulerMode.Logic private val jobAdmissionPolicy: JobAdmissionPolicy.Logic private val taskEligibilityPolicy: TaskEligibilityPolicy.Logic + private lateinit var image: Image init { this.mode = mode(this) @@ -152,6 +153,9 @@ public class StageWorkflowService( this.jobQueue = PriorityQueue(100, jobOrderPolicy(this).thenBy { it.job.uid }) this.taskEligibilityPolicy = taskEligibilityPolicy(this) this.taskQueue = PriorityQueue(1000, taskOrderPolicy(this).thenBy { it.task.uid }) + coroutineScope.launch { + image = computeClient.newImage("workflow-runner") + } } override val events: Flow<WorkflowEvent> = tracer.openRecording().let { @@ -259,9 +263,9 @@ public class StageWorkflowService( val cores = instance.task.metadata[WORKFLOW_TASK_CORES] as? Int ?: 1 val flavor = Flavor(cores, 1000) // TODO How to determine memory usage for workflow task - val image = instance.task.image + val image = image coroutineScope.launch { - val server = computeClient.newServer(instance.task.name, image, flavor, start = false) + val server = computeClient.newServer(instance.task.name, image, flavor, start = false, meta = instance.task.metadata) instance.state = TaskStatus.ACTIVE instance.server = server 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 9ed3a9a5..4ccefef9 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 @@ -24,7 +24,6 @@ package org.opendc.workflows.workload -import org.opendc.compute.api.Image import java.util.* /** @@ -39,7 +38,6 @@ import java.util.* public data class Task( val uid: UUID, val name: String, - val image: Image, val dependencies: Set<Task>, val metadata: Map<String, Any> = emptyMap() ) { |
