25.06.2015 Views

Administering Platform LSF - SAS

Administering Platform LSF - SAS

Administering Platform LSF - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Configuring Pre- and Post-Execution Commands<br />

Configuring Pre- and Post-Execution Commands<br />

Job-level commands<br />

Example<br />

Queue-level commands<br />

Pre- and post-execution commands can be configured at the job level or on a<br />

per-queue basis.<br />

Job-level pre-execution commands require no configuration. Use the bsub -E<br />

option to specify an arbitrary command to run before the job starts.<br />

The following example shows a batch job that requires a tape drive. The user<br />

program tapeCheck exits with status zero if the specified tape drive is ready:<br />

% bsub -E "/usr/share/bin/tapeCheck /dev/rmt01" myJob<br />

Use the PRE_EXEC and POST_EXEC keywords in the queue definition<br />

(lsb.queues) to specify pre- and post-execution commands.<br />

The following points should be considered when setting up pre- and postexecution<br />

commands at the queue level:<br />

◆ If the pre-execution command exits with a non-zero exit code, then it is<br />

considered to have failed and the job is requeued to the head of the queue.<br />

This feature can be used to implement customized scheduling by having<br />

the pre-execution command fail if conditions for dispatching the job are<br />

not met.<br />

◆ Other environment variables set for the job are also set for the pre- and<br />

post-execution commands.<br />

◆ When a job is dispatched from a queue which has a pre-execution<br />

command, <strong>LSF</strong> will remember the post-execution command defined for the<br />

queue from which the job is dispatched. If the job is later switched to<br />

another queue or the post-execution command of the queue is changed,<br />

<strong>LSF</strong> will still run the original post-execution command for this job.<br />

◆ When the post-execution command is run, the environment variable,<br />

LSB_JOBEXIT_STAT, is set to the exit status of the job. See the man page<br />

for the wait(2) command for the format of this exit status.<br />

◆ The post-execution command is also run if a job is requeued because the<br />

job’s execution environment fails to be set up, or if the job exits with one<br />

of the queue’s REQUEUE_EXIT_VALUES.<br />

The LSB_JOBPEND environment variable is set if the job is requeued. If the<br />

job’s execution environment could not be set up, LSB_JOBEXIT_STAT is set<br />

to 0.<br />

See “Automatic Job Requeue” on page 301 for more information.<br />

◆ If both queue and job-level pre-execution commands are specified, the joblevel<br />

pre-execution is run after the queue-level pre-execution command.<br />

368<br />

<strong>Administering</strong> <strong>Platform</strong> <strong>LSF</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!