##// END OF EJS Templates
enable topics on IOPub messages
MinRK -
Show More
@@ -286,7 +286,7 b' class Kernel(Configurable):'
286
286
287 self.session.send(self.iopub_stream, u'pyin',
287 self.session.send(self.iopub_stream, u'pyin',
288 {u'code':code, u'execution_count': execution_count},
288 {u'code':code, u'execution_count': execution_count},
289 parent=parent,
289 parent=parent, ident=self._topic('pyin')
290 )
290 )
291
291
292 def execute_request(self, stream, ident, parent):
292 def execute_request(self, stream, ident, parent):
@@ -295,7 +295,7 b' class Kernel(Configurable):'
295 u'status',
295 u'status',
296 {u'execution_state':u'busy'},
296 {u'execution_state':u'busy'},
297 parent=parent,
297 parent=parent,
298 ident='status',
298 ident=self._topic('status'),
299 )
299 )
300
300
301 try:
301 try:
@@ -410,7 +410,8 b' class Kernel(Configurable):'
410 self.session.send(self.iopub_stream,
410 self.session.send(self.iopub_stream,
411 u'status',
411 u'status',
412 {u'execution_state':u'idle'},
412 {u'execution_state':u'idle'},
413 parent=parent )
413 parent=parent,
414 ident=self._topic('status'))
414
415
415 def complete_request(self, stream, ident, parent):
416 def complete_request(self, stream, ident, parent):
416 txt, matches = self._complete(parent)
417 txt, matches = self._complete(parent)
@@ -545,7 +546,7 b' class Kernel(Configurable):'
545 exc_content = self._wrap_exception('apply')
546 exc_content = self._wrap_exception('apply')
546 # exc_msg = self.session.msg(u'pyerr', exc_content, parent)
547 # exc_msg = self.session.msg(u'pyerr', exc_content, parent)
547 self.session.send(self.iopub_stream, u'pyerr', exc_content, parent=parent,
548 self.session.send(self.iopub_stream, u'pyerr', exc_content, parent=parent,
548 ident=py3compat.str_to_bytes('%s.pyerr'%self.prefix))
549 ident=self._topic('pyerr'))
549 reply_content = exc_content
550 reply_content = exc_content
550 result_buf = []
551 result_buf = []
551
552
@@ -595,6 +596,16 b' class Kernel(Configurable):'
595 # Protected interface
596 # Protected interface
596 #---------------------------------------------------------------------------
597 #---------------------------------------------------------------------------
597
598
599
600 def _topic(self, topic):
601 """prefixed topic for IOPub messages"""
602 if self.int_id >= 0:
603 base = "engine.%i" % self.int_id
604 else:
605 base = "kernel.%s" % self.ident
606
607 return py3compat.cast_bytes("%s.%s" % (base, topic))
608
598 def _abort_queues(self):
609 def _abort_queues(self):
599 for stream in self.shell_streams:
610 for stream in self.shell_streams:
600 if stream:
611 if stream:
@@ -704,7 +715,7 b' class Kernel(Configurable):'
704 """
715 """
705 # io.rprint("Kernel at_shutdown") # dbg
716 # io.rprint("Kernel at_shutdown") # dbg
706 if self._shutdown_message is not None:
717 if self._shutdown_message is not None:
707 self.session.send(self.iopub_stream, self._shutdown_message)
718 self.session.send(self.iopub_stream, self._shutdown_message, ident=self._topic('shutdown'))
708 self.log.debug("%s", self._shutdown_message)
719 self.log.debug("%s", self._shutdown_message)
709 [ s.flush(zmq.POLLOUT) for s in self.shell_streams + [self.iopub_stream] ]
720 [ s.flush(zmq.POLLOUT) for s in self.shell_streams + [self.iopub_stream] ]
710
721
General Comments 0
You need to be logged in to leave comments. Login now