Skip to content

Loading…

minor heartbeat tweaks #1312

Merged
merged 2 commits into from

2 participants

@minrk
IPython member

two small changes:

  • flush outgoing heartbeats:

    • Prevents mismatch between heartbeat timer and actual heartbeat send/recv events.
    • Applied in notebook and parallel.
  • 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

minrk added some commits
@minrk minrk flush outgoing heartbeats
Prevents mismatch between heartbeat timer and actual heartbeat send/recv events.

Applied in notebook and parallel.
d545c3b
@minrk minrk 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).
a4d4ccc
@ellisonbg
IPython member

This looks good - I think it can be merged.

@minrk minrk merged commit 1487f2f into ipython:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 23, 2012
  1. @minrk

    flush outgoing heartbeats

    minrk committed
    Prevents mismatch between heartbeat timer and actual heartbeat send/recv events.
    
    Applied in notebook and parallel.
  2. @minrk

    relax default heartbeat period in IPython.parallel to 3s (from 1s)

    minrk committed
    Matches heartbeats elsewhere.  3s should be extremely conservative,
    as most heartbeat responses are O(1ms).
Showing with 5 additions and 1 deletion.
  1. +2 −0 IPython/frontend/html/notebook/handlers.py
  2. +3 −1 IPython/parallel/controller/heartmonitor.py
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:
Something went wrong with that request. Please try again.