File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 "set_worker_root" ,
3030]
3131
32- _WORKER_STATE : dict [ str , str | None ] = { "root" : None }
32+ _WORKER_ROOT : str | None = None
3333
3434
3535def set_worker_root (path : os .PathLike [str ] | str ) -> None :
@@ -41,7 +41,8 @@ def set_worker_root(path: os.PathLike[str] | str) -> None:
4141
4242 """
4343 root = os .fspath (path )
44- _WORKER_STATE ["root" ] = root
44+ global _WORKER_ROOT # noqa: PLW0603
45+ _WORKER_ROOT = root
4546 if root not in sys .path :
4647 sys .path .insert (0 , root )
4748 # Ensure custom process backends can import task modules by reference.
@@ -118,7 +119,7 @@ def _get_loky_executor(n_workers: int) -> Executor:
118119 return get_reusable_executor (
119120 max_workers = n_workers ,
120121 initializer = _configure_worker ,
121- initargs = (_WORKER_STATE [ "root" ] ,),
122+ initargs = (_WORKER_ROOT ,),
122123 )
123124
124125
@@ -127,7 +128,7 @@ def _get_process_pool_executor(n_workers: int) -> Executor:
127128 return _CloudpickleProcessPoolExecutor (
128129 max_workers = n_workers ,
129130 initializer = _configure_worker ,
130- initargs = (_WORKER_STATE [ "root" ] ,),
131+ initargs = (_WORKER_ROOT ,),
131132 )
132133
133134
You can’t perform that action at this time.
0 commit comments