Configuration to enable pre- and post-execution processing

The pre- and post-execution processing feature is enabled by defining at least one of the parameters in the list below at the application or queue level, or by using the -E option of the bsub command to specify a pre-execution command. In some situations, specifying a queue-level or application-level pre-execution command can have advantages over requiring users to use bsub -E. For example, license checking can be set up at the queue or application level so that users do not have to enter a pre-execution command every time they submit a job.

Parameters for enabling the pre- and post-execution processing feature:

  • PRE_EXEC=command (in lsb.queues):

    • Enables job-based pre-execution processing at the queue level.

    • The job-based pre-execution command runs on the execution host before the job starts.

    • If the PRE_EXEC command exits with a non-zero exit code, LSF requeues the job to the front of the queue.

    • The PRE_EXEC command uses the same environment variable values as the job.

    • The PRE_EXEC command can only be used for job-based pre- and post-execution processing.

  • POST_EXEC=command (in lsb.queues):

    • Enables job-based post-execution processing at the queue level.

    • The POST_EXEC command uses the same environment variable values as the job.

    • The post-execution command for the queue remains associated with the job. The original post-execution command runs even if the job is requeued or if the post-execution command for the queue is changed after job submission.

    • Before the post-execution command runs, LSB_JOBEXIT_STAT is set to the exit status of the job. The success or failure of the post-execution command has no effect on LSB_JOBEXIT_STAT.

    • The post-execution command runs after the job finishes, even if the job fails.

    • Specify the environment variable $USER_POSTEXEC to allow UNIX users to define their own post-execution commands.

    • The POST_EXEC command can only be used for job-based pre- and post-execution processing.

  • PRE_EXEC=command (in lsb.applications):

    • Enables job-based pre-execution processing at the application level.

    • The pre-execution command runs on the execution host before the job starts.

    • If the PRE_EXEC command exits with a non-zero exit code, LSF requeues the job to the front of the queue.

    • The PRE_EXEC command uses the same environment variable values as the job.

    • The PRE_EXEC command can only be used for job-based pre- and post-execution processing.

  • POST_EXEC=command (in lsb.applications):

    • Enables job-based post-execution processing at the application level.

    • The POST_EXEC command uses the same environment variable values as the job.

    • The post-execution command for the application profile remains associated with the job. The original post-execution command runs even if the job is moved to a different application profile or is requeued, or if the post-execution command for the original application profile is changed after job submission.

    • Before the post-execution command runs, LSB_JOBEXIT_STAT is set to the exit status of the job. The success or failure of the post-execution command has no effect on LSB_JOBEXIT_STAT.

    • The post-execution command runs after the job finishes, even if the job fails.

    • Specify the environment variable $USER_POSTEXEC to allow UNIX users to define their own post-execution commands.

    • The POST_EXEC command can only be used for job-based pre- and post-execution processing.

  • HOST_PRE_EXEC=command (in lsb.queues):

    • Enables host-based pre-execution processing at the queue level.

    • The pre-execution command runs on all execution hosts before the job starts.

    • If the HOST_PRE_EXEC command exits with a non-zero exit code, LSF requeues the job to the front of the queue.

    • The HOST_PRE_EXEC command uses the same environment variable values as the job.

    • The HOST_PRE_EXEC command can only be used for host-based pre- and post-execution processing.

  • HOST_POST_EXEC=command (in lsb.queues):

    • Enables host-based post-execution processing at the queue level.

    • The HOST_POST_EXEC command uses the same environment variable values as the job.

    • The post-execution command for the queue remains associated with the job. The original post-execution command runs even if the job is requeued or if the post-execution command for the queue is changed after job submission.

    • Before the post-execution command runs, LSB_JOBEXIT_STAT is set to the exit status of the job. The success or failure of the post-execution command has no effect on LSB_JOBEXIT_STAT.

    • The post-execution command runs after the job finishes, even if the job fails.

    • Specify the environment variable $USER_POSTEXEC to allow UNIX users to define their own post-execution commands.

    • The HOST_POST_EXEC command can only be used for host-based pre- and post-execution processing.

  • HOST_PRE_EXEC=command (in lsb.applications):

    • Enables host-based pre-execution processing at the application level.

    • The pre-execution command runs on all execution hosts before the job starts.

    • If the HOST_PRE_EXEC command exits with a non-zero exit code, LSF requeues the job to the front of the queue.

    • The HOST_PRE_EXEC command uses the same environment variable values as the job.

    • The HOST_PRE_EXEC command can only be used for host-based pre- and post-execution processing.

  • HOST_POST_EXEC=command (in lsb.applications):

    • Enables host-based post-execution processing at the application level.

    • The HOST_POST_EXEC command uses the same environment variable values as the job.

    • The post-execution command for the application profile remains associated with the job. The original post-execution command runs even if the job is moved to a different application profile or is requeued, or if the post-execution command for the original application profile is changed after job submission.

    • Before the post-execution command runs, LSB_JOBEXIT_STAT is set to the exit status of the job. The success or failure of the post-execution command has no effect on LSB_JOBEXIT_STAT.

    • The post-execution command runs after the job finishes, even if the job fails.

    • Specify the environment variable $USER_POSTEXEC to allow UNIX users to define their own post-execution commands.

    • The HOST_POST_EXEC command can only be used for host-based pre- and post-execution processing.

Examples

The following queue specifies the job-based pre-execution command /usr/share/lsf/pri_prexec and the job-based 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

The following application specifies the job-based pre-execution /usr/share/lsf/catia_prexec and the job-based post-execution command /usr/share/lsf/catia_postexec.

Begin Application
NAME         = catia
DESCRIPTION  = CATIA V5
CPULIMIT     = 24:0/hostA      # 24 hours of host hostA
FILELIMIT    = 20000
DATALIMIT    = 20000           # jobs data segment limit
CORELIMIT    = 20000
Start of change TASKLIMIT    = 5               # job task limit End of change
PRE_EXEC       = /usr/share/lsf/catia_prexec
POST_EXEC      = /usr/share/lsf/catia_postexec
REQUEUE_EXIT_VALUES = 55 34 78
End Application
The following example specifies the host-based pre-execution command /usr/share/lsf/catia_host_prexec and the host-based post-execution command /usr/share/lsf/catia_host_postexec.
Begin Application
NAME = catia
DESCRIPTION = CATIA host_based pre/post
HOST_PRE_EXEC = /usr/share/lsf/catia_host_prexec
HOST_POST_EXEC = /usr/share/lsf/catia_host_postexec
End Application