Order of command execution
Pre-execution commands run in the following order:
The queue-level command
The application-level or job-level command. If you specify a command at both the application and job levels, the job-level command overrides the application-level command; the application-level command is ignored.
If a pre-execution command is specified at the …
|
Then the commands execute in the order of …
|
Queue, application, and job levels
|
|
Queue and application levels
|
Queue level
Application level
|
Queue and job levels
|
|
Application and job levels
|
|
Post-execution commands run in the following order:
The application-level command
The queue-level command
The job-level command
If both application-level (
POST_EXEC in
lsb.applications) and job-level post-execution commands are specified, job level post-execution overrides application-level post-execution commands.
If a post-execution command is specified at the …
|
Then the commands execute in the order of …
|
Queue, application, and job levels
|
|
Queue and application levels
|
Application level
Queue level
|
Queue and job levels
|
|
Pre-execution command behavior
A pre-execution command returns information to LSF by means of the exit status. LSF holds the job in the queue until the specified pre-execution command returns an exit code of zero (0). If the pre-execution command exits with a non-zero value, the job pends until LSF tries again to dispatch it. While the job remains in the PEND state, LSF dispatches other jobs to the execution host.
If the pre-execution command exits with a value of 99, the job exits without pending. This allows you to cancel the job if the pre-execution command fails.
You must ensure that the pre-execution command runs without side effects; that is, you should define a pre-execution command that does not interfere with the job itself. For example, if you use the pre-execution command to reserve a resource, you cannot also reserve the same resource as part of the job submission.
LSF users can specify a pre-execution command at job submission. LSF first finds a suitable host on which to run the job and then runs the pre-execution command on that host. If the pre-execution command runs successfully and returns an exit code of zero, LSF runs the job.
Post-execution command behavior
A post-execution command runs after the job finishes, regardless of the exit state of the job. Once a post-execution command is associated with a job, that command runs even if the job fails. You cannot configure the post-execution command to run only under certain conditions.
The resource usage of post-execution processing is not included in the job resource usage calculation, and post-execution command exit codes are not reported to LSF.
If
POST_EXEC=
$USER_POSTEXEC in either
lsb.applications or
lsb.queues, UNIX users can define their own post-execution commands:
setenv USER_POSTEXEC /path_name
where the path name for the post-execution command is an absolute path.
If POST_EXEC=$USER_POSTEXEC and …
|
Then …
|
The user defines the USER_POSTEXEC environment variable
|
LSF runs the post-execution command defined by the environment variable USER_POSTEXEC
After the user-defined command runs, LSF reports successful completion of post-execution processing
If the user-defined command fails, LSF reports a failure of post-execution processing
|
The user does not define the USER_POSTEXEC environment variable
|
|
Important: Do not allow users to specify a post-execution command when the pre- and post-execution commands are set to run under the root account.