Show More
@@ -18,6 +18,7 b' Authors:' | |||
|
18 | 18 | |
|
19 | 19 | import logging |
|
20 | 20 | import Cookie |
|
21 | import time | |
|
21 | 22 | import uuid |
|
22 | 23 | |
|
23 | 24 | from tornado import web |
@@ -412,6 +413,7 b' class IOPubHandler(AuthenticatedZMQStreamHandler):' | |||
|
412 | 413 | return |
|
413 | 414 | km = self.application.kernel_manager |
|
414 | 415 | self.time_to_dead = km.time_to_dead |
|
416 | self.first_beat = km.first_beat | |
|
415 | 417 | kernel_id = self.kernel_id |
|
416 | 418 | try: |
|
417 | 419 | self.iopub_stream = km.create_iopub_stream(kernel_id) |
@@ -446,6 +448,7 b' class IOPubHandler(AuthenticatedZMQStreamHandler):' | |||
|
446 | 448 | self._kernel_alive = True |
|
447 | 449 | |
|
448 | 450 | def ping_or_dead(): |
|
451 | self.hb_stream.flush() | |
|
449 | 452 | if self._kernel_alive: |
|
450 | 453 | self._kernel_alive = False |
|
451 | 454 | self.hb_stream.send(b'ping') |
@@ -461,8 +464,9 b' class IOPubHandler(AuthenticatedZMQStreamHandler):' | |||
|
461 | 464 | self._kernel_alive = True |
|
462 | 465 | |
|
463 | 466 | self.hb_stream.on_recv(beat_received) |
|
464 | self._hb_periodic_callback = ioloop.PeriodicCallback(ping_or_dead, self.time_to_dead*1000) | |
|
465 | self._hb_periodic_callback.start() | |
|
467 | loop = ioloop.IOLoop.instance() | |
|
468 | self._hb_periodic_callback = ioloop.PeriodicCallback(ping_or_dead, self.time_to_dead*1000, loop) | |
|
469 | loop.add_timeout(time.time()+self.first_beat, self._hb_periodic_callback.start) | |
|
466 | 470 | self._beating= True |
|
467 | 471 | |
|
468 | 472 | def stop_hb(self): |
@@ -195,7 +195,10 b' class MappingKernelManager(MultiKernelManager):' | |||
|
195 | 195 | |
|
196 | 196 | kernel_argv = List(Unicode) |
|
197 | 197 | kernel_manager = Instance(KernelManager) |
|
198 | ||
|
198 | 199 | time_to_dead = Float(3.0, config=True, help="""Kernel heartbeat interval in seconds.""") |
|
200 | first_beat = Float(5.0, config=True, help="Delay (in seconds) before sending first heartbeat.") | |
|
201 | ||
|
199 | 202 | max_msg_size = Integer(65536, config=True, help=""" |
|
200 | 203 | The max raw message size accepted from the browser |
|
201 | 204 | over a WebSocket connection. |
General Comments 0
You need to be logged in to leave comments.
Login now