Run Handle
Live reference to a simulation run submitted via Runner.submit.
A RunHandle is returned immediately by Runner.submit; the simulation executes asynchronously on a background thread. Callers observe progress by collecting events and obtain the terminal outcome by awaiting result.
val handle = runner.submit(RunRequest.SingleRun(model))
// Collect lifecycle events (usually in a dedicated coroutine):
launch { handle.events.collect { event -> updateUi(event) } }
// Await the terminal result:
when (val r = handle.result.await()) {
is RunResult.Completed -> showResults(r.summary)
is RunResult.Cancelled -> showCancelled(r.reason)
is RunResult.Failed -> showError(r.error)
}Content copied to clipboard
Functions
Link copied to clipboard
Synchronously waits for result and returns it.
Link copied to clipboard
Cancel a single scenario by name without stopping the enclosing run. Only meaningful for scenario sweeps — other orchestrators return false from the default implementation.