Skip to content

Commit e4d424a

Browse files
Aadd an example for bsub -pack
1 parent 79e81c4 commit e4d424a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

examples/pack_submit.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from pythonlsf import lsf
2+
3+
def sub_pack_job():
4+
5+
6+
limits1 = []
7+
for i in range(0, lsf.LSF_RLIM_NLIMITS):
8+
limits1.append(lsf.DEFAULT_RLIMIT)
9+
10+
submitreq1 = lsf.submit()
11+
submitreq1.command = "sleep 10"
12+
submitreq1.options = 0
13+
submitreq1.options2 = 0
14+
submitreq1.rLimits = limits1
15+
16+
limits2 = []
17+
for i in range(0, lsf.LSF_RLIM_NLIMITS):
18+
limits2.append(lsf.DEFAULT_RLIMIT)
19+
20+
submitreq2 = lsf.submit()
21+
submitreq2.command = "sleep 20"
22+
submitreq2.options = 0
23+
submitreq2.options2 = 0
24+
submitreq2.rLimits = limits2
25+
26+
27+
pack_submitreq = lsf.packSubmit()
28+
pack_submitreq.num = 2
29+
submits = lsf.new_submitArray(2)
30+
lsf.submitArray_setitem(submits, 0, submitreq1)
31+
lsf.submitArray_setitem(submits, 1, submitreq2)
32+
pack_submitreq.reqs = submits
33+
34+
pack_submitreply = lsf.packSubmitReply()
35+
intp_acceptedNum = lsf.copy_intp(0)
36+
intp_rejectedNum = lsf.copy_intp(0)
37+
38+
39+
if lsf.lsb_init("test") > 0:
40+
exit(1)
41+
42+
result = lsf.lsb_submitPack(pack_submitreq, pack_submitreply, intp_acceptedNum, intp_rejectedNum)
43+
print(result)
44+
print(lsf.intp_value(intp_acceptedNum))
45+
print(lsf.intp_value(intp_rejectedNum))
46+
47+
return result
48+
49+
if __name__ == '__main__':
50+
print("LSF Clustername is :", lsf.ls_getclustername())
51+
sub_pack_job()

0 commit comments

Comments
 (0)