0

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?

MakisH
  • 967
  • 1
  • 9
  • 23

3 Answers3

3

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" 
jyvet
  • 2,021
  • 15
  • 22
  • I hadn't thought of using the $USER variable, thanks! How much portable is it? Do also shells other than bash use the same variable? – MakisH Feb 03 '16 at 08:30
  • If you are worried about portably. you might want to use a command instead of an environment variable (I've made some changes in my answer ). – jyvet Feb 03 '16 at 22:35
3

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.

Community
  • 1
  • 1
Carles Fenoy
  • 4,740
  • 1
  • 26
  • 27
1

Newer versions of slurm accept

squeue --me

as a shortcut.

damienfrancois
  • 52,978
  • 9
  • 96
  • 110