Skip to content

Commit 0f1e25b

Browse files
committed
add RUN_RUSAGE for readstream.py with pid and pgids
1 parent 34e5b2d commit 0f1e25b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

examples/readstream.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ def display(eventrec):
2727
for i in range(0,numhosts):
2828
hoststr += lsf.stringArray_getitem(exechosts, i) + ""
2929
print("EVENT_JOB_FORCE jobid<%d>, execHost<%s>, username<%s>" %(jobid, hoststr, username))
30-
30+
elif eventrec.type == lsf.EVENT_JOB_RUN_RUSAGE:
31+
jobid = eventrec.eventLog.jobRunRusageLog.jobid;
32+
numpgids = eventrec.eventLog.jobRunRusageLog.jrusage.npgids;
33+
for i in range(0,numpgids):
34+
pgids = str(lsf.intArray_getitem(eventrec.eventLog.jobRunRusageLog.jrusage.pgid, i)) + " "
35+
pgids = pgids[:-1]
36+
numpids = eventrec.eventLog.jobRunRusageLog.jrusage.npids;
37+
for i in range(0,numpids):
38+
pids = str(lsf.pidInfoArray_getitem(eventrec.eventLog.jobRunRusageLog.jrusage.pidInfo, i).pid) + " ";
39+
pids = pids[:-1]
40+
print("EVENT_JOB_RUN_RUSAGE jobid<%d> pgids<%s> pids<%s>" %(jobid, pgids, pids))
3141
else:
3242
print("event type is %d" %(eventrec.type))
3343

pythonlsf/lsf.i

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typedef long off_t;
5353
%array_functions(struct gpuTaskData, gpuTaskDataArray)
5454
%array_functions(struct gpuData *, gpuDataArray)
5555
%array_functions(struct migData, migDataArray)
56+
%array_functions(struct pidInfo, pidInfoArray)
5657
#endif
5758
%array_functions(LS_LONG_INT, LS_LONG_INTArray)
5859
%array_functions(guaranteedResourcePoolEnt, guaranteedResourcePoolEntArray)

0 commit comments

Comments
 (0)