3

I submitted lots of SLURM job script with debug time limit (I forgot to change the time for actual run). Now they are all submitted at the same time, so they all start with job ID 197xxxxx. Now, I can do

squeue -u $USER | grep 197 | awk '{print $1}' 

to print the job ID's I want to delete. But how do I use scancel command on all these ID's. The output from the above shell command would look like

19726664
19726663
19726662
19726661
19726660
19726659
19726658
19726657
19726656
19726655
19726654
19726653
19726652
19726651
19726650
6
squeue -u $USER | grep 197 | awk '{print $1}' | xargs -n 1 scancel

Check the documentation for xargs for details. If scancel accepts multiple job ids (it should), you may omit the -n 1 part.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.