[GE users] unbuffered qsub output
Mark.Olesen at arvinmeritor.com
Wed May 4 14:35:05 BST 2005
I have a somewhat annoying problem to solve.
The short question boils down to "how can a calling process access the
job_id of a pending job that was submitted via 'qsub -sync y'?"
Here is the background information:
I have software (running under windows & unix) that uses sockets to send its
jobs to a unix machine for remote execution. On the unix side, the shell
script called looks something like this:
if [ -z "$JOB_ID" ]; then
cat<<PRINT > job.LOG
tail -10f job.LOG &
idtail=$!; # kill later
trap 'kill $idtail' HUP INT QUIT ABRT KILL SEGV TERM CHLD STOP EXIT
# submit and block until the job is done
$SGE_BINARY_PATH/qsub -sync y -o job.LOG $0 $@
# main entry point for qsub job
#$ -S /bin/sh -cwd -j y -N gtp -o gtp.o$JOB_ID
echo "(II) job_id $JOB_ID"
I am using the backgrounded 'tail' command so that the user sees the
activity in the output window.
When the user closes the output window, a kill script is started that can be
used to kill the remote simulation and perform other cleanup operations.
Currently, the kill script finds the JOB_ID based on the "(II) job_id"
string appearing in the job.LOG file and uses this information for a qdel.
The design flaw is that this information is only written into the log file
when a job starts running. If the user cancels the remote simulation while
the job is still pending, this JOB_ID information is not available.
I had the idea of using "qsub ... >> job.LOG" to capture the string
Your job 6319 ("sleeper") has been submitted
However, when the '-sync y' option is used, this output is buffered.
How can I access the job id for such a pending job?
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