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 PRE_EXEC or POST_EXEC 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.


Configuration file

Parameter and syntax

Behavior

lsb.queues

PRE_EXEC=command

  • Enables pre-execution processing at the queue 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.

POST_EXEC=command

  • Enables 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.

lsb.applications

PRE_EXEC=command

  • Enables 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.

POST_EXEC=command

  • Enables 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.


Examples

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

The following application specifies the pre-execution /usr/share/lsf/catia_prexec and the 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
PROCLIMIT    = 5               # job processor limit
PRE_EXEC       = /usr/share/lsf/catia_prexec
POST_EXEC      = /usr/share/lsf/catia_postexec
REQUEUE_EXIT_VALUES = 55 34 78
End Application