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

2019-03-08 02:05发布

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.

9条回答
smile是对你的礼貌
2楼-- · 2019-03-08 02:06
# 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
查看更多
劫难
3楼-- · 2019-03-08 02:08

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

qselect -u <username> | xargs qdel

Worked flawlessly.

查看更多
不美不萌又怎样
4楼-- · 2019-03-08 02:09

Try

$ qdel {id1..id2}

So for example:

$ qdel {1148613..1148650}
查看更多
狗以群分
5楼-- · 2019-03-08 02:12

Just use the following command:

qdel all           

It will cancel all jobs running on cluster.

查看更多
可以哭但决不认输i
6楼-- · 2019-03-08 02:23

Cannot comment, but 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

查看更多
何必那么认真
7楼-- · 2019-03-08 02:23
qstat | cut -d. -f1 | sed "s;   \(.*\) 0;qdel \1;" | bash

sed's power.

查看更多
登录 后发表回答