Python/Batch

From ScientificComputing
Revision as of 08:22, 27 October 2016 by Sfux (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For small tests, pre- and post-processing with Python, you can start an interactive sessions on one of the login nodes. All other Python jobs have to be submitted through the batch system. You can submit a Python job (my_python_script.py) in batch mode with the following command:

bsub [LSF options] "python my_python_script.py"

Here you need to replace [LSF options] with LSF parameters for the resource requirements of the job. Please find a documentation about the parameters of bsub on the wiki page about the batch system.

When you specify the Python interpreter on the first line of your script, then please use

#!/usr/bin/env python

instead of

#!/usr/bin/python

Otherwise the Python interpreter from the operating system will be called when you directly execute the script with

./my_python_script.py

instead of

python ./my_python_script.py

The Python interpreter from the operating system is older and does not have the additional packages installed.