diff --git a/examples/readstream.py b/examples/readstream.py index 5ba9b57..60a4722 100644 --- a/examples/readstream.py +++ b/examples/readstream.py @@ -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)) diff --git a/pythonlsf/Makefile b/pythonlsf/Makefile index b48b893..7df6577 100755 --- a/pythonlsf/Makefile +++ b/pythonlsf/Makefile @@ -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) diff --git a/pythonlsf/lsf.i b/pythonlsf/lsf.i index 25253a4..859437a 100644 --- a/pythonlsf/lsf.i +++ b/pythonlsf/lsf.i @@ -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) @@ -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) diff --git a/setup.py b/setup.py index 57992b7..1476f9c 100755 --- a/setup.py +++ b/setup.py @@ -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(''' @@ -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