Configuration¶
The adapter's settings are one JSON object, passed to the adapter as dispatch.Config.Adapter (it
arrives as AdapterConfig.Settings), or as a slurm.Config to slurm.New. Every key is optional
except where noted; an omitted key takes its default. An empty section, or none, is the
all-defaults configuration.
The schema is slurm.Schema(), a JSON Schema (draft 2020-12) with additionalProperties: false
at every level. Why the decoders are strict lists what the
decoder refuses beyond it: unknown and repeated keys, null, empty strings, numbers below 1, and
text that is not a positive Go duration.
The schema is laxer than the adapter in places. It accepts, and the adapter later refuses:
ssh.host,ssh.userandssh.proxyJumpwith characters outside the sets below, or starting with-, andsshpaths with characters other than letters, digits and- _ . / +. The adapter refuses these whenslurm.Newopens the ssh transport;- a
controlPathover 90 bytes once expanded, or with characters other than letters, digits and- _ . / + %, which the adapter refuses when it decodes the configuration; - an
output.dirholding%or\, refused when a job is started or the probe submitted.
It is stricter in one: it lists only the local and ssh transports.
Durations are strings in Go's format, such as 10s, 2m or 1h30m, and must be positive.
In Go they are slurm.Duration, a time.Duration.
{
"transport": "ssh",
"ssh": { "host": "login.example.org", "user": "ada" },
"defaults": { "partition": "gpu", "account": "research" },
"output": { "dir": "$HOME/runs" },
"environment": { "pass": ["PATH", "HF_HOME"] },
"cessation": { "command": "/opt/site/nodes-clean", "timeout": "90s" },
"preflight": { "cacheDir": "/home/ada/.cache/dispatch-slurm", "maxAge": "12h" },
"timeouts": { "command": "3m" }
}
Top level¶
| Key | Go field | Type | Default | Meaning |
|---|---|---|---|---|
transport |
Transport |
local, ssh |
local |
how scripts reach the Slurm host. See Configure the transports |
ssh |
SSH |
object | none | the ssh options. Valid only with transport: ssh, and required with it |
defaults |
Defaults |
object | none | sbatch placement defaults |
output |
Output |
object | none | where each execution's output goes on the cluster |
environment |
Environment |
object | none | variables copied into the batch script |
singleton |
Singleton |
boolean | false |
submit with --dependency=singleton |
cessation |
Cessation |
object | none | the site command behind dispatch.CessationSignal |
preflight |
Preflight |
object | none | the preflight cache |
timeouts |
Timeouts |
object | none | bounds on commands |
The Go decoder also accepts a transport name added with slurm.RegisterTransport. The schema
lists only local and ssh.
ssh¶
Required when transport is ssh; refused otherwise. The set is closed: there is no way to pass an
arbitrary ssh option. Values are checked for characters ssh would misread. Paths are absolute and
may contain only letters, digits and - _ . / +.
| Key | Type | Default | Meaning |
|---|---|---|---|
host |
string, required | none | the login node: a host name, an address, or an ssh_config alias. Letters, digits and - _ . :; not starting with - |
user |
string | ssh's own | the remote user. Letters, digits and - _ .; not starting with - |
port |
integer, 1 to 65535 | ssh's own | the remote port |
identityFile |
absolute path | ssh's own | a private key, passed as IdentityFile |
proxyJump |
string | none | ssh's [user@]host[:port] jump list, comma separated. Letters, digits and - _ . : @ ,; not starting with - |
knownHostsFile |
absolute path | ssh's own | passed as UserKnownHostsFile |
configFile |
absolute path | ssh's own | passed as ssh -F |
connectTimeout |
duration | 10s |
ssh's ConnectTimeout, in whole seconds rounded up. Also added to the bound of each hold-family, requeue and cessation script |
controlPath |
absolute path, or none |
/tmp/dispatch-slurm-<uid>/%C |
the connection-sharing socket. <uid> becomes your numeric user id. At most 90 bytes once expanded, with %C counted as 40. %C and %% are the only ssh tokens allowed. none turns sharing off |
controlPersist |
duration | 60s |
how long the shared connection outlives its last use, in whole seconds rounded up. Not used when controlPath is none |
The adapter always adds -T, -o BatchMode=yes and -o StrictHostKeyChecking=yes. The default
controlPath directory is created with mode 0700; a configured one is not created.
defaults¶
sbatch placement defaults. A job's slurm.Placement extension overrides each field that it sets.
Every value is a non-empty string without control characters.
| Key | sbatch option |
|---|---|
partition |
--partition |
account |
--account |
qos |
--qos |
reservation |
--reservation |
constraint |
--constraint |
output¶
| Key | Type | Default | Meaning |
|---|---|---|---|
dir |
string | $HOME/.local/state/dispatch-slurm |
the directory on the cluster under which each job gets a directory named for its id. An absolute path, or one starting $HOME/, in which $HOME is the home directory preflight read on the host. It may not contain %, \, a newline or a tab |
The % and \ rule is checked when a job is started, not when the configuration is read, because
sbatch rewrites both in --output. A writable slurm.New that runs the preflight probe, because
it has no fresh cached result, checks it too, since the probe is a submission. See
How a job becomes an sbatch submission.
environment¶
| Key | Type | Default | Meaning |
|---|---|---|---|
pass |
array of strings | ["PATH"] |
names of variables to copy into the batch script. Each is a shell identifier ([A-Za-z_][A-Za-z0-9_]*), and none repeats. A name starting DISPATCH_ is refused with ErrInvalid when the configuration is decoded, because dispatch sets those variables itself |
The values are read on the Slurm host, in the environment the transport's shell sees, each
time a job is started, and written into the batch script as literals. A variable that is not set
there is not exported. An empty array passes nothing, which is not the same as omitting the key. Jobs are submitted with
--export=NIL, so the batch environment has no HOME; add it here if a job needs it.
Do not pass a secret this way. The values are written into the batch script as literal export
lines, and slurmctld stores the script: an administrator can read it, and accounting keeps it
where the cluster records job scripts. The same holds for JobSpec.Env.
A Go slurm.Config says the same with an empty, non-nil Pass slice, which survives
dispatch.Open; a nil slice means the default.
singleton¶
When true, every job is submitted with --dependency=singleton, so a later submission of the
same dispatch job (they share one Slurm job name) waits for the earlier one to end. The adapter checks the dependency on read-back, and refuses a
job whose dependency is not what it asked for.
cessation¶
The command a site supplies to say whether a job's processes have stopped. Without it, Ceased
returns dispatch.ErrUnsupported.
| Key | Type | Default | Meaning |
|---|---|---|---|
command |
string, required | none | run on the Slurm host through sh -c, with the Slurm job id as its first argument and the job's last execution's nodes, in Slurm's compressed form such as gpu-[01-03], as its second |
timeout |
duration | 60s |
the command is killed (timeout -s KILL) at this limit |
The command's exit status is the answer: 0 means ceased, 1 means not yet. Any other status,
or a kill at timeout, is an error and never evidence. The last 4 KiB of its combined output is
kept as the evidence's detail. It works on a read-only backend.
preflight¶
| Key | Type | Default | Meaning |
|---|---|---|---|
cacheDir |
absolute path | none | where the probe's result is kept, on the host the adapter runs on. Unset, nothing is cached. The directory must be a real directory of mode 0700 owned by the caller. A writable backend creates it so, if missing, when it writes its probe's result; a read-only backend never creates it. A cache found anywhere else, or through a symlink, is not read |
maxAge |
duration | 24h |
how long a cached result stays good |
timeouts¶
| Key | Type | Default | Meaning |
|---|---|---|---|
command |
duration | 2m |
the bound on every script that carries none of its own: reads, sbatch, scancel, scontrol release |
Rules between keys¶
sshwith atransportother thanssh, ortransport: sshwithoutssh, is refused.- A
transportname must belocal,sshor one registered withslurm.RegisterTransport. - No value may hold a control character (below 0x20, or 0x7f).
- Every failure names the key it is about.