FreeBSD Manual Pages
swait(1) Slurm Commands swait(1) NAME swait - Block until a job's running steps and pending --async steps complete SYNOPSIS swait [OPTIONS] [jobid[_task] | s<sluid>] DESCRIPTION swait blocks until there are no running steps and no pending --async steps. Use swait in a batch script to wait for all --async steps to complete. swait talks directly to the stepmgr; it does not poll slurmctld. The target job must have stepmgr enabled (see REQUIREMENTS). The positional argument is a numeric job ID, a single array task (e.g. 1000_3), or a SLUID (e.g. s4SNKN57XZTE00). Task ranges, task lists, and het-job component offsets (jobid+offset) are not supported. When the target is an array job with more than one task, a specific task must be selected with jobid_task. With no positional argument, swait consults SLURM_JOB_SLUID first, and falls back to SLURM_JOB_ID. This lets swait run inside a batch script or interactive allocation with no arguments and automatically wait on the enclosing job's steps. OPTIONS -h, --help Print help information and exit. -Q, --quiet Suppress informational messages from appearing on stderr. Er- rors will still be displayed. Mutually exclusive with --verbose. --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. --usage Print a short usage line and exit. -v, --verbose Increase verbosity; may be specified multiple times for more de- tail. Mutually exclusive with --quiet. -V, --version Print version information and exit. REQUIREMENTS The target job must have stepmgr enabled, either site-wide via Slurm- ctldParameters=enable_stepmgr in slurm.conf(5), or per-job via --step- mgr to salloc(1)/sbatch(1). This can be verified with scontrol show job <jobid>; look for StepMgrEnabled=Yes. ENVIRONMENT VARIABLES Some swait options may be set via environment variables. These environ- ment variables, along with their corresponding options, are listed be- low. (Note: Command line options will always override these settings.) SLURM_JOB_SLUID Used to identify the job to monitor when no positional argument is given. Takes precedence over SLURM_JOB_ID. SLURM_JOB_ID Used to identify the job to monitor when no positional argument is given and SLURM_JOB_SLUID is not set. SLURM_CONF Location of the Slurm configuration file. EXIT STATUS 0 There are no running steps, and no pending async steps. 1 --timeout elapsed before steps completed. 2 swait encountered an error. 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. 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 COPYING Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved This file is part of Slurm, a resource management program. For de- tails, 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 op- tion) 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. SEE ALSO sacct(1), salloc(1), sbatch(1), scancel(1), scontrol(1), squeue(1), srun(1), slurm.conf(5) Slurm 26.05 Slurm Commands swait(1)
NAME | SYNOPSIS | DESCRIPTION | OPTIONS | REQUIREMENTS | ENVIRONMENT VARIABLES | EXIT STATUS | EXAMPLES | COPYING | SEE ALSO
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=swait&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>
