1

How do you cancel jobs in Slurm that contain a word in job name? So for example let's say I do squeue in the terminal and get all my current jobs that are running.

JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
            468624   overcap ws_svea_   dyung6  R   12:37:16      1 brainiac
            468608   overcap fs_svea_   dyung6  R   13:47:57      1 smith
            468118   overcap fs_augcl   dyung6  R 1-15:51:38      1 gideon
            468119   overcap bc_augcl   dyung6  R 1-15:52:38      1 bb8
            468120   overcap bc_augcl   dyung6  R 1-15:52:38      1 jarvis
            468122   overcap bc_augcl   dyung6  R 1-15:52:38      1 jarvis
            467796   overcap ww_augcl   dyung6  R    2:06:08      1 asimo
            468609   overcap fs_svea_   dyung6  R   11:58:54      1 gideon
            468614   overcap ww_svea_   dyung6  R   11:58:54      1 gideon
            468615   overcap cs_svea_   dyung6  R   11:58:54      1 gideon
            469031   overcap ws_NNDrQ   dyung6  R    2:23:46      1 ig-88
            469032   overcap ws_NNDrQ   dyung6  R    2:23:45      1 ig-88

Then I want to cancel all jobs with augcl in the name. Is this possible?

2
  • Not really familiarized with slurm and I was unable to get it work on my system. But given that you want to cancel the jobs with augcl then the jobs ids to cancel are: 468118, 468119, 468120, 468122, 467796. Are they the jobs id you want to cancel? Nov 14, 2022 at 10:03
  • If so, I might give an answer (I searched that scancel cancels the given job). So I can provide an answer using some tools like grep, awk, xargs to be able to cancel the jobs. Do you have any problem If the solution uses those tools? Nov 14, 2022 at 10:07

1 Answer 1

0

Use squeue to get the list of your own jobs that are running with no headers. Now grep to find job names with your chosen string using awk to return the job IDs.

Now feed this into scancel.

Test with:

squeue --me --states=RUNNING --Format=jobid,name --noheader | grep augcl | awk '{print $1}' | xargs echo scancel

Then run with:

squeue --me --states=RUNNING --Format=jobid,name --noheader | grep augcl | awk '{print $1}' | xargs scancel

If you wanted to target all jobs regardless of state you can use --states=ALL and likewise you can target a particular state or states by changing this as needed e.g. --states=RUNNING,PENDING

*Note: not fully tested by me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .