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 | the defaults below | the sources behind dispatch.CessationSignal |
kubernetes |
Kubernetes |
object | none | the Kubernetes API server and credential, for the Kubernetes evidence source |
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¶
Which sources Ceased asks whether the processes of a job's last started execution have stopped.
Decoding always fills this section in, so an omitted one is the defaults below.
How the adapter proves a job's processes stopped explains which
source answers which case.
| Key | Type | Default | Meaning |
|---|---|---|---|
sources |
array of kubernetes, slurm-node, command |
["kubernetes", "slurm-node"], plus command when command is set |
the sources to ask. Each may appear once, and command only when command is set. [] is none |
bootTime |
kernel, unknown |
unknown |
whether a node's Slurm BootTime is the kernel's boot. Set kernel only where slurmd runs without -b on every node; never on Soperator, which runs it with -b. The slurm-node source is asked only under kernel |
command |
string | none | a site command, run on the Slurm host through sh -c, with the Slurm job id as its first argument and the execution's nodes, in Slurm's compressed form such as gpu-[01-03], as its second |
timeout |
duration | 60s |
the bound on one Ceased call, across every source and node. The command is killed (timeout -s KILL) at this limit |
Each source answers per node of the execution:
| Source | Ceased for a node when | Asked when |
|---|---|---|
kubernetes |
its pod is gone (404), or was created after the execution started. A pod from before the start is not ceased, even with its deletion pending | the kubernetes section is set, and slurm.New reached the API server, the credential may get pods, and the pod mapping resolved |
slurm-node |
scontrol show node shows it responding (not DOWN, NOT_RESPONDING or *) with a BootTime after the execution started: it rebooted |
bootTime is kernel |
command |
the command exits 0. Exit 1 is not yet, for every node. Any other status, or a kill at timeout, is that source's error and never evidence |
command is set |
The job has ceased when, for every node, at least one source says so. An error from one source is
not evidence: it appears in the detail, and Ceased returns an error only when every source it
asked fails. An execution with no nodes or no start is never ceased.
A source that cannot be asked is left out before the call. With none left, Ceased returns
dispatch.ErrUnsupported, and a shared-checkpoint hold waits for a person. Under the default
bootTime, that is the case on a cluster with no kubernetes section and no command.
The Kubernetes reads run beside the others. The slurm-node source and the command share the
transport and run one after the other, in the order sources lists them, inside the one timeout.
The evidence's detail gives each node's answer from each source, each source's error, and, when
slurm-node was in the list but left out, slurm-node is left out until cessation.bootTime is
kernel, then the command's combined output, whether it answered or failed. Those lines are kept
whole, and the output gets what is left of 4 KiB, cut from its front, so a command that prints a
lot cannot push out which source answered which node.
Ceased works on a read-only backend.
Warnings. When sources itself lists slurm-node and bootTime is not kernel, slurm.New
adds a warning naming cessation.bootTime to the backend's Warnings(). Under the default list
slurm-node is left out without one; the detail, or the ErrUnsupported error, names
cessation.bootTime instead.
A Go slurm.Config says "none" with an empty, non-nil Sources slice; a nil slice means the
default.
kubernetes¶
The API server of a Slurm cluster run on Kubernetes, such as Soperator, and a credential for it.
The Kubernetes evidence source reads two things through it: a node's pod, for Ceased and to tell
a node lost under a running job, and
slurmctld's log, to attribute a requeue dispatch did not make. Without this section the adapter
takes its Slurm-only paths.
| Key | Type | Default | Meaning |
|---|---|---|---|
server |
https:// URL, required |
none | the API server, as the caller reaches it, or as the login node does through ssh: https://kubernetes.default.svc:443 on Soperator. A scheme, host and port only: no path, query, fragment or credentials |
access |
direct, ssh, auto |
auto |
how to reach the server. auto tries direct, then through the ssh connection when transport is ssh. ssh needs transport: ssh |
tokenFile |
absolute path, required | none | a ServiceAccount token, on the host the adapter runs on, read by every slurm.New. It is never logged or stored |
caFile |
absolute path, required | none | the cluster's CA certificate, on the same host. TLS is verified against it with the host name in server, through ssh as directly |
namespace |
string, required | none | the namespace of the Slurm pods |
controllerPod |
string | controller-0 |
the pod slurmctld runs in |
controllerContainer |
string | slurmctld |
its container |
nodePod |
node-name |
node-name |
how a Slurm node maps to its pod: the pod of the same name. No other mapping exists yet |
The credential needs two rules, both get: pods in namespace, for the pod reads, and
pods/log on controllerPod, for the log. Give the adapter a ServiceAccount of its own with only these.
slurm.New reads the token and CA, reaches the server, asks which of the two rules the credential
holds, and resolves the pod of the first node of each partition sinfo lists. None of this fails
slurm.New. Each failure is a warning in Warnings(), and costs only what needs it: a file it
cannot read, or a server it cannot reach, turns the source off; a refused rule turns off what
needs that rule; a mapping it cannot confirm turns off the pod reads, since a wrong one would read
every node as gone, and leaves the log on.
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 |
sacct |
duration | 30s |
the bound on reading a job's execution history with sacct, which is killed on the Slurm host at this limit |
kubernetes |
duration | 10s |
the bound on each read of the Kubernetes API |
Rules between keys¶
sshwith atransportother thanssh, ortransport: sshwithoutssh, is refused.- A
transportname must belocal,sshor one registered withslurm.RegisterTransport. cessation.sourcesnaming a source twice, or namingcommandwithoutcessation.command, is refused.kubernetes.access: sshwith atransportother thansshis refused.- No value may hold a control character (below 0x20, or 0x7f).
- Every failure names the key it is about.