Creating reservations in Slurm allow an Operator to book a time slot in the future on a particular partition, for a specific timespan, and for a specific user.
Who can create reservations?
The privilege to create or remove reservations is restricted to users with Operator access. There should be one Operator per department, who will grant reservations for users who request this. To ask for Operator access, please open a ticket for Linux HPC.
Creating a reservation
Creating a reservation is possible through the command line interface while logged in to hpc-batch. A reservation is assigned to a particular username, and this username can be anybody who has an account in the cluster. In addition, one has to specify a start date, a duration (in the same format as the
--time sbatch parameter), a partition, and the number of nodes that will be allocated for this reservation.
See the following example:
scontrol create reservation user=username starttime="2019-11-12" Duration=5-0 NodeCnt=47 Partition=inf-short
Slurm will guarantee that the amount of nodes at this start time and in this partition is available. If this can not be guaranteed, the creation will not be created, and Slurm will output the following error:
Error creating the reservation: Requested nodes are busy
If so, please try with a later start time.
When the reservation is successful, Slurm will return a reservation identifier:
Reservation created: username_3
Listing existing reservations
One can also list existing reservations using the following command:
scontrol show reservations
Using a reservation
To launch a job in the context of a reservation, you may launch your job as usual, except one must associate the job with the reservation by adding an
#SBATCH line with
--reservation=, or by using
--reservation= when invoking sbatch or srun.
sbatch --reservation=username_3 my_submission.sh
Important things to know about reservations
Please note that it is possible to queue a job associated with a reservation before the time slot of that reservation has begun. The reservation will also hold while it has not been canceled. Therefore, a job which fails to start or which finishes early will not cancel the reservation automatically.
Consequently, on one hand this is useful in case the job fails to start, as one can just restart the job without losing its place in the queue. However, please take care to cancel reservations if the resources are no longer needed, since Slurm will retain those resources until the reservation period has ended, even if no job is running.
Canceling a reservation
To cancel a reservation, use the following command:
scontrol delete ReservationName=username_3