diff --git a/examples/get_job_pendreason.py b/examples/get_job_pendreason.py index ac6b3b9..a1319e9 100644 --- a/examples/get_job_pendreason.py +++ b/examples/get_job_pendreason.py @@ -43,7 +43,7 @@ def get_job_info(list) : req = lsf.jobInfoReq() req.reasonLevel = reasonLevel req.sourceClusterName = clusterName - req.user = "all" + req.userName = "all" req.options = lsf.ALL_JOB if len(list) > 1 : req.jobId = 0 diff --git a/examples/pack_submit.py b/examples/pack_submit.py new file mode 100644 index 0000000..e05956c --- /dev/null +++ b/examples/pack_submit.py @@ -0,0 +1,51 @@ +from pythonlsf import lsf + +def sub_pack_job(): + + + limits1 = [] + for i in range(0, lsf.LSF_RLIM_NLIMITS): + limits1.append(lsf.DEFAULT_RLIMIT) + + submitreq1 = lsf.submit() + submitreq1.command = "sleep 10" + submitreq1.options = 0 + submitreq1.options2 = 0 + submitreq1.rLimits = limits1 + + limits2 = [] + for i in range(0, lsf.LSF_RLIM_NLIMITS): + limits2.append(lsf.DEFAULT_RLIMIT) + + submitreq2 = lsf.submit() + submitreq2.command = "sleep 20" + submitreq2.options = 0 + submitreq2.options2 = 0 + submitreq2.rLimits = limits2 + + + pack_submitreq = lsf.packSubmit() + pack_submitreq.num = 2 + submits = lsf.new_submitArray(2) + lsf.submitArray_setitem(submits, 0, submitreq1) + lsf.submitArray_setitem(submits, 1, submitreq2) + pack_submitreq.reqs = submits + + pack_submitreply = lsf.packSubmitReply() + intp_acceptedNum = lsf.copy_intp(0) + intp_rejectedNum = lsf.copy_intp(0) + + + if lsf.lsb_init("test") > 0: + exit(1) + + result = lsf.lsb_submitPack(pack_submitreq, pack_submitreply, intp_acceptedNum, intp_rejectedNum) + print(result) + print(lsf.intp_value(intp_acceptedNum)) + print(lsf.intp_value(intp_rejectedNum)) + + return result + +if __name__ == '__main__': + print("LSF Clustername is :", lsf.ls_getclustername()) + sub_pack_job() diff --git a/pythonlsf/lsf.i b/pythonlsf/lsf.i index 3c36f2c..d380025 100644 --- a/pythonlsf/lsf.i +++ b/pythonlsf/lsf.i @@ -54,6 +54,7 @@ int fclose(FILE *f); %array_functions(struct hostRsvInfoEnt, hostRsvInfoEntArray) %array_functions(struct hRusage, hRusageArray) %array_functions(struct hostInfo, hostInfoArray) +%array_functions(struct submit*, submitArray) //helper function for transforming char** to python list %inline %{