Skip to content

Job file format

A job file is one YAML or JSON document that says everything about a training job: what to run, on how many nodes and GPUs, for how long, where checkpoints go, what to do on each kind of failure, and any backend-specific placement. It starts version: 1. dunscaith validate <file> checks it without touching a cluster, and dunscaith submit <file> runs exactly what it says.

version: 1
name: llama-pretrain
command: [torchrun, --nproc-per-node=8, train.py]
env:
  WANDB_MODE: offline
workDir: /shared/projects/llama
nodes: 4
gpusPerNode: 8
procsPerNode: 8
timeLimit: 36h
checkpoint: s3://my-bucket/llama
recovery:
  rules:
    - on: [preempted, node-lost]
      action: resubmit
      budget: 3
    - on: [out-of-memory, non-zero-exit]
      action: escalate
    - on: [unknown]
      action: hold
      for: 2h

The file is read once, at submit. The record keeps the decoded job, and resubmit, supersede and recovery read the record, never the file, so a later change to the file, or to this format, never affects a job already submitted.

The file

  • Format by extension. A name ending .yaml or .yml is YAML, .json is JSON. Any other name is refused. To read the job from standard input, pass - and --format yaml or --format json.
  • One document. An empty file, a file of only comments, and a second YAML document (anything after a --- that follows content, even an empty one) are refused, as is anything after the JSON value.
  • UTF-8, at most 1 MiB. Invalid UTF-8 is refused with its byte offset. A larger file is refused before it is parsed.
  • The file is the whole job. No flag of submit overrides a field, so the file in git is the job that ran. Flags configure the submission: --detach, --idempotency-key, the accept flags.

Fields

Absent means what the "Absent" column says, and nothing else. A field whose absence would silently change what the job does on a GPU cluster is required.

Field Type Absent Rules
version integer refused: add version: 1 1, the only version this dunscaith reads
name string no label; the job is known by its ID, a ULID no NUL
command list of strings refused at least one item; the first not empty; no NUL in any
env map of string to string no variables beyond what the backend sets each key a shell identifier, [A-Za-z_][A-Za-z0-9_]*, not beginning DISPATCH_ and not DUNSCAITH_S3_CREDS; no NUL in a value
workDir absolute path the backend's default: on Slurm the user's home, on Kubeflow the image's absolute, or under $HOME/, in its plain form (see Paths)
nodes integer refused at least 1
gpusPerNode integer refused; write 0 for a job with no GPUs not negative
procsPerNode integer the backend's default not negative
timeLimit duration the cluster's default limit, per execution positive; 0s is refused, because it reads as unlimited
checkpoint absolute path or s3://bucket/prefix no checkpoint: a recovered execution starts from scratch an absolute path, or an s3:// URL with a bucket and no query, fragment or user info
recovery object no rules: every cause ends the job Failed with an escalation see Recovery
extensions map none see Extensions

Keys are matched exactly, including case: Nodes is refused, naming nodes. A key the version does not define is refused, at every level, listing the keys that are known there.

Durations

timeLimit and a rule's for are Go duration strings: 90m, 12h, 36h30m, 1.5h. The units are ns, us, ms, s, m and h; there is no d. A bare number is refused, because the record's encoding would read it as nanoseconds:

job file train.yaml: /timeLimit (line 5, column 12): 3600 is a bare number; write a duration such as "90m" or "12h"; a bare number would be read as nanoseconds

In JSON, write a duration as a string too: "timeLimit": "12h". The backend rounds: Slurm up to whole minutes, Kubeflow up to a second.

Counts

nodes, gpusPerNode and procsPerNode are plain base-10 integers. 4.0, 1e1, 0x10, 0o17, .inf, .nan and a quoted "4" are refused, in YAML and in JSON.

Paths

Every path is absolute: workDir, a POSIX checkpoint, and dispatch.Output's stdout and stderr. A relative path and ~/... are refused, naming the path. A path is also written in its plain form, with no . or .. segment and no NUL: /shared/./ckpt and /shared/../ckpt are refused. The file is read on a login node and the paths are used on compute nodes or inside a container, so an absolute path is the one form whose meaning does not depend on where it was read.

