Lifecycle and progress
Run and item states, ETags, resumable events, partial visibility, and cancellation.
queued -> running -> completed
-> completed_with_errors
-> failed
queued/running -> cancelling -> cancelledItems are pending, running, succeeded, failed, or cancelled. Progress counts are monotonic,
but a percentage is never the completion signal: only the top-level terminal state is authoritative.
Poll GET /runs/{id} with If-None-Match; unchanged state returns 304. Persisted events have a
run-local increasing sequence (run.queued, run.started, item.started, item.succeeded,
item.failed, cancellation and terminal events). Resume with after; events contain correlation and
progress metadata but never raw structures or complete hit tables.
Run state, undispatched inputs, progress, and committed results are durable. After a transient API
outage or service restart, keep polling the same run and resume events from the last persisted
sequence. If the create response itself was interrupted, repeat it with the same Idempotency-Key
to recover the admitted run without creating duplicate work.
for event in dmc.runs.watch(run.id, after=run.last_event_sequence):
print(event.type, event.progress)
terminal = dmc.runs.wait(run.id)Cancellation is idempotent. It stops undispatched work at safe quantum boundaries and preserves
committed results. Non-preemptible chemistry may finish its current bounded quantum before the run
becomes cancelled.