Use qdel to delete all my jobs at once, not one at a time

SshCluster ComputingJobs

Ssh Problem Overview


This is a rather simple question but I haven't been able to find an answer.

I have a large number of jobs running in a cluster (>20) and I'd like to delete them all and start over.

According to this site I should be able to just do:

qdel -u netid

to get rid of them all, but in my case that returns:

qdel: invalid option -- 'u'
usage: qdel [{ -a | -c | -p | -t | -W delay | -m message}] [<JOBID>[<JOBID>]|'all'|'ALL']...
   -a -c, -m, -p, -t, and -W are mutually exclusive

which obviously indicates that the command does not work.

Just to check, I did:

qstat -u <username>

and I do get a list of all my jobs, but:

qdel -u <username>

also fails.

Ssh Solutions


Solution 1 - Ssh

Found the answer buried in an old supercluster.org thread:

qselect -u <username> | xargs qdel

Worked flawlessly.

Solution 2 - Ssh

Building on what Gabriel answered:

qselect -u <username> | xargs qdel

qselect -u <username> -s <state> | xargs qdel

<state> would be R for running jobs only.

qselect will allow you to select job based on other criterias, like ressources asked (-l), destination queue (-q) ...

qdel -u <username>

will only work with SGE

Solution 3 - Ssh

sometimes a simple grep/cut can help too:

qstat | grep $USER | cut -d. -f1 | xargs qdel

This way we can also grep on a particular keyword for the jobs and delete them.

HTH

Solution 4 - Ssh

Try

$ qdel {id1..id2}

So for example:

$ qdel {1148613..1148650}

Solution 5 - Ssh

For UGE:

qstat -u | gawk '{print $1}' | xargs qdel

Solution 6 - Ssh

# Delete all jobs owned by the current user.
# 
# Command breakdown:
# ------------------
#
# qselect
# -u selects all jobs that belong to the current user
# -s EHQRTW selects all job states except for Complete
#
# xargs
# --no-run-if-empty Do not run qdel if the result set is empty
#                   to avoid triggering a usage error.
#
# qdel
# -a delete jobs asynchronously
#
# The backslashes are a trick to avoid matching any shell aliases.

\qselect -u $(whoami) -s EHQRTW | \xargs --no-run-if-empty \qdel -a

Solution 7 - Ssh

Another possibility is to do qdel all. It deletes all jobs from everyone. When you don't have access for other people's job, it deletes only your jobs.

It is not the most beautiful solution, but it is surely the shortest!

Solution 8 - Ssh

qstat | cut -d. -f1 | sed "s;   \(.*\) 0;qdel \1;" | bash

sed's power.

Solution 9 - Ssh

Just use the following command:

qdel all           

It will cancel all jobs running on cluster.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGabrielView Question on Stackoverflow
Solution 1 - SshGabrielView Answer on Stackoverflow
Solution 2 - SshY. BoursinView Answer on Stackoverflow
Solution 3 - SshasifzubaView Answer on Stackoverflow
Solution 4 - SshCiaranWelshView Answer on Stackoverflow
Solution 5 - Sshteng_wenxuanView Answer on Stackoverflow
Solution 6 - SshJasonView Answer on Stackoverflow
Solution 7 - SshguhurView Answer on Stackoverflow
Solution 8 - SshMrMimicView Answer on Stackoverflow
Solution 9 - SshViral SolankiView Answer on Stackoverflow