Skip to content

Commit

Permalink
no_recipients is possible if policy is done
Browse files Browse the repository at this point in the history
`test_RetireWorker_no_recipients` and `test_RetireWorker_all_recipients_are_paused` were failling withou this.
  • Loading branch information
gjoseph92 committed Apr 28, 2022
1 parent eae1bd4 commit e95fdba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6072,20 +6072,20 @@ async def _track_retire_worker(
remove: bool,
) -> tuple: # tuple[str | None, dict]
while not policy.done():
if policy.no_recipients:
# Abort retirement. This time we don't need to worry about race
# conditions and we can wait for a scheduler->worker->scheduler
# round-trip.
self.stream_comms[ws.address].send(
{"op": "worker-status-change", "status": prev_status.name}
)
return None, {}

# Sleep 0.01s when there are 4 tasks or less
# Sleep 0.5s when there are 200 or more
poll_interval = max(0.01, min(0.5, len(ws.has_what) / 400))
await asyncio.sleep(poll_interval)

if policy.no_recipients:
# Abort retirement. This time we don't need to worry about race
# conditions and we can wait for a scheduler->worker->scheduler
# round-trip.
self.stream_comms[ws.address].send(
{"op": "worker-status-change", "status": prev_status.name}
)
return None, {}

logger.debug(
"All unique keys on worker %s have been replicated elsewhere", ws.address
)
Expand Down

0 comments on commit e95fdba

Please sign in to comment.