File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 3737_logger = logging .getLogger (__name__ )
3838
3939
40- def _shutdown_pool_at_exit () -> None :
40+ def shutdown_pool_at_exit () -> None :
4141 """Best-effort shutdown of the global ProcessPoolExecutor on interpreter exit."""
4242 global _pool , _pool_cleanup_registered # pylint: disable=global-statement
4343 print ("Shutting down pool at exit" )
@@ -65,7 +65,7 @@ def _get_pool() -> ProcessPoolExecutor:
6565 if not _pool_cleanup_registered :
6666 # Register the shutdown at exit at creation time (rather than at import time)
6767 # to make sure it's executed earlier in the shutdown sequence.
68- atexit .register (_shutdown_pool_at_exit )
68+ atexit .register (shutdown_pool_at_exit )
6969 _pool_cleanup_registered = True
7070
7171 # Single worker process as requested
Original file line number Diff line number Diff line change 1+ import pytest
2+ import typing
3+
4+
5+ @pytest .fixture (scope = "session" , autouse = True )
6+ def _cocoindex_env_fixture () -> typing .Generator [None , None , None ]:
7+ """Shutdown the subprocess pool at exit."""
8+ yield
9+ try :
10+ print ("Shutdown the subprocess pool at exit in hook." )
11+ import cocoindex .subprocess_exec
12+
13+ cocoindex .subprocess_exec .shutdown_pool_at_exit ()
14+ except Exception :
15+ pass
You can’t perform that action at this time.
0 commit comments