From 15b7b6049af566255d9051f52ba1a1995f8442dc Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Wed, 8 Jun 2022 13:12:07 -0700 Subject: [PATCH] Use `default_initializer` in `WorkerProcess`es This function was refactored out in Dask and still has the same functionality. While `initialize_worker_process` does work, it does a bit more than is needed (taking a UDF to initialize too). So just use `default_initializer`. Also there is no need to handle old Dask versions here since we now pin Dask & Distributed to the exact same version. So drop the fallback code. --- distributed/nanny.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/distributed/nanny.py b/distributed/nanny.py index dfb00bb308c..5a92df46e4c 100644 --- a/distributed/nanny.py +++ b/distributed/nanny.py @@ -809,12 +809,9 @@ def _run( try: os.environ.update(env) dask.config.set(config) - try: - from dask.multiprocessing import initialize_worker_process - except ImportError: # old Dask version - pass - else: - initialize_worker_process() + + from dask.multiprocessing import default_initializer + default_initializer() if silence_logs: logger.setLevel(silence_logs)