Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1312 from minrk/hb

two small heartbeat changes:

* flush outgoing heartbeats (notebook and parallel):
  - Prevents mismatch between heartbeat timer and actual heartbeat send/recv events.

* relax default heartbeat period in IPython.parallel to 3s from 1s
  - Matches heartbeats elsewhere.  3s should be extremely conservative, as most heartbeat responses are O(1ms) unless there's a bug in our code (like the above flush and previously-discovered GIL issues).

closes #1304
  • Loading branch information...
commit 1487f2f13e6a8a278e82f28fc0b5878a031ebb00 2 parents 6bc0f53 + a4d4ccc
@minrk minrk authored
View
2  IPython/frontend/html/notebook/handlers.py
@@ -481,6 +481,8 @@ def ping_or_dead():
if self._kernel_alive:
self._kernel_alive = False
self.hb_stream.send(b'ping')
+ # flush stream to force immediate socket send
+ self.hb_stream.flush()
else:
try:
callback()
View
4 IPython/parallel/controller/heartmonitor.py
@@ -64,7 +64,7 @@ class HeartMonitor(LoggingConfigurable):
pongstream: an XREP stream
period: the period of the heartbeat in milliseconds"""
- period = Integer(1000, config=True,
+ period = Integer(3000, config=True,
help='The frequency at which the Hub pings the engines for heartbeats '
'(in ms)',
)
@@ -124,6 +124,8 @@ def beat(self):
# print self.on_probation, self.hearts
# self.log.debug("heartbeat::beat %.3f, %i beating hearts", self.lifetime, len(self.hearts))
self.pingstream.send(asbytes(str(self.lifetime)))
+ # flush stream to force immediate socket send
+ self.pingstream.flush()
def handle_new_heart(self, heart):
if self._new_handlers:
Please sign in to comment.
Something went wrong with that request. Please try again.