##// END OF EJS Templates
Implementing kernel status messages.
Brian Granger -
Show More
@@ -355,7 +355,12 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
355
355
356 self._append_plain_text(text)
356 self._append_plain_text(text)
357 self._control.moveCursor(QtGui.QTextCursor.End)
357 self._control.moveCursor(QtGui.QTextCursor.End)
358
358
359 def _handle_status(self, msg):
360 """ Handle kernel status messages.
361 """
362 pass
363
359 def _started_channels(self):
364 def _started_channels(self):
360 """ Called when the KernelManager channels have started listening or
365 """ Called when the KernelManager channels have started listening or
361 when the frontend is assigned an already listening KernelManager.
366 when the frontend is assigned an already listening KernelManager.
@@ -172,6 +172,14 b' class Kernel(Configurable):'
172 self.pub_socket.send_json(pyin_msg)
172 self.pub_socket.send_json(pyin_msg)
173
173
174 def execute_request(self, ident, parent):
174 def execute_request(self, ident, parent):
175
176 status_msg = self.session.msg(
177 u'status',
178 {u'execution_state':u'busy'},
179 parent=parent
180 )
181 self.pub_socket.send_json(status_msg)
182
175 try:
183 try:
176 content = parent[u'content']
184 content = parent[u'content']
177 code = content[u'code']
185 code = content[u'code']
@@ -277,6 +285,13 b' class Kernel(Configurable):'
277 if reply_msg['content']['status'] == u'error':
285 if reply_msg['content']['status'] == u'error':
278 self._abort_queue()
286 self._abort_queue()
279
287
288 status_msg = self.session.msg(
289 u'status',
290 {u'execution_state':u'idle'},
291 parent=parent
292 )
293 self.pub_socket.send_json(status_msg)
294
280 def complete_request(self, ident, parent):
295 def complete_request(self, ident, parent):
281 txt, matches = self._complete(parent)
296 txt, matches = self._complete(parent)
282 matches = {'matches' : matches,
297 matches = {'matches' : matches,
@@ -671,6 +671,19 b' Message type: ``pyerr``::'
671 # except the 'status' field is omitted.
671 # except the 'status' field is omitted.
672 }
672 }
673
673
674 Kernel status
675 -------------
676
677 This message type is used by frontends to monitor the status of the kernel.
678
679 Message type: ``status``::
680
681 content = {
682 # When the kernel starts to execute code, it will enter the 'busy'
683 # state and when it finishes, it will enter the 'idle' state.
684 execution_state : ('busy', 'idle')
685 }
686
674 Kernel crashes
687 Kernel crashes
675 --------------
688 --------------
676
689
General Comments 0
You need to be logged in to leave comments. Login now