how to check if something is in the queue of torque?

Posted by kloop on Super User See other posts from Super User or by kloop
Published on 2012-11-24T15:20:32Z Indexed on 2012/11/24 17:07 UTC
Read the original article Hit count: 192

I want to re-run some jobs that completed prematurely under torque.

These jobs are run through .job scripts (using qsub). However, I don't want to re-run a job which is already in the queue.

Given a script filename, how can I know whether it is already in torque's queue (using qstat?) or not? I prefer to do it programmatically, of course, so any oneliner that searches for a given script name would be great.

I will note that I can grep submit_args in qstat -f, but I can't get it to display the whole script name when it is too long. This is crucial.

EDIT: I managed to solve it using the following command:

qstat -x | perl -pi -e 's/\<\//\n/g' | grep job$ | grep -v submit_args | perl -pi -e 's/Job_Id\>\<Job_Name\>//'

works because all my scripts end in the string "job".

© Super User or respective owner

Related posts about linux

Related posts about command-line