Skip to content

The record's schemas

Schema Go type Written Holds
dispatch.header.v1 records.Header once, by Create the spec, plan and lineage
dispatch.control.v1 records.Control appended by the Operator a person's control intent; frozen
dispatch.fact.v1 records.Fact appended by the supervisor a decision, a call about to be made, or evidence
Label Value
dispatch.settled false at create; true from the commit that settles the record
dispatch.settled-at the settling commit's time, RFC 3339, UTC
dispatch.name the job's discovery name, dj-<job id>

Bodies are JSON. records.EncodeHeader, EncodeControl and EncodeFact write them, and DecodeHeader and DecodeEntry read them strictly: an unknown field, trailing data or an unknown schema is records.ErrSchema, and an unknown enum name is refused, except a cause kind a newer build wrote (below). Times are RFC 3339 with nanoseconds; durations are integer nanoseconds; enums are their names (below).

Field Type Notes
schema string dispatch.header.v1; a build that doesn't know the value refuses the header
job job id a 26-character upper-case ULID
spec JobSpec as submitted
specDigest string hex SHA-256 of the spec's JSON encoding; a repeated idempotency key with a different digest is refused
plan Plan as MakePlan returned it
supersedes job id omitted for an original job
generation int 0 for an original job; the superseded job's plus 1
declarations object the adapter's at create: nodeLossWindow, polledLoss (evidence name to duration), callBound, and requeueSettle, how long after a requeue lands its restart may take to show (omitted when zero)
requeuer bool the backend implements Requeuer, set by the core at create; omitted when it doesn't
submitRetries int how many times an unknown Start may be retried per submission: WithSubmitRetries' value, 2 by default
cleanupDeadline duration WithCleanupDeadline' value; omitted for the default, 30 minutes
unresolvedAge duration WithUnresolvedAge' value; omitted for the default, 10 minutes
historyWait duration WithHistoryWait' value; omitted for the default, an hour. A header that carries it can't be read by go/dispatch v0.1.0
createdBy actor
createdAt time

Control

Field Type Used by
kind control kind all
by actor all
reason string all but release
at time all
until time hold: its deadline
target object: submission, attempt, foreign (an object ref) abandon
override bool release: the releaser isn't the holder
instance int release, resubmit: the hold instance the intent was aimed at, so a retry landing after that hold was replaced leaves the new one alone; absent means whichever hold is active

Control kinds: cancel, hold, release, requeue, give-up, resubmit, abandon. (unset exists as the zero value and is refused by Fold.)

Fact

Every fact has kind, by and at. The other fields are set only for the kinds that use them:

