2020from itertools import chain
2121
2222import _pytest .runner as runner
23+ import psutil
2324import pytest
2425
2526import parsl
@@ -191,6 +192,9 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
191192 config = pytestconfig .getoption ('config' )[0 ]
192193
193194 if config != 'local' :
195+ this_process = psutil .Process ()
196+ start_fds = this_process .num_fds ()
197+ logger .error (f"BENC: start open fds: { start_fds } " )
194198 spec = importlib .util .spec_from_file_location ('' , config )
195199 module = importlib .util .module_from_spec (spec )
196200 spec .loader .exec_module (module )
@@ -218,6 +222,8 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
218222 raise RuntimeError ("DFK changed unexpectedly during test" )
219223 dfk .cleanup ()
220224 assert DataFlowKernelLoader ._dfk is None
225+ end_fds = this_process .num_fds ()
226+ logger .error (f"BENC: end open fds: { end_fds } " )
221227 else :
222228 yield
223229
@@ -239,6 +245,10 @@ def load_dfk_local_module(request, pytestconfig, tmpd_cwd_session):
239245 config = pytestconfig .getoption ('config' )[0 ]
240246
241247 if config == 'local' :
248+ this_process = psutil .Process ()
249+ start_fds = this_process .num_fds ()
250+ logger .error (f"BENC: start open fds: { start_fds } " )
251+
242252 local_setup = getattr (request .module , "local_setup" , None )
243253 local_teardown = getattr (request .module , "local_teardown" , None )
244254 local_config = getattr (request .module , "local_config" , None )
@@ -270,6 +280,8 @@ def load_dfk_local_module(request, pytestconfig, tmpd_cwd_session):
270280 raise RuntimeError ("DFK changed unexpectedly during test" )
271281 dfk .cleanup ()
272282 assert DataFlowKernelLoader ._dfk is None
283+ end_fds = this_process .num_fds ()
284+ logger .error (f"BENC: end open fds: { end_fds } (vs start { start_fds } " )
273285
274286 else :
275287 yield
0 commit comments