SLURM squeue command (with examples)
- Linux
- November 5, 2023
The squeue
command is used to view the jobs queued in the SLURM scheduler. It provides detailed information about the jobs, such as the job ID, user, state, queue, partition, and expected start time. With various options, it can be used to filter the queue, view specific user’s jobs, and refresh the output periodically. In this article, we will explore different use cases of the squeue
command with examples.
Use Case 1: View the queue
The squeue
command without any arguments displays the entire queue. This is useful for viewing the status of all jobs in the scheduler.
squeue
Motivation: When you want to get an overview of the current state of the queue, you can use this command. It helps you quickly identify the number of pending jobs, running jobs, and their respective positions in the queue.
Example Output:
JOBID PARTITION NAME USER STATE TIME TIME_LEFT NODES NODELIST(REASON)
1234 general job1 user1 PENDING 1:00 1:59:59 4 node1,node2,node3,node4
5678 general job2 user2 RUNNING 0:05 1:54:55 1 node5
Use Case 2: View jobs queued by a specific user
The -u
option filters the queue to display only the jobs submitted by a specific user.
squeue -u username
Motivation: When you want to see the jobs submitted by a particular user, this option is handy. It allows you to focus on a specific user’s jobs without being overwhelmed by other entries in the queue.
Example Output:
JOBID PARTITION NAME USER STATE TIME TIME_LEFT NODES NODELIST(REASON)
1234 general job1 user1 PENDING 1:00 1:59:59 4 node1,node2,node3,node4
Use Case 3: View the queue and refresh every 5 seconds
The -i
option followed by an interval in seconds refreshes the queue output at the specified interval.
squeue -i 5
Motivation: When you want to continuously monitor the queue and receive live updates, using the -i
option with a smaller interval is useful. It helps you keep track of job changes, such as newly added jobs, completed jobs, or changes in job states.
Example Output:
JOBID PARTITION NAME USER STATE TIME TIME_LEFT NODES NODELIST(REASON)
1234 general job1 user1 PENDING 1:00 1:59:59 4 node1,node2,node3,node4
5678 general job2 user2 RUNNING 0:05 1:54:55 1 node5
Use Case 4: View the queue with expected start times
The --start
option displays the expected start times for pending jobs.
squeue --start
Motivation: When you want to know the approximate time when a pending job will start, using the --start
option provides the expected start times. This information can be helpful for understanding when your job is likely to be picked up by the scheduler.
Example Output:
JOBID PARTITION NAME USER STATE TIME TIME_LEFT NODES NODELIST(REASON) START_TIME
1234 general job1 user1 PENDING 1:00 1:59:59 4 node1,node2,node3,node4 2022-01-01T10:00:00
With these different use cases and corresponding examples, you can effectively utilize the squeue
command to monitor the SLURM scheduler and keep track of queued jobs. Whether it’s viewing the entire queue, filtering by user, refreshing the output periodically, or checking the expected start times, the squeue
command provides valuable insights into the status and progress of your jobs.