How to see the current user's queue in SLURM

2.4k Views Asked by At

On a cluster that is managed by SLURM, I want to check the queue of the current user (and cluster). Normally, I have to use this command:

squeue --user=username --clusters=clustername

The problem with this, apart from the fact that this is a rather long command to use frequently, is that it needs the username. I have created a script in which at some point I want to check the queue of the user, but I have to get the username first.

I have a workaround for all these, but it would be great if I could use a command like the respective one for LoadLeveller:

llu

Is there anything like that? Or can I somehow specify the "current user" in the --user flag?

3

There are 3 best solutions below

2
On BEST ANSWER

You may use an alias in the /etc/bashrc file (or ~/.bashrc for some users):

alias llu="squeue --user=$USER --clusters=clustername"

EDIT

You could also use this alias which does not depend on an environment variable:

alias llu="squeue --user=`whoami` --clusters=clustername" 

or

alias llu="squeue --user=`logname` --clusters=clustername" 
0
On

You can simply use squeue -u $LOGNAME. If you want to query for the jobs on the current cluster it should be the default behavior without having to add the --clusters parameter, so this way the squeue command becomes simplier.

According to this answer https://unix.stackexchange.com/a/76369, $LOGNAME should always be defined in the environment, so this should be completely portable.

2
On

Newer versions of slurm accept

squeue --me

as a shortcut.