diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-10-25 13:32:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-25 13:32:41 +0200 |
| commit | 5a365dbc068f2a8cdfa9813c39cc84bb30e15637 (patch) | |
| tree | 72716d562787b85e03cdc7fe1d30c827054d25a0 /opendc-simulator/opendc-simulator-compute/src/main/kotlin | |
| parent | 27f5b7dcb05aefdab9b762175d538931face0aba (diff) | |
Rewrote the FlowEngine (#256)
* Removed unused components. Updated tests.
Improved checkpointing model
Improved model, started with SimPowerSource
implemented FailureModels and Checkpointing
First working version
midway commit
first update
All simulation are now run with a single CPU and single MemoryUnit. multi CPUs are combined into one. This is for performance and explainability.
* fixed merge conflicts
* Updated M3SA paths.
* Fixed small typo
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main/kotlin')
| -rw-r--r-- | opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt index 63af2048..ad69a3d6 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt @@ -23,12 +23,13 @@ package org.opendc.simulator.compute import kotlinx.coroutines.suspendCancellableCoroutine -import org.opendc.simulator.compute.workload.SimWorkload +import org.opendc.simulator.compute.machine.SimMachine +import org.opendc.simulator.compute.workload.TraceWorkload import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException /** - * Run the specified [SimWorkload] on this machine and suspend execution util [workload] has finished. + * Run the specified [SimWorkloadNew] on this machine and suspend execution util [workload] has finished. * * @param workload The workload to start on the machine. * @param meta The metadata to pass to the workload. @@ -36,13 +37,13 @@ import kotlin.coroutines.resumeWithException * @throws IllegalStateException if a workload is already active on the machine or if the machine is closed. */ public suspend fun SimMachine.runWorkload( - workload: SimWorkload, + workload: TraceWorkload, meta: Map<String, Any> = emptyMap(), ) { return suspendCancellableCoroutine { cont -> - cont.invokeOnCancellation { this@runWorkload.cancel() } + cont.invokeOnCancellation { this@runWorkload.shutdown() } - startWorkload(workload, meta) { cause -> + startWorkload(workload) { cause -> if (cause != null) cont.resumeWithException(cause) else cont.resume(Unit) } } |
