Skip to content

A cancel ends a paused run at once

A paused run has no engine loop to observe a cancel at a job boundary, and making the operator resume it first would run its nodes again before the cancel lands. So the cancel ends it directly, with nothing executed in between, and announces it exactly as any other cancel.

The rule

Normative: this is the rule
  1. A paused run is one whose engine loop has stopped on a pause: by an inward pause signal, by a budget (ORC-10), or by an outward interrupt.
  2. A cancel signal accepted for a paused run MUST end the run without waiting for a job boundary, because no engine loop is running to observe it (INT-5).
  3. The cancel MUST claim the run by one atomic change from paused to cancelled.
  4. That claim is the run's terminal claim (INT-11), so it MUST also be atomic against an ending by the expiry or cancel of an outward interrupt (INT-18): where that ending claims the run first, the cancel signal changes nothing about the run and announces nothing.
  5. The claim MUST be atomic against every way the run can resume: a resume signal (INT-16), an answer to an interrupt the run waits on (INT-3), and a worker's auto-resume (INT-12).
  6. Where a resume claims the run first, the run is running again, and the cancel MUST be observed at its next job boundary (INT-5).
  7. Where the cancel claims the run first, a resume signal MUST be refused with PIPELINE_TERMINAL (INT-16), an answer to one of the run's outward interrupts MUST be refused with 409 and the code INTERRUPT_NOT_PENDING (INT-24), and a worker MUST NOT auto-resume the run.
  8. Once the cancel has claimed the run, a job of the run MUST NOT start.
  9. Ending the run MUST stamp its execution time, set its pending pause signal, if any, cancelled, set the cancel signal resolved, give its unfinished jobs their final status (PIPE-10), and set its pending outward interrupts cancelled (INT-24).
  10. The outcome MUST be announced as INT-5 announces a cancel: a cancellation event and one completion announcement carrying the cancelled status (ORC-15).
  11. The cancel MUST be answered 202 (INT-16).
  12. Ending the run MUST hold across a crash: an implementation stopped part-way MUST complete the remaining steps afterwards, and MUST NOT announce the outcome a second time.
  13. A run with a cancel signal pending MUST NOT be left paused.
  14. Where it would pause, by a pause signal, a budget or an interrupt, the cancel MUST be observed instead, ending the run as INT-5 requires, with its pending pause signal, if any, set cancelled.

What it means

A running run notices a cancel at the next job boundary (INT-5). A paused run has no boundary coming: nothing is executing, and nothing will until someone resumes it. Asking the operator to resume a run in order to cancel it would set its nodes running again, side effects included, in the window before the cancel is noticed. That is the opposite of what a cancel asks for, so the cancel ends a paused run itself.

It does not matter what paused the run. A pause signal, a budget that ran out, a question waiting for an answer: in each case the run is cancelled where it stands. The pause signal that was its resume key is set cancelled, its open questions are withdrawn, its unfinished jobs take their final status (a job never handed out for execution is skipped, one that was handed out is cancelled, PIPE-10), and it is announced exactly as any other cancel, once.

A paused run can be resumed in three ways at the moment someone cancels it: a resume request, an answer to the question it was waiting on, or a worker picking up a run its budget paused. Exactly one of them, or the cancel, gets the run. If a resume gets there first, the run is running again and the cancel lands at the next job boundary as usual. If the cancel gets there first, the run is over, and the resume is refused.

The last clause closes a gap from the other side. A cancel accepted while the run was still running must not be swallowed by a pause that happens before the next boundary is checked. Whatever would have paused the run, the pending cancel wins.

Example

A run paused by a pause signal, then cancelled.

Cancelling the paused run202 — accepted
POST /api/flowdrop/pipeline/{pipeline_id}/cancel

{}
The run straight afterwards, before any worker has looked at itcancelled
{ "status": "cancelled" }
A resume sent a moment later409 — PIPELINE_TERMINAL
POST /api/flowdrop/pipeline/{pipeline_id}/resume

{}

No job ran between the cancel and the run being cancelled, and the run's pause signal now reads cancelled.

The paths are examples of the routes API-9 names pipeline_cancel and pipeline_resume.

Why

Recorded under OPEN-48, OPEN-64, OPEN-46, OPEN-63.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · INT-25 · changed in spec 1.1