The one exception is a leading $HOME/ on workDir and on dispatch.Output's paths, which stands for the cluster user's home. dunscaith does not expand it: it passes $HOME/... through unchanged, and the adapter resolves it when it starts the job. An adapter that cannot resolve it refuses the job. The plain-form rule holds after it too, so $HOME/../../etc is refused. The in-memory adapter used in tests treats the path as opaque text.

Nothing else in the file is expanded. ${VAR} and $VAR in a value are literal text: they reach the job's process unexpanded, where the job's own shell may expand them. The submitting shell's environment never supplies a value, so one file is one job whichever shell submits it.

Recovery

recovery:
  rules:
    - on: [preempted, node-lost]
      action: resubmit
      budget: 3
    - on: [unknown]
      action: hold
      for: 2h

rules is an ordered list. A rule's position, counting from 0, is how the plan, the receipt, --accept-unenforced N and --accept-unverified N:enforcer name it. A rule has exactly these keys:

Key Type Rule
on list of causes at least one; always a list, even for one cause; no cause in two rules
action resubmit, restart, requeue, hold or escalate required
budget integer at least 1 for resubmit, restart and requeue; refused for hold and escalate
for duration positive, for hold only; refused for every other action

The causes a rule may cover are preempted, node-lost, out-of-memory, time-limit, non-zero-exit, launch-failed, no-capacity, held, released, requeued and unknown. These are refused:

  • cancelled: a cancellation the scheduler reports is final;
  • none and duplicate: neither ends an execution recovery could act on;
  • unknown under any action but hold or escalate.

Whether a rule can be enforced is not the file's question: the plan answers it at submit, and the receipt shows each rule's enforcer. What each action and cause means belongs to go/dispatch.

Extensions

Backend-specific fields are typed extensions, a map keyed <namespace>.<Name> with the extension's fields as the value:

extensions:
  dispatch.Image: {ref: registry.example.com/train:2026.10}
  dispatch.Output: {stdout: /shared/logs/llama/out, stderr: $HOME/logs/llama/err}
  dispatch.SharedCheckpoint: {}
  • Field names are the extension type's own. They are decoded as strictly as the rest of the file: an unknown field is refused, listing the known ones.
  • A field-less extension is written {}. true, or no value, is refused.
  • The order carries no meaning. dunscaith holds extensions sorted by key, so one job has one spec digest however the file orders them. A key given twice is refused.
  • An extension this build does not know is refused when the file is read, naming the ones it does. This build knows dispatch.Image, dispatch.Output, dispatch.SharedCheckpoint, kubeflow.RuntimeRef, slurm.Placement and slurm.Resources.
  • One the configured adapter does not take, or requires and is missing, is refused by the adapter at submit, before any scheduler object exists. validate reports it too when a cluster is configured and its declarations are cached.
Extension Fields Meaning
dispatch.Image ref, a string with no NUL The container image to run. Kubeflow requires it; Slurm refuses it.
dispatch.Output stdout, stderr, paths Where an execution's output goes. Absolute, or under $HOME/, in plain form.
dispatch.SharedCheckpoint none The checkpoint is shared and mutable, so every recovery rule becomes a hold for a person.
kubeflow.RuntimeRef kind, name, strings The Kubeflow Trainer runtime the job runs under. kind is ClusterTrainingRuntime or TrainingRuntime. Kubeflow requires it; Slurm refuses it.
slurm.Placement partition, account, qos, reservation, constraint, strings Where Slurm runs the job. Each field given overrides the same field of the adapter's defaults. Kubeflow refuses it.
slurm.Resources gpuType, a string; cpusPerTask, memPerNodeMiB, integers; exclusive, a boolean The GPU type, CPUs per task, memory per node in MiB, and whether the nodes are exclusive to the job. Kubeflow refuses it.

Every field of an adapter's extension is optional in the file. The file reader checks the field names and types; the adapter checks the values at submit, such as a kind it does not know.

extensions:
  slurm.Placement: {partition: gpu, account: research}
  slurm.Resources: {gpuType: a100, cpusPerTask: 8}
extensions:
  kubeflow.RuntimeRef: {kind: ClusterTrainingRuntime, name: torch-distributed}
  dispatch.Image: {ref: registry.example.com/train:2026.10}

There is no passthrough of raw scheduler arguments, and no image default: the image decides what code runs.

What is refused

