Show More
@@ -308,16 +308,22 b' class Kernel(Configurable):' | |||||
308 | {u'code':code, u'execution_count': execution_count}, |
|
308 | {u'code':code, u'execution_count': execution_count}, | |
309 | parent=parent, ident=self._topic('pyin') |
|
309 | parent=parent, ident=self._topic('pyin') | |
310 | ) |
|
310 | ) | |
311 |
|
311 | |||
312 |
def |
|
312 | def _publish_status(self, status, parent=None): | |
313 |
|
313 | """send status (busy/idle) on IOPub""" | ||
314 | self.session.send(self.iopub_socket, |
|
314 | self.session.send(self.iopub_socket, | |
315 | u'status', |
|
315 | u'status', | |
316 |
{u'execution_state': |
|
316 | {u'execution_state': status}, | |
317 | parent=parent, |
|
317 | parent=parent, | |
318 | ident=self._topic('status'), |
|
318 | ident=self._topic('status'), | |
319 | ) |
|
319 | ) | |
320 |
|
320 | |||
|
321 | ||||
|
322 | def execute_request(self, stream, ident, parent): | |||
|
323 | """handle an execute_request""" | |||
|
324 | ||||
|
325 | self._publish_status(u'busy', parent) | |||
|
326 | ||||
321 | try: |
|
327 | try: | |
322 | content = parent[u'content'] |
|
328 | content = parent[u'content'] | |
323 | code = content[u'code'] |
|
329 | code = content[u'code'] | |
@@ -433,11 +439,7 b' class Kernel(Configurable):' | |||||
433 | if not silent and reply_msg['content']['status'] == u'error': |
|
439 | if not silent and reply_msg['content']['status'] == u'error': | |
434 | self._abort_queues() |
|
440 | self._abort_queues() | |
435 |
|
441 | |||
436 | self.session.send(self.iopub_socket, |
|
442 | self._publish_status(u'idle', parent) | |
437 | u'status', |
|
|||
438 | {u'execution_state':u'idle'}, |
|
|||
439 | parent=parent, |
|
|||
440 | ident=self._topic('status')) |
|
|||
441 |
|
443 | |||
442 | def complete_request(self, stream, ident, parent): |
|
444 | def complete_request(self, stream, ident, parent): | |
443 | txt, matches = self._complete(parent) |
|
445 | txt, matches = self._complete(parent) | |
@@ -529,6 +531,8 b' class Kernel(Configurable):' | |||||
529 | self.log.error("Got bad msg: %s", parent, exc_info=True) |
|
531 | self.log.error("Got bad msg: %s", parent, exc_info=True) | |
530 | return |
|
532 | return | |
531 |
|
533 | |||
|
534 | self._publish_status(u'busy', parent) | |||
|
535 | ||||
532 | # Set the parent message of the display hook and out streams. |
|
536 | # Set the parent message of the display hook and out streams. | |
533 | shell = self.shell |
|
537 | shell = self.shell | |
534 | shell.displayhook.set_parent(parent) |
|
538 | shell.displayhook.set_parent(parent) | |
@@ -599,6 +603,8 b' class Kernel(Configurable):' | |||||
599 | reply_msg = self.session.send(stream, u'apply_reply', reply_content, |
|
603 | reply_msg = self.session.send(stream, u'apply_reply', reply_content, | |
600 | parent=parent, ident=ident,buffers=result_buf, subheader=sub) |
|
604 | parent=parent, ident=ident,buffers=result_buf, subheader=sub) | |
601 |
|
605 | |||
|
606 | self._publish_status(u'idle', parent) | |||
|
607 | ||||
602 | #--------------------------------------------------------------------------- |
|
608 | #--------------------------------------------------------------------------- | |
603 | # Control messages |
|
609 | # Control messages | |
604 | #--------------------------------------------------------------------------- |
|
610 | #--------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now