Week 10 · Day 1 — Slurm administration
← Master Plan · Week 10 overview · ← previous day · next day →
New domain: Administration (23%). Last week you installed Slurm; this week you run it — node lifecycle, accounting, QOS, fairshare. These are the verbs the exam’s hands-on labs test directly. Also on this week’s checklist: book the exam slot for ~Fri 2026-10-02 (see close-the-day).
Study block (2 h)
1. Node & partition operations (0:00–0:45)
sinfo state codes you must read at a glance: idle (free), mix (partially
allocated), alloc (full), drain/drng (no new jobs; drng = draining, jobs still
finishing), down (unreachable/failed) — and the suffix * = slurmd not responding.
The admin verb set, all through scontrol:
scontrol show node gpu01 # full node record incl. Reason
scontrol update nodename=gpu01 state=drain reason="nvml errors, maint"
scontrol update nodename=gpu01 state=resume # back to service
scontrol show partition gpu
scontrol update partitionname=gpu state=down # stop new scheduling, jobs keep running
scontrol update partitionname=gpu maxtime=12:00:00
Job control: scontrol hold <jobid> / release <jobid>, scancel <jobid> (or
scancel -u jdoe, scancel --state=PENDING -p gpu). Drain-then-maintain is the canonical
exam workflow: drain → wait for drng→drained → maintain → resume. A reason string is
mandatory on drain — and shows up in sinfo -R, which is where you look first when nodes
“disappear” from a partition.
The canonical maintenance loop — drain (with a reason), wait for drng to become drained, work, resume.
stateDiagram-v2
state "idle / mix / alloc" as up
state "drng (draining, jobs finishing)" as drng
state "drained (idle, no new jobs)" as drained
up --> drng: scontrol update state=drain reason=...
drng --> drained: last job finishes
drained --> up: scontrol update state=resume
note right of drained: maintain here — reason stays visible in sinfo -R
2. Accounting: the associations tree (0:45–1:15)
Everything policy-shaped in Slurm hangs off slurmdbd’s tree: cluster → account → user
(an “association” = one path through that tree, optionally per-partition). sacctmgr is
the only write-tool:
sacctmgr add account research Description="ml research"
sacctmgr add user jdoe account=research
sacctmgr modify account research set GrpTRES=gres/gpu=8 # group-wide GPU cap
sacctmgr show assoc tree format=account,user,grptres,qos%20
Everything policy-shaped hangs off this tree — an association is one cluster-to-account-to-user path.
flowchart TB
CL["cluster: lab"] --> R["account: research (GrpTRES=gres/gpu=8 caps the subtree)"]
CL --> P["account: prod"]
R --> U1["user: jdoe"]
R --> U2["user: asmith"]
P --> U3["user: klee"]
QOS["QOS: high (Priority, MaxWall, MaxTRESPerUser)"] -.->|"qos+= grants access per association"| U1
sacct vs sreport — a favorite MCQ distinction: sacct = per-job records (what did
job 1234 use); sreport = aggregated reports (cluster utilization by account last
month). sacct -j 1234 --format=JobID,Elapsed,TRESUsageInTot%40 vs
sreport cluster utilization start=2026-09-01.
3. QOS, preemption, fairshare (1:15–1:35)
A QOS is a named bundle of limits + priority that jobs attach to (sbatch --qos=high):
sacctmgr add qos high set Priority=100 MaxWall=04:00:00 MaxTRESPerUser=gres/gpu=2
sacctmgr modify user jdoe set qos+=high # grant access to it
Knobs to know: Priority, MaxWall, MaxTRESPerUser, GrpTRES, MaxJobsPerUser,
Preempt/PreemptMode. Preemption via QOS: PreemptType=preempt/qos in slurm.conf,
then a high QOS lists which QOSes it may preempt; PreemptMode=REQUEUE|CANCEL|SUSPEND
decides the victim’s fate. (Tomorrow you’ll see Run:ai/KAI do the same thing with queues.)
Fairshare: PriorityType=priority/multifactor computes job priority from weighted
factors — fairshare (past usage vs your share), age, job size, partition, QOS
(PriorityWeightFairshare=10000 etc. set the mix). Under-served accounts float up;
heavy users sink. Inspect with sshare (usage vs share) and sprio (per-pending-job
factor breakdown).
What breaks and how you notice: jobs rejected at submit with an association error →
user not in the account (AccountingStorageEnforce); --qos=high rejected → QOS exists
but the user’s association doesn’t include it; priorities look “stuck” → check sprio —
usually one weight dominates; slurmdbd down → submissions may still work but accounting
silently gaps, sacct goes quiet.
4. Do (1:35–2:00) — lab-slurm-basics.md Part C
On the container cluster: create account + user + QOS, submit with --qos, verify with
sacct; then drain/resume a node and read sinfo -R. This is exit-criterion #1 — do it
until it needs no docs.
Read next: https://slurm.schedmd.com/qos.html · https://slurm.schedmd.com/accounting.html
Quick check
sinfoshowsgpu01 drng. What exactly is happening, and how is it different fromdrained?- Which tool answers “how many GPU-hours did account research burn in June” —
sacctorsreport— and why? - Write from memory the sacctmgr line that creates a QOS with 4 h max walltime and a 2-GPU-per-user cap.
- What must be true in slurm.conf AND in the QOS definitions for QOS-based preemption to work?