Every refusal names the file, a JSON Pointer to the value and, where there is one, the line and column, then what was found and what is accepted. Every refusal found is reported, not just the first:

job file train.yaml: /nodes (line 4, column 8): 4.0 is not an integer; write a base-10 integer such as 4
job file train.yaml: /workDir (line 6, column 10): "projects/llama" is relative; write an absolute path, or $HOME/ for the cluster user's home

The checks a decoded job must pass as a whole, such as a hold's positive for or a cause in two rules, run once the file decodes without a refusal.

Refused Why
A key the version does not define, or one that matches only when case is folded it would mean something else in another tool
The same key twice in one mapping, in YAML or JSON otherwise the last would silently win
Anchors, aliases and merge keys (&a, *a, <<) an alias hides a value from the reader; a merge key is YAML 1.1 only
Every explicit tag, including !!str quoting does what !!str does; any other tag changes a value's type behind the reader's back
%YAML and %TAG directives the file has one meaning, YAML 1.2 under the core schema
An explicit null (~, null, an empty value, JSON null) anywhere absence is written by leaving the key out
A value of the wrong type for its position a scalar is never converted
A non-string or complex mapping key every key in the format is a string

Scalars resolve under the YAML 1.2 core schema. A plain yes, no, on, off, y or NO is a string, so env: {VERBOSE: on} sets VERBOSE=on and command: [x, NO] passes NO. A date such as name: 2026-10-12 is the string 2026-10-12. Where a boolean goes, only true and false are accepted. A number or boolean where a string goes is refused with the fix named:

job file train.yaml: /name (line 5, column 7): the integer 12, where a string is expected; quote it ("12") if it is a string

Values dunscaith adds

The file has no defaults layer: no site profile, user configuration or environment variable supplies a job field. A site's partition, account and similar defaults belong to the adapter's own configuration under cluster.config, which a placement extension in the file overrides per job.

dunscaith adds one value. For an s3:// checkpoint, it adds DUNSCAITH_S3_CREDS to env, holding the publish helper's -creds list rendered from checkpoint.s3.credentials: references to where the credentials are, never a credential. The job script passes it on with publish resolve -creds "$DUNSCAITH_S3_CREDS". A file that sets DUNSCAITH_S3_CREDS itself is refused, and a credential source that cannot be rendered refuses the submit before any record is created. A POSIX checkpoint adds nothing. See Set up S3 checkpoint credentials.

The added variable is recorded in the spec and printed in the receipt, with every value the backend will default: the time limit, workDir and procsPerNode when absent. See submit.

Checking a file

dunscaith validate <file> reads and checks the file, prints every refusal, and exits 1 if there is one and 0 if not. It opens no record root and touches no scheduler. With a cluster configured it also asks the adapter what it can answer from cached declarations, such as an extension it does not take or a field its capabilities refuse. See validate.

  • validate --print prints the job as submit would record it: a normalised version 1 file, with keys in the order of the table above and durations in Go's form (36h0m0s), which reads back to the same job and spec digest. DUNSCAITH_S3_CREDS is shown as a comment, since the file may not set it.
  • validate --upgrade prints the file rewritten at the current version. While version 1 is the only one, that normalises it.
  • status <job> --spec prints a submitted job's recorded spec the same way.

A JSON Schema for version 1 is published for editors and yaml-language-server, with additionalProperties: false at every level. dunscaith's own decoder is the authority; the schema cannot see YAML syntax, so it accepts a few things the decoder refuses, such as 4.0 in a count. To use it with yaml-language-server, put this first in the file:

# yaml-language-server: $schema=https://dunscaith.phpboyscout.uk/reference/job-file.v1.schema.json

How the format evolves

  • A field added to the job, or a new extension, joins version 1. An older dunscaith refuses the new key as unknown, and nothing written for it changes meaning.
  • A removed or renamed field, or a changed unit or meaning, makes a new version. dunscaith then reads the old and new versions for at least one minor release, and validate --upgrade rewrites a file at the new one.

JSON

The same format in JSON:

{
  "version": 1,
  "name": "demo",
  "command": ["python", "train.py"],
  "nodes": 2,
  "gpusPerNode": 8,
  "timeLimit": "12h",
  "extensions": {"dispatch.SharedCheckpoint": {}}
}