From 5be530974c5fd8832146c39cdf7e8af8bc2e91a9 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Mon, 18 Oct 2021 19:34:28 +0100 Subject: [PATCH] test_avoid_paused_workers --- distributed/tests/test_scheduler.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/distributed/tests/test_scheduler.py b/distributed/tests/test_scheduler.py index 1e1a3e69b32..0021d039fed 100644 --- a/distributed/tests/test_scheduler.py +++ b/distributed/tests/test_scheduler.py @@ -3218,3 +3218,16 @@ async def test_set_restrictions(c, s, a, b): assert s.tasks[f.key].worker_restrictions == {a.address} s.reschedule(f) await f + + +@gen_cluster( + client=True, + nthreads=[("", 1, {}), ("", 1, {"memory_pause_fraction": 1e-15}), ("", 1, {})], +) +async def test_avoid_paused_workers(c, s, w1, w2, w3): + while s.workers[w2.address].status != Status.paused: + await asyncio.sleep(0.01) + futures = c.map(slowinc, range(8), delay=0.1) + w1: Worker + while (len(w1.tasks), len(w2.tasks), len(w3.tasks)) != (4, 0, 4): + await asyncio.sleep(0.01)