Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Oct 18, 2021
1 parent 9b04db9 commit d704c6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions distributed/utils_test.py
Expand Up @@ -69,7 +69,7 @@
sync,
thread_state,
)
from .worker import Worker
from .worker import RUNNING, Worker

try:
import dask.array # register config
Expand Down Expand Up @@ -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()

Expand Down
6 changes: 1 addition & 5 deletions distributed/worker.py
Expand Up @@ -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")

Expand Down

0 comments on commit d704c6e

Please sign in to comment.