Skip to content

1329 add pid/pgid to RUN_RUSAGE for readstream.py #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion examples/readstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ def display(eventrec):
for i in range(0,numhosts):
hoststr += lsf.stringArray_getitem(exechosts, i) + ""
print("EVENT_JOB_FORCE jobid<%d>, execHost<%s>, username<%s>" %(jobid, hoststr, username))

elif eventrec.type == lsf.EVENT_JOB_RUN_RUSAGE:
jobid = eventrec.eventLog.jobRunRusageLog.jobid;
numpgids = eventrec.eventLog.jobRunRusageLog.jrusage.npgids;
for i in range(0,numpgids):
pgids = str(lsf.intArray_getitem(eventrec.eventLog.jobRunRusageLog.jrusage.pgid, i)) + " "
pgids = pgids[:-1]
numpids = eventrec.eventLog.jobRunRusageLog.jrusage.npids;
for i in range(0,numpids):
pids = str(lsf.pidInfoArray_getitem(eventrec.eventLog.jobRunRusageLog.jrusage.pidInfo, i).pid) + " ";
pids = pids[:-1]
print("EVENT_JOB_RUN_RUSAGE jobid<%d> pgids<%s> pids<%s>" %(jobid, pgids, pids))
else:
print("event type is %d" %(eventrec.type))

Expand Down
2 changes: 1 addition & 1 deletion pythonlsf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PROJECT = _lsf.so
OBJECTS = lsf_wrap.o

CFLAGS = -m64 -fPIC -I$(PYTHON_INCLUDE) -I$(LSF_INCLUDE)
LDFLAGS = $(LSF_LIBDIR)/liblsf.a $(LSF_LIBDIR)/libbat.a $(LSF_LIBDIR)/libfairshareadjust.so $(LSF_LIBDIR)/liblsbstream.so -lc -lnsl
LDFLAGS = $(LSF_LIBDIR)/liblsf.a $(LSF_LIBDIR)/libbat.a $(LSF_LIBDIR)/libfairshareadjust.so $(LSF_LIBDIR)/liblsbstream.so -lc -lnsl -lz

all: $(PROJECT)

Expand Down
2 changes: 2 additions & 0 deletions pythonlsf/lsf.i
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int fclose(FILE *f);
#include "lib.table.h"
extern struct gpuJobData* str2GpuJobData(char *str);
%}
typedef long off_t;

%pointer_functions(int, intp)
%pointer_functions(float, floatp)
Expand All @@ -52,6 +53,7 @@ extern struct gpuJobData* str2GpuJobData(char *str);
%array_functions(struct gpuTaskData, gpuTaskDataArray)
%array_functions(struct gpuData *, gpuDataArray)
%array_functions(struct migData, migDataArray)
%array_functions(struct pidInfo, pidInfoArray)
#endif
%array_functions(LS_LONG_INT, LS_LONG_INTArray)
%array_functions(guaranteedResourcePoolEnt, guaranteedResourcePoolEntArray)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def set_gccflag_lsf_version():
xlc_path = os.path.join(path, 'xlc')
if os.access(xlc_path, os.F_OK):
found_xlc = True
os.environ["LDSHARED"] = "%s -pthread -shared -Wl,-z,relro" % xlc_path
os.environ["LDSHARED"] = "%s -pthread -shared -Wl,-z,-lz,relro" % xlc_path
break
if found_xlc == False:
print('''
Expand All @@ -90,11 +90,11 @@ def set_gccflag_lsf_version():

if os.access(LSF_LIBDIR + "/liblsbstream.a", os.F_OK):
lsf_static_lib = [ LSF_LIBDIR + '/liblsbstream.a']
lsf_dynamic_lib = ['c', 'nsl', 'rt']
lsf_dynamic_lib = ['c', 'nsl', 'rt', 'z']
warning_msg = ""
else:
lsf_static_lib = []
lsf_dynamic_lib = ['c', 'nsl', 'lsbstream', 'lsf', 'bat', 'rt']
lsf_dynamic_lib = ['c', 'nsl', 'lsbstream', 'lsf', 'bat', 'rt', 'z']
warning_msg = '''
Warning: The compatibility of the LSF Python API package is not guaranteed
if you update LSF at a later time. This is because your current
Expand Down