About pre- and post-execution processing

You can use the pre- and post-execution processing feature to run commands before a batch job starts or after it finishes. Typical uses of this feature include the following:
  • Reserving resources such as tape drives and other devices not directly configurable in LSF

  • Making job-starting decisions in addition to those directly supported by LSF

  • Creating and deleting scratch directories for a job

  • Customizing scheduling based on the exit code of a pre-execution command

  • Checking availability of software licenses

  • Assigning jobs to run on specific processors on SMP machines

  • Transferring data files needed for job execution

  • Modifying system configuration files before and after job execution

  • Using a post-execution command to clean up a state left by the pre-execution command or the job

Pre-execution and post-execution commands can be defined at the queue, application, and job levels.

The command path can contain up to 4094 characters for UNIX and Linux, or up to 255 characters for Windows, including the directory, file name, and expanded values for %J (job_ID) and %I (index_ID).

When JOB_INCLUDE_POSTPROC is defined in an application profile, a job is considered in RUN state while the job is in post exec stage (which is DONE state for regular jobs). When the job is also resizable, job grow requests are ignored. However job shrink requests can be processed. For either case, LSF does not invoke the job resized notification command.

Default behavior (feature not enabled)

With pre- and post-execution processing enabled at the queue or application level

The following example illustrates how pre- and post-execution processing works for setting the environment prior to job execution and for transferring resulting files after the job runs.

Any executable command line can serve as a pre-execution or post-execution command. By default, the commands run under the same user account, environment, home directory, and working directory as the job. For parallel jobs, the commands run on the first execution host.

Scope


Applicability

Details

Operating system

  • UNIX

  • Windows

  • A mix of UNIX and Windows hosts

Dependencies

  • UNIX and Windows user accounts must be valid on all hosts in the cluster and must have the correct permissions to successfully run jobs.

  • On a Windows Server 2003, x64 Edition platform, users must have read and execute privileges for cmd.exe.

Limitations

  • Applies to batch jobs only (jobs submitted using the bsub command)