[GE users] unbuffered qsub output

Olesen, Mark Mark.Olesen at arvinmeritor.com
Fri May 6 09:59:37 BST 2005


> From: Charu Chaubal [mailto:Charu.Chaubal at Sun.COM]
> Why not just submit the job with a known (unique) name using '-N
> <name>'?
> 
> Then, you can simply kill the job using 'qdel <name>'.

After pondering the problem a bit more, I've switched the approach.
Since the submitting working directory and that of the 'KILL_COMMAND' is
guaranteed to be unique, I use this information to kill the job - leaving
the job name readable for the user.
 
#!/bin/sh
unset USERNAME
for i in job.info; do [ -f $i ] && . $i; done
 
qstat="qstat -u ${USERNAME:-${USER:-nobody}}"

for job_id in `$qstat | awk '{ if ($1 ~ /^[0-9]+$/) print $1}'`
do
  cwd=`qstat -ext -j $job_id | sed -ne 's/^sge_o_workdir: *//p'`
  if [ "$cwd" = "$PWD" ]; then
    qdel $job_id
    break
  fi
done
 
exit 0


/mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net




More information about the gridengine-users mailing list