LSF Version 7.3 - Administering Platform LSF

About Pre-Execution and Post-Execution Commands
560 Administering Platform LSF
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 executable 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
Transferring data files needed for job processing
Modifying system configuration files before and after running a job
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 job-level, queue-level, and
application-level (
lsb.applications) 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 does not go back to
the PEND state, it exits. 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.