LSF Version 7.3 - Administering Platform LSF

Administering Platform LSF 563
Pre-Execution and Post-Execution Commands
If both queue and job-level pre-execution commands are specified, the
job-level pre-execution is run after the queue-level pre-execution command.
If both application-level and job-level post-execution commands are specified,
job level post-execution overrides application-level post-execution commands.
Queue-level post-execution commands run after application-level
post-execution and job-level post-execution commands
Example The following queue specifies the pre-execution command
/usr/share/lsf/pri_prexec and the post-execution command
/usr/share/lsf/pri_postexec.
Begin Queue
QUEUE_NAME = priority
PRIORITY = 43
NICE = 10
PRE_EXEC = /usr/share/lsf/pri_prexec
POST_EXEC = /usr/share/lsf/pri_postexec
End Queue
See the lsb.queues template file for additional queue examples.
Application-level commands
Use the PRE_EXEC and POST_EXEC keywords in the application profile
definition (
lsb.applications) to specify pre- and post-execution commands.
The following points should be considered when setting up pre- and post-execution
commands at the application level:
When a job finishes, the application-level post-execution commands run,
followed by queue-level post-execution commands if any.
Environment variables set for the job are also set for the pre- and
post-execution commands.
Queue-level pre-execution commands run before application-level
pre-execution commands. Job level pre-execution commands (
bsub -E)
override application-level pre-execution commands.
When a job is submitted to an application profile that has a pre-execution
command, the system will remember the post-execution command defined for
the application profile from which the job is dispatched. If the job is later moved
to another application profile or the post-execution command of the
application profile is changed, the original post-execution command will be
run.
When the post-execution command is run, the environment variable
LSB_JOBEXIT_STAT is set to the exit status of the job. Refer to the man page
for
wait(2) for the format of this exit status.
The post-execution command is also run if a job is requeued because the jobs
execution environment fails to be set up or if the job exits with one of the
application profiles REQUEUE_EXIT_VALUES. The environment variable
LSB_JOBPEND is set if the job is requeued. If the jobs execution environment
could not be set up, LSB_JOBEXIT_STAT is set to 0 (zero).