From 21f65c3d2055d7479182c9b8118c7b7290777948 Mon Sep 17 00:00:00 2001 From: Nir Izraeli Date: Wed, 29 Jun 2016 14:23:19 +0300 Subject: [PATCH] multiprocessing scheduler silently hangs with lock task argument Signed-off-by: Nir Izraeli --- dask/tests/test_multiprocessing.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dask/tests/test_multiprocessing.py b/dask/tests/test_multiprocessing.py index 155f1ef9836..6ef16cf3b9f 100644 --- a/dask/tests/test_multiprocessing.py +++ b/dask/tests/test_multiprocessing.py @@ -46,6 +46,35 @@ def test_errors_propagate(): assert "12345" in str(e) +global_lock = multiprocessing.Lock() +def lock_func(i, l): + # we don't even have to use the lock to hang + + return i + +@pytest.mark.timeout(10) +@pytest.mark.xfail(reason="passing multiprocessing locks as dask task arguments " + "hangs dask on call to _get") +def test_lock(): + dsk = {'x': (lock_func, 42, global_lock)} + + assert get(dsk, 'x') == 42 + + +def global_lock_func(i): + # we don't even have to use the lock to hang + + global_lock.acquire() + global_lock.release() + + return i + +def test_global_lock(): + dsk = {'x': (global_lock_func, 42)} + + assert get(dsk, 'x') == 42 + + def make_bad_result(): return lambda x: x + 1