Skip to content

Commit

Permalink
Add keep-alive message between worker and scheduler
Browse files Browse the repository at this point in the history
This is effectively a heartbeat, but much simpler and less frequent than
our current heartbeats

Fixes dask#2524
  • Loading branch information
mrocklin committed Jul 29, 2019
1 parent 4260790 commit 6032f81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ def __init__(
"missing-data": self.handle_missing_data,
"long-running": self.handle_long_running,
"reschedule": self.reschedule,
"keep-alive": lambda comm: None,
}

client_handlers = {
Expand Down
7 changes: 7 additions & 0 deletions distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,13 @@ async def _register_with_scheduler(self):

self.batched_stream = BatchedSend(interval="2ms", loop=self.loop)
self.batched_stream.start(comm)
pc = PeriodicCallback(
lambda: self.batched_stream.send({"op": "keep-alive"}),
60000,
io_loop=self.io_loop,
)
self.periodic_callbacks["keep-alive"] = pc
pc.start()
self.periodic_callbacks["heartbeat"].start()
self.loop.add_callback(self.handle_scheduler, comm)

Expand Down

0 comments on commit 6032f81

Please sign in to comment.