##// END OF EJS Templates
Change types of some config items and adjust code accordingly...
Jan Schulz -
Show More
@@ -25,7 +25,7 b' from zmq.eventloop import ioloop, zmqstream'
25 25 from IPython.external.ssh import tunnel
26 26 # internal
27 27 from IPython.utils.traitlets import (
28 Instance, Dict, Integer, Type, CFloat, CInt, Unicode, CBytes, Bool
28 Instance, Dict, Integer, Type, Float, Integer, Unicode, CBytes, Bool
29 29 )
30 30 from IPython.utils.py3compat import cast_bytes
31 31
@@ -50,13 +50,15 b' class EngineFactory(RegistrationFactory):'
50 50 help="""The location (an IP address) of the controller. This is
51 51 used for disambiguating URLs, to determine whether
52 52 loopback should be used to connect or the public address.""")
53 timeout=CFloat(5, config=True,
53 timeout=Float(5.0, config=True,
54 54 help="""The time (in seconds) to wait for the Controller to respond
55 55 to registration requests before giving up.""")
56 hb_check_period=CFloat(5, config=True,
57 help="""The time (in seconds) to check for a heartbeat ping from the
58 Controller.""")
59 hb_max_misses=CInt(5, config=True,
56 hb_check_period=Integer(5000, config=True,
57 help="""The time (in ms) to check for a heartbeat ping from the
58 Controller. Ensure that check period is bigger than the heartbeat period
59 from the controller (set via "HeartMonitor.period" in the Controller config)
60 so that at least one ping is received during each check period.""")
61 hb_max_misses=Integer(5, config=True,
60 62 help="""The maximum number of times a check for the heartbeat ping of a
61 63 controller can be missed before shutting down the engine.""")
62 64 sshserver=Unicode(config=True,
@@ -262,12 +264,12 b' class EngineFactory(RegistrationFactory):'
262 264 self._hb_listener.flush()
263 265 if self._hb_last_monitored > self._hb_last_pinged:
264 266 self._hb_missed_beats += 1
265 self.log.warn("No heartbeat in the last %s seconds.", self.hb_check_period)
267 self.log.warn("No heartbeat in the last %s ms (%s time(s) in a row).", self.hb_check_period, self._hb_missed_beats)
266 268 else:
267 269 self._hb_missed_beats = 0
268 270
269 271 if self._hb_missed_beats >= self.hb_max_misses:
270 self.log.fatal("Maximum number of heartbeats misses reached (%s times %s seconds), shutting down.",
272 self.log.fatal("Maximum number of heartbeats misses reached (%s times %s ms), shutting down.",
271 273 self.hb_max_misses, self.hb_check_period)
272 274 self.session.send(self.registrar, "unregistration_request", content=dict(id=self.id))
273 275 self.loop.stop()
@@ -281,7 +283,7 b' class EngineFactory(RegistrationFactory):'
281 283 self._abort_dc = ioloop.DelayedCallback(self.abort, self.timeout*1000, self.loop)
282 284 self._abort_dc.start()
283 285 # periodically check the heartbeat pings of the controller
284 self._hb_reporter = ioloop.PeriodicCallback(self._hb_monitor, self.hb_check_period* 1000, self.loop)
286 self._hb_reporter = ioloop.PeriodicCallback(self._hb_monitor, self.hb_check_period, self.loop)
285 287 self._hb_reporter.start()
286 288
287 289
General Comments 0
You need to be logged in to leave comments. Login now