Skip to content

Partitions & QOS

Exercises

  1. Create a new partition for long-running jobs

Add a long partition in slurm.conf that uses nodes cpu[001-064], allows a maximum walltime of 14 days, and has a lower PriorityTier than the default batch partition. Apply the change and verify the partition exists.

Hint / Solution
# Add to slurm.conf:
#   PartitionName=long Nodes=cpu[001-064] MaxTime=14-00:00:00 DefaultTime=04:00:00 PriorityTier=50 State=UP

# Apply
scontrol reconfigure

# Verify
scontrol show partition long
sinfo -p long
Expected output: Validated 2026-10-19 on slurm-training-val (Slurm 25.11.8, ParallelCluster 3.16.1).
$ scontrol show partition val_long
PartitionName=val_long
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   AllocNodes=ALL Default=NO QoS=N/A
   DefaultTime=04:00:00 DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=14-00:00:00 MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
   Nodes=debug-dy-small-[1-2]
   PriorityJobFactor=1 PriorityTier=50 RootOnly=NO ReqResv=NO OverSubscribe=NO
   OverTimeLimit=NONE PreemptMode=OFF
   State=UP TotalCPUs=4 TotalNodes=2 SelectTypeParameters=NONE
   JobDefaults=(null)
   DefMemPerNode=UNLIMITED MaxMemPerNode=UNLIMITED
   TRES=cpu=4,mem=7782M,node=2,billing=4
   ResumeTimeout=GLOBAL SuspendTimeout=GLOBAL SuspendTime=GLOBAL PowerDownOnIdle=NO

$ sinfo -p val_long
PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST
val_long     up 14-00:00:0      2  idle~ debug-dy-small-[1-2]
  1. Create a QOS with specific resource limits

Create a QOS called restricted that limits each user to 32 CPUs and 2 GPUs across all their running jobs, and caps concurrent running jobs at 10 per user.

Hint / Solution
sacctmgr add qos restricted set \
    MaxTRESPerUser=cpu=32,gres/gpu=2 \
    MaxJobsPerUser=10 \
    Priority=0

# Verify
sacctmgr show qos restricted format=Name,MaxTRESPerUser,MaxJobsPerUser,Priority
Expected output: Validated 2026-10-19 on slurm-training-val (Slurm 25.11.8, ParallelCluster 3.16.1).
# exit=1
$ sudo /opt/slurm/bin/sacctmgr -i add qos val_pq_restricted set          MaxTRESPerUser=cpu=32,gres/gpu=2          MaxJobsPerUser=10          Priority=0
 Nothing new added.

$ sacctmgr show qos val_pq_restricted format=Name%-20,MaxTRESPerUser%-30,MaxJobsPerUser,Priority
Name                 MaxTRESPU                      MaxJobsPU   Priority 
-------------------- ------------------------------ --------- ---------- 
val_pq_restricted    cpu=32,gres/gpu=2                     10          0 
  1. Assign a QOS to an account

Allow all users in the smith_lab account to use both the normal and restricted QOS. Set normal as their default.

Hint / Solution
# Add the QOS to the account
sacctmgr modify account smith_lab set qos=normal,restricted defaultqos=normal

# Verify
sacctmgr show association where account=smith_lab format=Account,User,QOS,DefaultQOS
Expected output: Validated 2026-10-19 on slurm-training-val (Slurm 25.11.8, ParallelCluster 3.16.1).
$ sudo /opt/slurm/bin/sacctmgr -i modify account training set qos=normal,val_pq_restricted defaultqos=normal
 Modified account associations...
  C = slurm-training-val A = training of root

$ sacctmgr show association where account=training format=Account,User,QOS,DefaultQOS
   Account       User                  QOS   Def QOS 
---------- ---------- -------------------- --------- 
  training            normal,val_pq_restr+    normal 
  1. Test that a QOS limit prevents over-allocation

Create a test QOS called tiny that allows a maximum of 2 CPUs per user total. Assign it to a test user. Submit two single-CPU jobs (they should start), then submit a third and confirm it is held pending with a QOS limit reason.

Hint / Solution
# Create the restrictive QOS
sacctmgr add qos tiny set MaxTRESPerUser=cpu=2 MaxJobsPerUser=10

# Assign to a test user
sacctmgr modify user testuser set qos=tiny defaultqos=tiny

# As testuser, submit jobs:
su - testuser
sbatch --qos=tiny --wrap="sleep 300" -n 1
sbatch --qos=tiny --wrap="sleep 300" -n 1
sbatch --qos=tiny --wrap="sleep 300" -n 1

# Check status -- the third job should be pending
squeue -u testuser -o "%.8i %.2t %.20R"
# Expected reason: (QOSMaxCpuPerUserLimit) or (QOSMaxTRESPerUser)

# Clean up
scancel -u testuser
sacctmgr delete qos tiny
Expected output: Validated 2026-10-19 on slurm-training-val (Slurm 25.11.8, ParallelCluster 3.16.1).
$ squeue -u testuser1 -o '%.8i %.2t %.30R'
   JOBID ST               NODELIST(REASON)
     104 CF             batch-dy-compute-2
     105 PD        (QOSMaxCpuPerUserLimit)
     103  R             batch-dy-compute-1
  1. Classify a cluster's scheduling policy from read-outs

Using only read-only commands, decide which of these a cluster is: strict FIFO (minimal policy), fair-share, or QOS-priority with an honour-system queue jump. Name the evidence for each line of your verdict.

Hint / Solution
# QOS rows: do they differ only by Priority?
sacctmgr show qos format=name,priority,maxwall,grptres

# Fair-share vs QOS weight: is the QOS term dominant?
scontrol show config | grep -E 'PriorityType|PriorityWeight'
sshare -a -l

# Who may target which QOS and partition (-a shows hidden partitions)
scontrol -a show partition | grep -E 'PartitionName|Hidden|AllowGroups|AllowQos|MaxTime'
sacctmgr show assoc format=user,account,qos,defaultqos

# Minimal-policy signature
scontrol show config | grep -E 'SchedulerType|PriorityType|PreemptMode|SelectTypeParameters'
Read it as: - `sched/builtin` + `priority/basic` + `PreemptMode=OFF` + `MaxTime=UNLIMITED` + `CR_CPU` = strict FIFO; there is no fair-share to inspect. - `priority/multifactor` with `PriorityWeightQOS` orders of magnitude above `PriorityWeightFairShare`, QOS rows that differ only in `Priority`, and `AllowQos=ALL` = any user can queue-jump with `--qos=`; `sshare -a -l` shows FairShare varying while pending jobs still order by QOS. - Fair-share: weights of comparable magnitude, QOS carrying limits (`MaxTRESPerUser`, `MaxWall`) instead of only `Priority`. Expected output: Validated 2026-10-19 on slurm-training-val (Slurm 25.11.8, ParallelCluster 3.16.1).
$ sacctmgr show qos format=name,priority,maxwall,grptres
      Name   Priority     MaxWall       GrpTRES 
---------- ---------- ----------- ------------- 
    normal          0                           
      high        100                           
       low         10                           

$ scontrol show config | grep -E 'PriorityType|PriorityWeight'
PriorityType            = priority/multifactor
PriorityWeightAge       = 1000
PriorityWeightAssoc     = 0
PriorityWeightFairShare = 10000
PriorityWeightJobSize   = 0
PriorityWeightPartition = 1000
PriorityWeightQOS       = 10000
PriorityWeightTRES      = (null)

$ sshare -a -l 2>&1 | head -20
Account                    User  RawShares  NormShares    RawUsage   NormUsage  EffectvUsage  FairShare    LevelFS                    GrpTRESMins                    TRESRunMins 
-------------------- ---------- ---------- ----------- ----------- ----------- ------------- ---------- ---------- ------------------------------ ------------------------------ 
root                                          0.000000         834                  1.000000                                                      cpu=0,mem=0,energy=0,node=0,b+ 
 root                      root          1    0.006579           0    0.000000      0.000000   1.000000        inf                                cpu=0,mem=0,energy=0,node=0,b+ 
 pcdefault                               1    0.006579         799    0.958109      0.958109              0.006867                                cpu=0,mem=0,energy=0,node=0,b+ 
  pcdefault            ec2-user          1    0.500000         799    0.958109      1.000000   0.250000   0.500000                                cpu=0,mem=0,energy=0,node=0,b+ 
  pcdefault               slurm          1    0.500000           0    0.000000      0.000000   0.500000        inf                                cpu=0,mem=0,energy=0,node=0,b+ 
 research                               50    0.328947          34    0.041891      0.041891              7.852417                                cpu=0,mem=0,energy=0,node=0,b+ 
  research            testuser1          1    1.000000          34    0.041891      1.000000   0.750000   1.000000                                cpu=0,mem=0,energy=0,node=0,b+ 
 training                              100    0.657895           0    0.000000      0.000000                   inf                                cpu=0,mem=0,energy=0,node=0,b+ 

$ scontrol -a show partition | grep -E 'PartitionName|Hidden|AllowGroups|AllowQos|MaxTime'
PartitionName=batch
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   DefaultTime=NONE DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=UNLIMITED MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
PartitionName=debug
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   DefaultTime=NONE DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=UNLIMITED MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
PartitionName=gpu
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   DefaultTime=NONE DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=UNLIMITED MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
PartitionName=highmem
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   DefaultTime=NONE DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=UNLIMITED MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED

$ sacctmgr show assoc format=user,account,qos,defaultqos
      User    Account                  QOS   Def QOS 
---------- ---------- -------------------- --------- 
                 root               normal           
      root       root               normal           
            pcdefault               normal           
  ec2-user  pcdefault               normal           
     slurm  pcdefault               normal           
             research               normal           
 testuser1   research               normal    normal 
             training               normal    normal 

$ scontrol show config | grep -E 'SchedulerType|PriorityType|PreemptMode|SelectTypeParameters'
PreemptMode             = OFF
PriorityType            = priority/multifactor
SchedulerType           = sched/backfill
SelectTypeParameters    = CR_CPU_MEMORY

References