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 9, 2024
1 parent 7562f9c commit d0bc4ca
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)

Check warning on line 1458 in distributed/client.py

View check run for this annotation

Codecov / codecov/patch

distributed/client.py#L1457-L1458

Added lines #L1457 - L1458 were not covered by tests

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

Check warning on line 1460 in distributed/client.py

View check run for this annotation

Codecov / codecov/patch

distributed/client.py#L1460

Added line #L1460 was not covered by tests

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 d0bc4ca

Please sign in to comment.