swait(1)

πŸ“¦ version 26.05.5.1, in arch rolling, epel 10, nixpkgs unstable, ubuntu stonking

πŸ’… 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 on stderr. 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 exit 1. SECS must be a non-negative integer. With no --timeout, or with --timeout=0, swait blocks 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:

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 over SLURM_JOB_ID. she's the favorite child.
  • SLURM_JOB_ID β€” Used to identify the job to monitor when no positional argument is given and SLURM_JOB_SLUID is not set. the backup bestie 🫢
  • SLURM_CONF β€” Location of the Slurm configuration file.

⭐ EXIT STATUS ⭐

  1. 0 β€” There are no running steps, and no pending async steps. we ate. πŸŽ‰
  2. 1 β€” --timeout elapsed before steps completed. they took too long. blocked. πŸ•
  3. 2 β€” swait encountered 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