swait(1)
π swait(1) β okay bestie, we're waiting π
Slurm Commands Β· the "hold on, the async steps aren't done yet" tool
β¨ NAME β¨
swait β block until a job's running steps and pending --async steps complete. like a group chat where you're waiting for everyone to finish typing before you leave π
π¦ SYNOPSIS π¦
swait [OPTIONS] [jobid[_task] | s<sluid>]
πΈ DESCRIPTION πΈ
okay so. swait blocks until there are no running steps and no pending --async steps. That's it. That's the whole personality. Use swait in a batch script to wait for all your --async steps to complete, and then you can β¨move on with your lifeβ¨.
swait talks directly to the stepmgr. It does not poll slurmctld. no cap. Which means the target job must have stepmgr enabled β go check REQUIREMENTS, bestie, I'm not letting you skip it π.
The positional argument is one of these three icons:
- a numeric job ID
- a single array task (e.g.
1000_3) - a SLUID (e.g.
s4SNKN57XZTE00)
and the things that are NOT supported, because apparently we must say it out loud: task ranges, task lists, and het-job component offsets (jobid+offset). Not happening. When the target is an array job with more than one task, you must select a specific task with jobid_task. choose ur fighter π
With no positional argument, swait consults SLURM_JOB_SLUID first, and falls back to SLURM_JOB_ID. This is the main character move: it lets swait run inside a batch script or interactive allocation with no arguments at all and automatically wait on the enclosing job's steps. chef's kiss π
π OPTIONS π
-h,--helpβ Print help information and exit. classic.-Q,--quietβ Suppress informational messages from appearing onstderr. Errors will still be displayed (sorry, you can't hide from those). Mutually exclusive with--verbose. pick a lane, babe.--timeout=SECSβ Wait at most SECS seconds for the job's steps to drain, then exit1. SECS must be a non-negative integer. With no--timeout, or with--timeout=0,swaitblocks indefinitely until the steps drain. forever. in the group chat. until they answer.--usageβ Print a short usage line and exit. short and sweet fr fr.-v,--verboseβ Increase verbosity; may be specified multiple times for more detail. Mutually exclusive with--quiet. stack those v's like glow-up layers β¨-V,--versionβ Print version information and exit.
π REQUIREMENTS π
The target job must have stepmgr enabled, either:
- site-wide via
SlurmctldParameters=enable_stepmgrinslurm.conf(5), or - per-job via
--stepmgrtosalloc(1)/sbatch(1).
This can be verified with scontrol show job <jobid>; look for StepMgrEnabled=Yes. if you don't see that, the vibe check failed, bestie π
π ENVIRONMENT VARIABLES π
Some swait options may be set via environment variables. These environment variables, along with their corresponding options, are listed below.
Note: Command line options will always override these settings. always. no discussion π
SLURM_JOB_SLUIDβ Used to identify the job to monitor when no positional argument is given. Takes precedence overSLURM_JOB_ID. she's the favorite child.SLURM_JOB_IDβ Used to identify the job to monitor when no positional argument is given andSLURM_JOB_SLUIDis not set. the backup bestie π«ΆSLURM_CONFβ Location of the Slurm configuration file.
β EXIT STATUS β
0β There are no running steps, and no pending async steps. we ate. π1β--timeoutelapsed before steps completed. they took too long. blocked. π2βswaitencountered an error. something went wrong, no further comment π
π EXAMPLES π
Run multiple async steps from a batch script and block on them. The --stepmgr flag may be omitted if stepmgr is enabled site-wide.
#!/bin/bash
#SBATCH -n 16
#SBATCH --stepmgr
srun --async -n 8 ./solve_a
srun --async -n 8 ./solve_b
swait
swait is only for --async steps. If a script merely backgrounds srun commands with the shell, the shell's wait builtin already covers that case and swait is not needed. why are you doing extra work for no reason
The exception is when a script mixes both: run swait followed by wait so that the stepmgr's pending work and the shell's background processes have both finished:
#!/bin/bash
#SBATCH -n 16
#SBATCH --stepmgr
srun -n 8 ./solve_a &
srun --async -n 8 ./solve_b
swait
wait
yes queen, wait twice. hydrate and wait. π§
π COPYING π
Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved
This file is part of Slurm, a resource management program. For details, see <https://slurm.schedmd.com/>.
Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. fr fr read the license, it's giving "no promises"
π§ SEE ALSO π§
sacct(1), salloc(1), sbatch(1), scancel(1), scontrol(1), squeue(1), srun(1), slurm.conf(5)
π that's the whole page, bestie π
This one's from Slurm 26.05, living under the Slurm Commands umbrella. go forth and swait, and remember: if it's still pending, it's not your fault, it's just not done yet β¨π¦πΈ
π¦ where this page comes from
- arch rolling: slurm-llnl 26.05.5.1-1 Β· GPL-2.0-or-later
- epel 10: slurm 26.05.5-1.el10_3 Β· GPL-2.0-or-later AND BSD-2-Clause AND BSD-1-Clause
- nixpkgs unstable: slurm 26-05-5-1
- ubuntu stonking: slurm-client 26.05.4-1ubuntu1 Β· GPL-2.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms