##// END OF EJS Templates
minor fixes to allow kernel to be re-entrant...
MinRK -
Show More
@@ -84,7 +84,7 b' class Kernel(Configurable):'
84 stdin_socket = Instance(zmq.Socket)
84 stdin_socket = Instance(zmq.Socket)
85 log = Instance(logging.Logger)
85 log = Instance(logging.Logger)
86
86
87 user_module = Instance('types.ModuleType')
87 user_module = Any()
88 def _user_module_changed(self, name, old, new):
88 def _user_module_changed(self, name, old, new):
89 if self.shell is not None:
89 if self.shell is not None:
90 self.shell.user_module = new
90 self.shell.user_module = new
@@ -250,6 +250,7 b' class Kernel(Configurable):'
250
250
251 def start(self):
251 def start(self):
252 """register dispatchers for streams"""
252 """register dispatchers for streams"""
253 self.shell.exit_now = False
253 if self.control_stream:
254 if self.control_stream:
254 self.control_stream.on_recv(self.dispatch_control, copy=False)
255 self.control_stream.on_recv(self.dispatch_control, copy=False)
255
256
@@ -501,7 +502,8 b' class Kernel(Configurable):'
501
502
502 self._at_shutdown()
503 self._at_shutdown()
503 # call sys.exit after a short delay
504 # call sys.exit after a short delay
504 ioloop.IOLoop.instance().add_timeout(time.time()+0.1, lambda : sys.exit(0))
505 loop = ioloop.IOLoop.instance()
506 loop.add_timeout(time.time()+0.1, loop.stop)
505
507
506 #---------------------------------------------------------------------------
508 #---------------------------------------------------------------------------
507 # Engine methods
509 # Engine methods
@@ -225,6 +225,7 b' class KernelApp(BaseIPythonApplication):'
225 self.heartbeat = Heartbeat(hb_ctx, (self.ip, self.hb_port))
225 self.heartbeat = Heartbeat(hb_ctx, (self.ip, self.hb_port))
226 self.hb_port = self.heartbeat.port
226 self.hb_port = self.heartbeat.port
227 self.log.debug("Heartbeat REP Channel on port: %i"%self.hb_port)
227 self.log.debug("Heartbeat REP Channel on port: %i"%self.hb_port)
228 self.heartbeat.start()
228
229
229 # Helper to make it easier to connect to an existing kernel.
230 # Helper to make it easier to connect to an existing kernel.
230 # set log-level to critical, to make sure it is output
231 # set log-level to critical, to make sure it is output
@@ -302,7 +303,6 b' class KernelApp(BaseIPythonApplication):'
302 sys.stderr.flush()
303 sys.stderr.flush()
303
304
304 def start(self):
305 def start(self):
305 self.heartbeat.start()
306 if self.poller is not None:
306 if self.poller is not None:
307 self.poller.start()
307 self.poller.start()
308 self.kernel.start()
308 self.kernel.start()
General Comments 0
You need to be logged in to leave comments. Login now