Skip to content

Instantly share code, notes, and snippets.

@mzjp2
Last active June 20, 2020 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzjp2/53eb88c7d388b2f712672ec458780051 to your computer and use it in GitHub Desktop.
Save mzjp2/53eb88c7d388b2f712672ec458780051 to your computer and use it in GitHub Desktop.
Kedro hook for post mortem debugging sesions
class PDBDebugHook:
"""A hook class for creating a post mortem debugging with the PDB debugger
whenever an error is triggered within a node. The local scope from when the
exception occured is available within this debugging session.
"""
@hook_impl
def on_node_error(self):
_, _, traceback_object = sys.exc_info()
# Print the traceback information for debugging ease
traceback.print_tb(traceback_object)
# Drop you into a post mortem debugging session
pdb.post_mortem(traceback_object)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment