[GE users] per (array) job epilog

murple andreas.kuntzagk at mdc-berlin.de
Tue Jun 30 10:31:28 BST 2009


Hi,

 >> I have the feeling I'm missed something in the doku. I only found a
 >> way
 >> to set an epilog for a queue. But I want to have a job specific
 >> epilog.
 >> (for cleanup even if the job failed or was qdel'ed). Is there such a
 >> thing or do I need to invent my own using the queue epilog and some
 >> clever mechanism?
 >
 > Our prolog/epilog mechanism uses the requested resources to
 > differentiate between job types:
 >
 > # (hard) requested resources
 > rclist=$($SGE_BINARY_PATH/qstat -r -j $JOB_ID | \
 >   sed -ne 's/^.*hard *resource_list: */,/p')
 >
 >
 > case "$rclist," in
 > *,abc=*)
 >     echo do something
 >     ;;
 > *,def=*)
 >     echo do something else
 >     ;;
 > esac
 >
 >
 > Another possibility is to simply schedule a cleanup job that should run
 > immediately after the main job.
 >
 > # step 1: submit our job ($0) and remember job id for the cleanup/kill
 > job_id=$($SGE_BINARY_PATH/qsub -o $logFile -terse $0 $@ 2>&1)
 > exitcode=$?
 > # check exitcode etc.
 > ...
 > # step 2: submit cleanup/kill job
 > # cd HOME to avoid any weird open file-descriptors
 > # but provide spoolDir (or whatever) via job context
 > echo "schedule cleanup job"
 > ( cd $HOME && qsub -N _$job_id -hold_jid $job_id -sc spoolDir=$spoolDir
 > $0-cleanup )
 >
 >
 > To make sure the cleanup job runs immediately, you can give it a high
 > priority and/or send it to a special 'schedule' queue that only runs
 > these sorts of jobs. Since the load of these jobs is minimal, you can
 > just create a 'schedule' queue with many slots on your qmaster node.

I'd rather go with variant 2 except the cleanup has to run on the same 
node (or all nodes of an array job) to remove some temp files.
I just figured I will do this outside SGE using some cron script since 
it does not need to be run immediately. That seems more simple to me 
(and I'm fan of KISS)

regards, Andreas

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=204559

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list