Skip to content

Commit

Permalink
Merge pull request #684 from minrk/abort-metadata
Browse files Browse the repository at this point in the history
call metadata methods on abort replies
  • Loading branch information
blink1073 authored Jun 9, 2021
2 parents 2ec4cbf + 0a22670 commit 13fabea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ async def dispatch_shell(self, msg):
self.log.error("Exception in message handler:", exc_info=True)
except KeyboardInterrupt:
# Ctrl-c shouldn't crash the kernel here.
self.log.error("KeyboardInterrupt caught in kernel.")
self.log.error("KeyboardInterrupt caught in kernel.")
finally:
try:
self.post_handler_hook()
Expand Down Expand Up @@ -921,12 +921,15 @@ def stop_aborting():

def _send_abort_reply(self, stream, msg, idents):
"""Send a reply to an aborted request"""
self.log.info("Aborting:")
self.log.info("%s", msg)
self.log.info(
f"Aborting {msg['header']['msg_id']}: {msg['header']['msg_type']}"
)
reply_type = msg["header"]["msg_type"].rsplit("_", 1)[0] + "_reply"
status = {"status": "aborted"}
md = {"engine": self.ident}
md = self.init_metadata(msg)
md = self.finish_metadata(msg, md, status)
md.update(status)

self.session.send(
stream, reply_type, metadata=md,
content=status, parent=msg, ident=idents,
Expand Down

0 comments on commit 13fabea

Please sign in to comment.