user366202
user366202

Reputation: 249

Cancel all waiting jobs with qsub

I have submitted a lot of jobs to qsub and I want to cancel all those not currently running. Is there a way to do this without knowing all the jobIDs?

The answer in this question prompted me to try

qselect -u username -s qw | xargs qdel

but this did not work, and I do not want to accidentally delete my currently running jobs.

Upvotes: 0

Views: 1399

Answers (1)

Vaid
Vaid

Reputation: 11

The below combination worked for me, the output is dependant on the state of the job.

qstat -u | grep "state of the job" | awk 'print{ $1 }' | tr '\n' ' ' | xargs qdel

  1. qstat -u : displays all the jobs with respect the user.
  2. grep "state of the job" : Returns the line containing the state of the job. (r , qw and so on)
  3. awk 'print{ $1 }' : Print the first column. (In my case 1st column is Job ID)
  4. tr '\n' ' ' : Substitute the new line character with space.
  5. xargs qdel : Delete the jobs.

Upvotes: 1

Related Questions