Minimal Reproducible Bug Example: dead lock in `joblib.Parallel._lock`with`dask` as a back-end
3.7K
joblib.Parallel._lock when using dask as a back-endtl;dr : aims at reproducing a dead lock when using joblib.Parallel with dask as a back-end.
Context:
The context is a bit cumbersome:
RandomForestentrypoint.py (see DockerFile)server.py a process that:
Scheduler in a ThreadClient in the main threadworker.py that spawns a worker that connect to the SchedulerProblem:
Jobs generally hang or crash and joblib.Parallel does not return, blocking the main process.
For now, I can't reproduce the initial problem exactly, several other problems arise.
Exploration and diagnostic:
To better have an understanding of what's going on, logs have been added on branches based respectively on:
jjerphan/distributed 1.28.0 for logs on 1.28.0 for distributedjjerphan/joblib 0.13.2 for logs on 0.13.2 for joblibSee the following issue:
joblib/issues/875 fo
explanation.
Recap of problems:
Here is a recap of logs of different problem I had on different setup:
Client._update_scheduler_info after submission to Parallel.__call__
Scheduler.handle_task_finished:
Workers, results come back to Scheduler, the connection between those two Servers can't be closedClone this repo:
git clone [email protected]:jjerphan/joblib_dask_deadlock.git
cd joblib_dask_deadlock
Eventually checkout to the different commit listed above.
A simple helm chart has been developed to reproduce the setup and the errors easily.
You can do this building the image locally and pushing it on Docker Hub:
docker build -t yourself/joblib_dask_deadlock:latest .
docker push yourself/joblib_dask_deadlock:latest
Then you will need to edit chart/values.yaml by replacing jjerphan/joblib_dask_deadlock by yourself/joblib_dask_deadlock.
You can start the infrastructure by running:
helm install ./chart --name joblib-dask-deadlock-test
Latter you can the infrastructure by running:
helm del --purge joblib-dask-deadlock-test
Just use this to get access to the logs.
tools/logs | tee logs
You can also use the two others scripts to better have an understanding of logs
tools/count_logs logs
tools/lock_logs logs
A DockerFile defines the entire setup but to try to reproduce it without containerisation here
are some instructions.
You can have access to forks by cloning the following repositories and installing them as dependencies then.
# Distributed clone
git clone [email protected]:jjerphan/distributed.git
cd distributed
git checkout 1.28.0_debug
cd ..
# Joblib clone
git clone [email protected]:jjerphan/joblib.git
cd joblib
git checkout 0.13.2_debug
cd ..
python -m venv .venv
source ./venv/bin/activate
Install via requirements:
pip install -r requirements.txt
I recommend directly pulling dependencies and installing with the forks:
pip install -r requirements.txt
pip install -e ./joblib
pip install -e ./distributed
TODO: not tested but should work, else ask me
In different terminal, run
python scripts/entrypoint.py server
python scripts/entrypoint.py worker
Content type
Image
Digest
Size
399.8 MB
Last updated
about 7 years ago
docker pull jjerphan/joblib_dask_deadlock