forked from IBMSpectrumComputing/lsf-python-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjob_modify.py
More file actions
executable file
·38 lines (29 loc) · 881 Bytes
/
job_modify.py
File metadata and controls
executable file
·38 lines (29 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from pythonlsf import lsf
import sys
def modify_job(job_id):
"""
Modify a job...
"""
submitreq = lsf.submit()
submitreq.command = str(job_id);
submitreq.options = 0
submitreq.resReq = "rusage[mem=3500]"
submitreq.options |= lsf.SUB_MODIFY
submitreq.options |= lsf.SUB_RES_REQ
submitreq.options2 = 0
submitreq.options3 = 0
submitreq.options4 = 0
limits = []
for _ in range(0, lsf.LSF_RLIM_NLIMITS):
limits.append(lsf.DEFAULT_RLIMIT)
submitreq.rLimits = limits
submitreply = lsf.submitReply()
if lsf.lsb_init("test") > 0:
exit(1)
job_id = lsf.lsb_modify(submitreq, submitreply, -1)
return job_id
if __name__ == '__main__':
print("LSF Clustername is :", lsf.ls_getclustername())
job_id = int(sys.argv[1])
print("job_id = ", str(job_id))
print(modify_job(job_id))