Platform LSF Administration Guide Version 6.2
About Pre-Execution and Post-Execution Commands
Administering Platform LSF
480
About Pre-Execution and Post-Execution Commands
Each batch job can be submitted with optional pre- and post-execution commands. Pre-
and post-execution commands can be any excutable command lines to be run before a
job is started or after a job finishes.
Some batch jobs require resources that LSF does not directly support. For example,
appropriate pre- and/or post-execution commands can be used to handle various
situations:
◆
Reserving devices like tape drives
◆
Creating and deleting scratch directories for a job
◆
Customized scheduling
◆
Checking availability of software licenses
◆
Assigning jobs to run on specific processors on SMP machines
By default, the pre- and post-execution commands are run under the same user ID,
environment, and home and working directories as the batch job. If the command is not
in your normal execution path, the full path name of the command must be specified.
For parallel jobs, the command is run on the first selected host.
Pre-execution commands
Pre-execution commands support job starting decisions which cannot be configured
directly in LSF. LSF supports both job-level and queue-level pre-execution.
The pre-execution command returns information to LSF using its exit status. When a
pre-execution command is specified, the job is held in the queue until the specified pre-
execution command returns exit status zero (0).
If the pre-execution command exits with non-zero status, the batch job is not
dispatched. The job goes back to the PEND state, and LSF tries to dispatch another job
to that host. While the job is pending, other jobs can proceed ahead of the waiting job.
The next time LSF tries to dispatch jobs this process is repeated.
If the pre-execution command exits with a value of 99, the job will not go back to the
PEND state, it will exit. This gives you flexibility to abort the job if the pre-execution
command fails.
LSF assumes that the pre-execution command runs without side effects. For example,
if the pre-execution command reserves a software license or other resource, you must
not reserve the same resource more than once for the same batch job.
Post-execution commands
If a post-execution command is specified, then the command is run after the job is
finished regardless of the exit state of the job.
Post-execution commands are typically used to clean up some state left by the pre-
execution and the job execution. Post-execution is only supported at the queue level.