@@ -303,7 +303,7 @@ async def process_control_message(self, msg=None):
303303
304304 # Set the parent message for side effects.
305305 self .set_parent (idents , msg , channel = "control" )
306- self ._publish_status ("busy" , "control" )
306+ self ._publish_status ("busy" , "control" , parent = msg )
307307
308308 header = msg ["header" ]
309309 msg_type = header ["msg_type" ]
@@ -462,12 +462,12 @@ async def _execute_request_handler(self, receive_stream: MemoryObjectReceiveStre
462462 await self ._send_abort_reply (socket , msg , idents )
463463 continue
464464 self .set_parent (idents , msg , channel = "shell" )
465- self ._publish_status ("busy" , "shell" )
465+ self ._publish_status ("busy" , "shell" , parent = msg )
466466 result = handler (socket , idents , msg )
467467 if inspect .isawaitable (result ):
468468 await result
469469 self .set_parent (idents , msg , channel = "shell" )
470- self ._publish_status ("idle" , "shell" )
470+ self ._publish_status ("idle" , "shell" , parent = msg )
471471 except BaseException as e :
472472 self .log .exception ("Execute request" , exc_info = e )
473473
@@ -507,9 +507,7 @@ async def process_shell_message(self, msg=None, socket=None):
507507
508508 msg_type = msg ["header" ]["msg_type" ]
509509 if msg_type != "execute_request" :
510- # Set the parent message for side effects.
511- self .set_parent (idents , msg , channel = "shell" )
512- self ._publish_status ("busy" , "shell" )
510+ self ._publish_status ("busy" , "shell" , parent = msg )
513511
514512 # Print some info about this message and leave a '--->' marker, so it's
515513 # easier to trace visually the message chain when debugging. Each
@@ -552,12 +550,7 @@ async def process_shell_message(self, msg=None, socket=None):
552550 except Exception :
553551 self .log .debug ("Unable to signal in post_handler_hook:" , exc_info = True )
554552 if msg_type != "execute_request" :
555- self .set_parent (idents , msg , channel = "shell" )
556- if sys .stdout is not None :
557- sys .stdout .flush ()
558- if sys .stderr is not None :
559- sys .stderr .flush ()
560- self ._publish_status ("idle" , "shell" )
553+ self ._publish_status ("idle" , "shell" , parent = msg )
561554
562555 async def control_main (self ):
563556 assert self .control_socket is not None
0 commit comments