diff --git a/distributed/utils_test.py b/distributed/utils_test.py index 3a72ed07889..e56e3865c77 100644 --- a/distributed/utils_test.py +++ b/distributed/utils_test.py @@ -69,7 +69,7 @@ sync, thread_state, ) -from .worker import Worker +from .worker import RUNNING, Worker try: import dask.array # register config @@ -1549,7 +1549,7 @@ def check_instances(): for w in Worker._instances: with suppress(RuntimeError): # closed IOLoop w.loop.add_callback(w.close, report=False, executor_wait=False) - if w.status in (Status.running, Status.paused): + if w.status in RUNNING: w.loop.add_callback(w.close) Worker._instances.clear() diff --git a/distributed/worker.py b/distributed/worker.py index 3d9c9504054..06d914e3838 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -3673,11 +3673,7 @@ def get_worker() -> Worker: return thread_state.execution_state["worker"] except AttributeError: try: - return first( - w - for w in Worker._instances - if w.status in (Status.running, Status.paused) - ) + return first(w for w in Worker._instances if w.status in RUNNING) except StopIteration: raise ValueError("No workers found")