How To
Summary
Here is an example script to query job information using Python API.
$cat job_info.py
from pythonlsf import lsf
def job_info():
"""
Query a job...
"""
if lsf.lsb_init("test") > 0:
exit(1)
i=lsf.lsb_openjobinfo(0,'','user_name','','',0x0040)
arg = lsf.new_intp()
lsf.intp_assign(arg, i);
jobinfo=lsf.lsb_readjobinfo(arg)
print(jobinfo.jobId)
print(jobinfo.status)
print(jobinfo.user)
lsf.lsb_closejobinfo()
return jobinfo.jobId
if __name__ == '__main__':
print("LSF Clustername is :", lsf.ls_getclustername())
print(job_info())
Test the script:
$bjobs
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME
5538 user_name RUN normal host1 host2 *sleep 100 Oct 31 05:31
$python job_info.py
('LSF Clustername is :', 'lsf10.1')
5539
4
user_name
5539
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
22 November 2018
UID
ibm10738933