Skip to content

Commit

Permalink
Delegate wait_for_workers to cluster instances only when implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Jan 4, 2024
1 parent 81774d4 commit 5d0466b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,10 +1454,11 @@ def wait_for_workers(self, n_workers: int, timeout: float | None = None) -> None
f"`n_workers` must be a positive integer. Instead got {n_workers}."
)

if self.cluster is None:
return self.sync(self._wait_for_workers, n_workers, timeout=timeout)
if self.cluster and hasattr(self.cluster, "wait_for_workers"):
return self.cluster.wait_for_workers(n_workers, timeout)

return self.sync(self._wait_for_workers, n_workers, timeout=timeout)

return self.cluster.wait_for_workers(n_workers, timeout)

def _heartbeat(self):
# Don't send heartbeat if scheduler comm or cluster are already closed
Expand Down

0 comments on commit 5d0466b

Please sign in to comment.