Last active
June 20, 2020 12:05
-
-
Save mzjp2/53eb88c7d388b2f712672ec458780051 to your computer and use it in GitHub Desktop.
Kedro hook for post mortem debugging sesions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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