Introduction / Example Code

API Support

Download / Links / Credits / Author


PyLSF is a Python/Pyrex module to allow access to the version 6.2 of Platform HPC LSF batch scheduler.

Example Code

The LSF environment needs to be loaded before using the module and the LD_LIBRARY_PATH set in order to locate the LSF libraries i.e

# Source the LSF ksh environment
. /opt/share/lsf/conf/profile.lsf

# Set the Library path for the LSF libraries
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/share/lsf/6.2/linux2.6-glibc2.3-x86_64/lib/

Below is a PyLSF example that generates a subset of the bjob data structure.

>>> from pylsf import *
>>> a = lsb_init("pylsf")
>>> b = lsb_openjobinfo()
>>> for c in range(b):
...   data = lsb_readjobinfo(c)
...   print "%s %s %s %s %s %s %s %s" % \
...   (data[0],  data[1], data[2], data[19][1],\
...    data[16], data[17], data[19][0], data[4])
>>> lsb_closejobinfo()
107 mark 16 normal makalu.localnet ['makalu.localnet'] serialjob 1160330375

Last modified 2nd November 2008