sbatch
¶
The job scheduler consists of many
programs to manage jobs.
sbatch
is the program to submit a job to the scheduler.
flowchart TD
sbatch[sbatch: submit a job]
scancel[scancel: cancel a running job]
squeue[squeue: view the job queue]
sbatch --> |Oops| scancel
sbatch --> |Verify| squeue
After submitting a job, one can use squeue
to
verify the job is in the job queue. If there is an error in the sbatch
command, one can cancel a job using scancel
.
Minimal examples¶
There are two ways to demonstrate minimal use of sbatch
:
- with command-line Slurm arguments: easier to experiment with
- with Slurm parameters in the script: easier when you know what you need
These minimal examples use a run-time of a short, default time.
with command-line Slurm arguments¶
To let Slurm schedule a job, one uses sbatch
.
For Bianca and Rackham, one uses sbatch
like this:
For Snowy, one uses sbatch
like this:
Where:
-A [project_code]
: the project to use, for examplesens2017625
[script_filename]
: the name of a file that is a bash script, for example,my_script.sh
-M snowy
: if you use the Snowy computational resources
Filling this all in, for Bianca and Rackham:
Filling this all in, for Snowy:
What is my project?
How do I convert my project name to the project code I need to use here?
What is in the script file?
The script file my_script.sh
is a minimal example script.
Such a minimal example script could be:
with Slurm parameters in the script¶
The minimal command to use sbatch
with Slurm parameters in the script:
where [script_filename]
the name of a bash script, for example:
For Bianca and Rackham, the script must contain at least the following lines:
For Snowy, the script must contain at least the following lines:
With:
[project_code]
: the project code, for exampleuppmax2023-2-25
What is in the script file, for Bianca and Rackham?
A full example script would be:
What is in the script file, for Snowy?
A full example script would be:
More parameters¶
See the Slurm documentation on sbatch