--- id: PIPE-10 family: RT-PIPE level: core profiles: [runtime, storage-api, editor-client] posture: normative-target added: "1.1" changed: "1.1" source: https://flowdrop.io/spec/rules/rt-pipe/pipe-10 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # PIPE-10 — The job and run statuses, and what each one means *RT-PIPE (Part II) · level: core · profiles: runtime, storage-api, editor-client · added in 1.1* STORE-11 says the status vocabularies are closed; this is where the job and run vocabularies are listed. A consumer that knows these values can tell from a status alone whether a job or a run is over. ## The rule > **Normative.** This is the rule. > > 1. A job's status MUST be one of these values: `idle`, the job exists and its dependencies are not met (ORC-9); `pending`, the job is ready and waits to be executed (ORC-9); `dispatched`, a worker has claimed the job and it has not started executing (ORC-14); `running`, the job is executing; `polling`, the job is parked between checks of external work that the engine makes itself (PIPE-11); `interrupted`, the job raised an interrupt and waits for its answer (INT-1, INT-3); `completed`, the job finished and recorded its result (ERR-1, ERR-5); `failed`, the job finished with a failure that escaped it or that nothing routed (ERR-3, ERR-8); `cancelled`, the job was handed out for execution and its run ended before the job finished; `skipped`, the job was not executed and will not be (BR-7, ORC-11). > > 2. Of these, `completed`, `failed`, `cancelled` and `skipped` are terminal. > > 3. An implementation MAY use `dispatched` and `polling`: one that never hands a job to a worker before it executes never reports `dispatched`, and one that makes no checks of its own never reports `polling`. > > 4. When a run reaches a terminal status, whichever it is, each of its jobs that is not terminal MUST take a final status. > > 5. A job never handed out for execution (`idle`, `pending`) MUST become `skipped`, with the reason BR-7 gives it: `BRANCH_NOT_ACTIVE` for a job that was not yet ready when its run completed, `RUN_ENDED` otherwise. > > 6. A job handed out for execution and now abandoned (`dispatched`, `running`, `polling`, `interrupted`) MUST become `cancelled`. > > 7. The line is whether the job could have had an effect: a skipped job did nothing, while a cancelled one may have held a claim, made a call or asked a question. > > 8. A run that is paused is not ended, and its jobs keep their statuses. > > 9. A `dispatched` job whose run has ended MUST NOT then start. > > 10. A job that has reached a terminal status MUST NOT leave it. > > 11. A cancel waits for the job in flight to finish (INT-5), so that job ends with a status of its own; a run that fails (ORC-11) does not wait for jobs still running beside the one that failed, and they become `cancelled` at once. > > 12. A result that a `cancelled` job returns afterwards MUST be discarded: it MUST NOT be applied to the run's state. > > 13. It MUST NOT be followed along any edge. > > 14. An implementation MAY record it in its log; no payload of this specification carries it. > > 15. A consumer that meets a job status it does not recognise MUST NOT treat the job as ended. > > 16. A run's status MUST be one of these values: `pending`, the run exists and has not started executing; `running`, the run is executing, or is only polling (PIPE-11); `paused`, the run holds and executes nothing until it is resumed (INT-5, INT-12, ORC-11); `completed`, `failed` and `cancelled`, its terminal outcomes (ORC-11, INT-11). > > 17. Both lists are closed (STORE-11), because a consumer decides from a status alone whether a job or a run has ended, and PIPE-2 publishes one counter per job status. > > 18. An execution's answer is not a run status: the `queued` that an asynchronous launch answers (ORC-12) describes a run that is `pending` or `running`, and the `interrupted` that an execution answers for a run waiting on an interrupt (INT-1, OCX-7) describes a run that is `paused`. ## What it means A status is the one thing every reader of a run looks at first, and the question it is asked most is the simplest: is this over? The answer has to come from the status alone, without knowing which implementation wrote it. That is why both lists are closed. A reader that knows the values below can classify every job and every run it meets, and the job status summary (PIPE-2) can carry one counter per value with nothing left over. Two job statuses are there for implementations that need them. `dispatched` is a job a worker has claimed and not yet started; an engine that runs its jobs itself never has one. `polling` is a job parked between two checks of outside work the engine makes itself (PIPE-11). Both still count in the job status summary, at zero where they are never used. A reader that meets a job status it does not know, perhaps from a later version of this list, treats the job as not yet over: guessing "over" is the guess that can hide live work. For a job, four values are terminal: `completed`, `failed`, `cancelled` and `skipped`. `interrupted` is not one of them. The job waits for an answer, and answering it returns the job to `pending` (INT-3). For a run, the terminal values are `completed`, `failed` and `cancelled`, and nothing else. A run that stopped to wait, for a person or because its budget ran out, is `paused`. When a run ends, no job is left in a status that says it might still move. Each unfinished job gets one final status, and the run's ending does not change which: a cancel, a failure and a completion all leave the same mark. The question is whether the job could have done anything. A job that was only waiting its turn, `idle` or `pending`, did nothing and becomes `skipped`. A job that was handed out — claimed by a worker, executing, parked on outside work, or waiting on a question it asked — may have left a trace somewhere, and becomes `cancelled`. An interrupted job sits with the polling one for that reason: its question went out, just as the polling job's request did. A paused run has not ended, so none of this touches it: its waiting jobs stay as they are, ready for the resume. And a final status is final. A cancel lets the job in flight finish first, so that job keeps the status it earned. A run that fails does not wait for work still running beside the failure; those jobs are `cancelled` at once, and if one of them later comes back with a result, the result is dropped. It changes no state and wakes no downstream node: the run's outcome is already recorded and announced. At most it shows up in a log. Two words an execution can answer look like run statuses and are not. `queued` is what an asynchronous launch says at once (ORC-12): the run behind it is `pending`, or already `running`, and a status read reports which. `interrupted` is what an execution says when the run stopped at an interrupt: the run itself is `paused`, and the job that raised the interrupt is the one whose status is `interrupted`. ## Example A run that stopped at an approval step. Two nodes ran, one asks a question, and one has not started. ```json title="The jobs' statuses" verdict="defined" { "fetch": "completed", "classify": "completed", "approve": "interrupted", "publish": "idle" } ``` ```json title="The run's status" verdict="paused" "paused" ``` Neither `approve` nor `publish` is terminal, and the run is not terminal either: it waits for the answer to `approve`. ## Why Recorded under [OPEN-55](https://flowdrop.io/spec/rulings/open-55), [OPEN-56](https://flowdrop.io/spec/rulings/open-56), [OPEN-63](https://flowdrop.io/spec/rulings/open-63). ## Related rules - Names: BR-7, STORE-11, PIPE-2, PIPE-3, ORC-9, ORC-11, ORC-12, INT-1, INT-11, OCX-7, ORC-14, PIPE-11 - Referenced by: STORE-11, ORC-11, INT-6, INT-18, INT-25, PIPE-2, PIPE-3, PIPE-11 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.