Field Type Fact kinds
submission int authorize, attempt, reply, canonical, hold-placed
triggerKey string authorize: the budget reservation; unique per record
rule int authorize: the rule's index, or -1 for none
attempt int attempt, reply, canonical
reply reply reply
ref object ref reply, canonical, opening, retire, verified-stopped, hold-placed (a backend hold the plan placed; omitted for a recovery hold), hold-call, hold-refused, requeue-call, requeue-result, restore-call, cessation
findAt time verified-stopped: when the Find the judgement rests on was taken
obs object observation observe
outcome state outcome: succeeded, failed or cancelled
cause cause outcome, hold-placed
escalation string escalate, delivered: the escalation id
detail string escalate, reply, hold-refused, requeue-result (the error's words), cessation
hold hold hold-placed: the recovery hold, or the backend hold the supervisor places on a requeued object of a job sharing its checkpoint
instance int hold-call, hold-refused
op call op hold-call
ceased bool cessation: the site's signal says the object's processes are gone; omitted when it doesn't
deadline time hold-call, requeue-call, restore-call: the call's deadline, committed before it's sent; requeue-result: the deadline of the call it answers
expires time hold-call, requeue-call, restore-call: the deadline plus the adapter's callBound
result result requeue-result: ok; void for an error proving the call made no requeue (ErrRejected, ErrUnsupported, ErrNotFound); unknown for any other error, ErrOutcomeUnknown first

Fact kinds:

Kind Class Records
authorize decision submission N, with its trigger key and rule
attempt decision attempt a of submission N, before its Start
reply evidence what that Start returned
observe evidence an object as the scheduler showed it
canonical decision submission N's canonical object, once
opening decision the decision to open an object's gate
retire decision an object retired, permanently
verified-stopped decision an object judged stopped from its absence
outcome decision the job's terminal state and cause
escalate decision an escalation, by id
delivered evidence an escalation delivered to a person
hold-placed decision a recovery hold, placed by a hold rule; or a backend hold the supervisor places on a shared-checkpoint job the scheduler requeued on a bit dispatch didn't leave, naming its object in ref
hold-call decision a hold placement or release about to be sent
hold-refused evidence or decision a hold the scheduler or adapter refused
requeue-call decision a requeue about to be sent
restore-call decision a restore of a requeue bit a requeue of dispatch's left set, about to be sent
requeue-result evidence what a requeue call returned, after it returned
stop-job decision a StopJob sweep ran
settled decision the settled predicate held
cessation evidence a site cessation signal's answer for one object; a ceased answer lifts the hold a shared checkpoint substituted

(unset exists as the zero value and is refused by Fold.) Cancel also commits a stop-job fact after its own sweep.

Reply Call op
none, created, refused, unknown place, release (unset as the zero value)

JobSpec

Field Type Notes
name string a label for people, not an identity
command string array required; no NUL bytes
env object no key starting DISPATCH_
workDir string needs WorkingDirectory
nodes int at least 1
gpusPerNode int not negative
procsPerNode int not negative; needs ProcsPerNode when set
timeLimit duration per execution; not negative
checkpoint string an absolute POSIX path or s3://bucket/prefix
recovery object rules: an array of rules
extensions array each {"namespace", "name", "value"}; decoding refuses an unregistered type

dispatch's own extensions are in namespace dispatch: Image ({"ref"}), SharedCheckpoint ({}) and Output ({"stdout", "stderr"}).

Rule

Field Type Notes
on cause kind array at least one; a cause in one rule only; never none, cancelled or duplicate; unknown only with hold or escalate
action action resubmit, restart, requeue, hold, escalate
budget int at least 1 for resubmit, restart and requeue; absent otherwise
for duration positive for hold; absent otherwise

Plan

Field Type Notes
job job id
rules array each {"index", "rule", "effective", "enforcer", "firings"}; firings is filled in by status, not stored
uncovered cause kind array causes that end an execution and that no rule covers
unverified capability array needed capabilities proceeding on unknown
unverifiedRules rule array rules accepted with AcceptUnverified
checkpoint checkpoint mode isolated, shared
unmatched unmatched policy residual, manual
native object the accepted native offer: rules (indexes), data (base64, the adapter's own encoding)
identityWeakened string the adapter's reason the job's execution identity is weakened; absent when it is not. See execution identity

Shared shapes

Actor

{"kind", "id"}. Kind: human, supervisor, adapter. (unset is the zero value, and an actor with it, or with no id, is refused.)

Cause

Field Type
kind cause kind
provenance none, scheduler, application, actor
actor actor, when an actor caused it
detail the scheduler's own words
exitCode int, when there is one
at time

Cause kinds: none, preempted, node-lost, out-of-memory, time-limit, non-zero-exit, launch-failed, no-capacity, held, released, requeued, cancelled, duplicate, unknown.

A newer build's cause kinds

Cause-kind names are the one open set in a record body. DecodeHeader and DecodeEntry decode a name this build doesn't know, wherever a cause kind appears: a cause's kind (in an obs, an outcome or a hold-placed), a rule's on (in spec.recovery, plan.rules[].rule and .effective, and plan.unverifiedRules), and plan.uncovered.

  • It decodes to unrecognised, one value outside the named kinds, and the enclosing cause, rule or plan keeps the name: Cause.KindName(), Rule.OnNames(), Plan.UncoveredNames(). CauseKind.Unrecognised() reports it, and Valid() is false.
  • Only a well-formed name is widened: [a-z][a-z0-9-]*, at most 64 bytes. Any other name is records.ErrSchema, as is an unknown member, fact kind, provenance, action or schema beside it.
  • Re-encoding writes the name back in its position. A record with only known kinds encodes as before, byte for byte.
  • Only the record reader widens. model.DecodeRecord is the entry point the codec uses. model.DecodeStrict, CauseKind.UnmarshalText and a typed extension's decoding still refuse an unknown name, so a misspelt kind in a job file is still an error, and RecoveryPolicy.Validate refuses unrecognised.
  • It matches no rule, another unrecognised name included, and is distinct from unknown. An execution that ends with it escalates unplaced: and commits no outcome. When a Find shows that object ended at the same restart count, the record's reading stands and this build's own is not committed.
  • A job whose policy or plan rules name one (Header.Unrecognised()) is readable, cancellable, holdable, can be given up and abandoned, and once terminal is swept and settled. While it's live this build's supervisor doesn't supervise it, and Supersede refuses it with ErrUnsupported. plan.uncovered alone doesn't stop supervision.

A build before this reader change refuses such a record as records.ErrSchema.

Hold

{"kind", "by", "since", "until", "reason", "overdue"}. Kind: backend or recovery.

Object ref and observation

An object ref is {"backend", "id", "uid", "submit"}: the registered adapter name, the scheduler's id, the Kubernetes UID or the Slurm job's exact name, and the Slurm submit time where there is one. The record keeps the submit time first seen: a Slurm requeue resets the one the scheduler reports, and the core matches the requeued job to the ref it holds.

An observation (obs) is {"ref", "submission", "attempt", "foreign", "execution", "state", "adminHeld", "holdInstance", "requeueBit", "requeueBitBy", "cause", "seen"}; requeueBitBy is the adapter's account of who set the requeue bit, omitted when it cannot tell. Its execution is {"token", "restart", "nodes", "started", "ended"}, and its state one of gated, pending, held, running, ended.

Other enum names

Type Names
state pending, held, running, recovering, succeeded, failed, cancelled, unknown
enforcer backend, supervisor, nobody (unset is the zero value)
tristate unknown, yes, no
source declared, probed, catalogue
evidence state, cause, exit-code, execution (how an ended execution ended), execution-count (that another execution happened)
level job, object-only
clean-up state clear, pending, blocked