2020from itertools import chain
2121
2222import _pytest .runner as runner
23+ import psutil
2324import pytest
2425
2526import parsl
@@ -179,6 +180,9 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
179180 config = pytestconfig .getoption ('config' )[0 ]
180181
181182 if config != 'local' :
183+ this_process = psutil .Process ()
184+ start_fds = this_process .num_fds ()
185+ logger .error (f"BENC: start open fds: { start_fds } " )
182186 spec = importlib .util .spec_from_file_location ('' , config )
183187 module = importlib .util .module_from_spec (spec )
184188 spec .loader .exec_module (module )
@@ -206,6 +210,8 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
206210 raise RuntimeError ("DFK changed unexpectedly during test" )
207211 dfk .cleanup ()
208212 assert DataFlowKernelLoader ._dfk is None
213+ end_fds = this_process .num_fds ()
214+ logger .error (f"BENC: end open fds: { end_fds } " )
209215 else :
210216 yield
211217
@@ -227,6 +233,10 @@ def load_dfk_local_module(request, pytestconfig, tmpd_cwd_session):
227233 config = pytestconfig .getoption ('config' )[0 ]
228234
229235 if config == 'local' :
236+ this_process = psutil .Process ()
237+ start_fds = this_process .num_fds ()
238+ logger .error (f"BENC: start open fds: { start_fds } " )
239+
230240 local_setup = getattr (request .module , "local_setup" , None )
231241 local_teardown = getattr (request .module , "local_teardown" , None )
232242 local_config = getattr (request .module , "local_config" , None )
@@ -258,6 +268,8 @@ def load_dfk_local_module(request, pytestconfig, tmpd_cwd_session):
258268 raise RuntimeError ("DFK changed unexpectedly during test" )
259269 dfk .cleanup ()
260270 assert DataFlowKernelLoader ._dfk is None
271+ end_fds = this_process .num_fds ()
272+ logger .error (f"BENC: end open fds: { end_fds } (vs start { start_fds } " )
261273
262274 else :
263275 yield
0 commit comments