25.06.2015 Views

Administering Platform LSF - SAS

Administering Platform LSF - SAS

Administering Platform LSF - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using esub<br />

General esub logic<br />

Rejecting jobs<br />

Example<br />

After esub runs, <strong>LSF</strong> checks:<br />

1 Is the esub exit value LSB_SUB_ABORT_VALUE?<br />

a Yes, step 2<br />

b No, step 4<br />

2 Reject the job<br />

3 Go to step 5<br />

4 Does LSB_SUB_MODIFY_FILE or LSB_SUB_MODIFY_ENVFILE exist?<br />

❖ Apply changes<br />

5 Done<br />

Depending on your policies you may choose to reject a job. To do so, have<br />

esub exit with LSB_SUB_ABORT_VALUE.<br />

If esub rejects the job, it should not write to either LSB_SUB_MODIFY_FILE or<br />

LSB_SUB_MODIFY_ENVFILE.<br />

The following Bourne shell esub rejects all job submissions by exiting with<br />

LSB_SUB_ABORT_VALUE:<br />

#!/bin/sh<br />

# Redirect stderr to stdout so echo can be used for<br />

# error messages<br />

exec 1>&2<br />

# Reject the submission<br />

echo "<strong>LSF</strong> is Rejecting your job submission..."<br />

exit $LSB_SUB_ABORT_VALUE<br />

Validating job submission parameters<br />

#!/bin/sh<br />

Example<br />

. $LSB_SUB_PARM_FILE<br />

One use of validation is to support project-based accounting. The user can<br />

request that the resources used by a job be charged to a particular project.<br />

Projects are associated with a job at job submission time, so <strong>LSF</strong> will accept any<br />

arbitrary string for a project name. In order to ensure that only valid projects<br />

are entered and the user is eligible to charge to that project, an esub can be<br />

written.<br />

The following Bourne shell esub validates job submission parameters:<br />

# Redirect stderr to stdout so echo can be used for error messages<br />

exec 1>&2<br />

# Check valid projects<br />

if [ $LSB_SUB_PROJECT_NAME != "proj1" -o $LSB_SUB_PROJECT_NAME != "proj2" ];<br />

then<br />

384<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!