Skip to content

Commit

Permalink
WIP: creating file to help debug an error
Browse files Browse the repository at this point in the history
Proof of concept.

TODOs:
 - python dependency logging
 - creating a notebook version of this
 - tests
 - extensions would be to serialize things more effectively
  • Loading branch information
skrawcz committed Mar 25, 2024
1 parent 7cdc781 commit 560550a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/notebook_debug/notebook_debugger_plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import inspect
import logging
from typing import Any, Callable, Dict, Optional

from hamilton import lifecycle
Expand All @@ -7,7 +9,8 @@
except ImportError:
import pickle

import inspect
logger = logging.getLogger(__name__)


template = """
try:
Expand Down Expand Up @@ -88,7 +91,10 @@ def run_after_node_execution(
)
)
# print out where the data has been saved
print(f"Inputs to {node_name} have been saved to {node_name}_inputs.pkl")
print(f"The function that errored has been saved to {node_name}_debug.py")
print(f"Please run the function in {node_name}_debug.py to debug the error.")
message = (
f"Inputs to {node_name} have been saved to {node_name}_inputs.pkl\n"
f"The function that errored has been saved to {node_name}_debug.py\n"
f"Please run the function in {node_name}_debug.py to debug the error."
)
logger.warning(message)
# TODO: create file with python requirements for pickle to work...

0 comments on commit 560550a

Please sign in to comment.