59

Is it possible to expand the number of characters used in the JobName column of the command sacct in SLURM?

For example, I currently have:

       JobID    JobName    Elapsed      NCPUS   NTasks      State 
------------ ---------- ---------- ---------- -------- ---------- 
12345      lengthy_na+   00:00:01         4         1      FAILED 

and I would like:

       JobID    JobName    Elapsed      NCPUS   NTasks      State 
------------ ---------- ---------- ---------- -------- ---------- 
12345      lengthy_name   00:00:01         4         1      FAILED 
br19
  • 811
  • 1
  • 8
  • 11

2 Answers2

69

You should use the format option, with:

sacct --helpformat

you'll see the parameters to show, for instance:

sacct --format="JobID,JobName%30"

will print the job id and the name up to 30 characters:

       JobID                        JobName
------------ ------------------------------
19009                                  bash
19010                             launch.sh
19010.0                     hydra_pmi_proxy
19010.1                     hydra_pmi_proxy

Now, you can to customize your own output.

Bub Espinja
  • 4,029
  • 2
  • 29
  • 46
  • 8
    do we really need to type this very long string everytime we want to see a list of running jobs and their full names? Not to mention that run-time and other details such as memory usage would require an even longer command – Parsa Jul 30 '18 at 09:24
  • 2
    @par: Yes, because the default format is definded with a limit. However, you can define a variable (in this case `SACCT_FORMAT`) to override the default behaviour. – Sethos II Dec 09 '19 at 06:36
  • Afterwards how can I get complete information related to each individual job using their id? @Bub Espinja – alper Jul 17 '20 at 18:40
  • 1
    You always can use "sacct -j --long" for that purpose. – Bub Espinja Jul 19 '20 at 20:28
  • 7
    @Parsa I have this in my ~/.bashrc: ```alias sl='SLURM_TIME_FORMAT="%d %H:%M:%S" sacct -X --format=JobID,JobName%12,Priority,Submit%12,Start%12,Elapsed,NCPU,CPUTime,ExitCode,State'``` Please excuse the weird line wraps due to Stack Overflow :( – Duncan MacIntyre Jul 29 '21 at 19:13
  • Thank you @DuncanMacIntyre – Parsa Aug 04 '21 at 20:38
51

To retrieve my list of SLURM jobs running I use the default format with 30 characters showing for job names using the bash command below:

squeue --format="%.18i %.9P %.30j %.8u %.8T %.10M %.9l %.6D %R" --me

If you want to show more job name characters simply change the number of %.30j.

w. Patrick Gale
  • 1,643
  • 13
  • 22
  • 7
    Hint: I added this (using `alias squeue='squeue --format="..."'`) to my .bashrc to preserve my sanity. – MrArsGravis Mar 29 '22 at 15:42
  • 3
    @MrArsGravis: In fact you do not need to alias that. Simply put the format in the environment variable `SQUEUE_FORMAT` – s.ouchene Mar 29 '23 at 21:35