The job and run statuses, and what each one means
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
- 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). - Of these,
completed,failed,cancelledandskippedare terminal. - An implementation MAY use
dispatchedandpolling: one that never hands a job to a worker before it executes never reportsdispatched, and one that makes no checks of its own never reportspolling. - When a run reaches a terminal status, whichever it is, each of its jobs that is not terminal MUST take a final status.
- A job never handed out for execution (
idle,pending) MUST becomeskipped, with the reason BR-7 gives it:BRANCH_NOT_ACTIVEfor a job that was not yet ready when its run completed,RUN_ENDEDotherwise. - A job handed out for execution and now abandoned (
dispatched,running,polling,interrupted) MUST becomecancelled. - 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.
- A run that is paused is not ended, and its jobs keep their statuses.
- A
dispatchedjob whose run has ended MUST NOT then start. - A job that has reached a terminal status MUST NOT leave it.
- 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
cancelledat once. - A result that a
cancelledjob returns afterwards MUST be discarded: it MUST NOT be applied to the run's state. - It MUST NOT be followed along any edge.
- An implementation MAY record it in its log; no payload of this specification carries it.
- A consumer that meets a job status it does not recognise MUST NOT treat the job as ended.
- 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,failedandcancelled, its terminal outcomes (ORC-11, INT-11). - 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.
- An execution's answer is not a run status: the
queuedthat an asynchronous launch answers (ORC-12) describes a run that ispendingorrunning, and theinterruptedthat an execution answers for a run waiting on an interrupt (INT-1, OCX-7) describes a run that ispaused.
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.
{ "fetch": "completed", "classify": "completed", "approve": "interrupted", "publish": "idle" }"paused"Neither approve nor publish is terminal, and the run is not terminal
either: it waits for the answer to approve.