Link to base version:
https://github.com/IBMSpectrumComputing/lsf-faas
lsf_faas Modification Summary (lsf function as a service)
Problem Statement: lsf_faas is an open-source python client package that wraps the pacclient webservice interface to Spectrum Application Center. While lsf_faas supports a wide variety of lsf commands including bsub execution, it does not support the full range of bsub options. This enhancement overcomes this limitation.
lsf_faas Background: lsf_faas enables callers to submit python code and various commands to LSF for remote execution. lsf_faas passes python code, input files, and execution parameters to the LSF (The GENERIC application template is referenced by default).
The lsf_faas package contains three key files: init.py, lsf.py, and lsflib.py:
• lsf.py is imported by application programs as the interface to lsf_faas.
lsf.py implements a number of methods that can be called from an application.
These include: lsf.sub(…), lsf.exe(…), lsf.logon(…), lsf.logout(…), and lsf.get(…).
lsf.sub and lsf.exe enable python code to be passed along with input files for execution on LSF.
• lsflib.py is imported by to handle the webservice interface to LSF. lsf.py implements the __submit(…) function which invokes the submitJob(…) function within lsflib.py
• init imports the lsf () class definition from lsf.py
Salient Method Call Sequence: lsf.sub passes LSF job parameters to __submit method, which in turn passes the parameters to submitJob. submitJob formats and handles the http webservice request.

Modifications: The enhancement exploits the flexibility in the webservice API, and in the GENERIC template to handle additional parametrization. Enhancements were made in lsf.py and lsflib.py as follows:
-
lsf.sub and lsf.exe were modified to accept a dictionary parameter called “bsubx “ that contains bsub arguments and to pass the bsubx to _submit in their return statements
-
_submit was modified to accept the bsubx parameter and pass bsubx to submitJob
-
submitJob was modified to marshal the bsubx contents into the webservices call to invoke the GENERIC application template on LSF.
No changes were made in the GENERIC template.
Contact: Frank Greco
fjgreco@us.ibm.com