SLURM job history: get full length JobName

Yoda picture Yoda · Jan 10, 2018 · Viewed 7.3k times · Source

I want to get information about my job history of SLURM jobs. I use something like

sacct --starttime 2014-07-01 --format=User,JobID,Jobname,partition,state,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist

to get a summary of my jobs, but it is difficult to keep track with the JobName section only showing a small part of my job names. I have many jobs where the name shares several words. I would the sacct command to show more of the job name, and preferentially the whole name. I notice that other column widths are made to fit the information below, so why not for JobName?

Answer

Carles Fenoy picture Carles Fenoy · Jan 19, 2018

From the sacct man page:

   -o, --format
             Comma separated list of fields. (use "--helpformat" for a list of available fields).
             NOTE: When using the format option for listing various fields you can put a %NUMBER afterwards to specify how many characters should be printed.
             e.g. format=name%30 will print 30 characters of field name right justified.  A %-30 will print 30 characters left justified.
             When set, the SACCT_FORMAT environment variable will override the default format.  For example:
             SACCT_FORMAT="jobid,user,account,cluster"

So you can simply specify the length of the Jobname field by adding %NUMBER after it.

It will look something like this:

sacct --starttime 2014-07-01 --format=User,JobID,Jobname%50,partition,state,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist

PS: try to avoid querying too many values from the database as it may take a long time and affect the correct behaviour of slurm. So reduce the time range to a reasonable value.