lifecycle.NodeExecutionHookΒΆ
- class hamilton.lifecycle.api.NodeExecutionHookΒΆ
Implement this to hook into the node execution lifecycle. You can call anything before and after the driver
- final post_node_execute(*, run_id: str, node_: Node, kwargs: Dict[str, Any], success: bool, error: Exception | None, result: Any | None, task_id: str | None = None)ΒΆ
Wraps the after_execution method, providing a bridge to an external-facing API. Do not override this!
- final pre_node_execute(*, run_id: str, node_: Node, kwargs: Dict[str, Any], task_id: str | None = None)ΒΆ
Wraps the before_execution method, providing a bridge to an external-facing API. Do not override this!
- abstract run_after_node_execution(*, node_name: str, node_tags: Dict[str, Any], node_kwargs: Dict[str, Any], node_return_type: type, result: Any, error: Exception | None, success: bool, task_id: str | None, run_id: str, **future_kwargs: Any)ΒΆ
Hook that is executed post node execution.
- Parameters:
node_name β Name of the node in question
node_tags β Tags of the node
node_kwargs β Keyword arguments passed to the node
node_return_type β Return type of the node
result β Output of the node, None if an error occurred
error β Error that occurred, None if no error occurred
success β Whether the node executed successfully
task_id β The ID of the task, none if not in a task-based environment
run_id β Run ID (unique in process scope) of the current run. Use this to track state.
future_kwargs β Additional keyword arguments β this is kept for backwards compatibility
- abstract run_before_node_execution(*, node_name: str, node_tags: Dict[str, Any], node_kwargs: Dict[str, Any], node_return_type: type, task_id: str | None, run_id: str, node_input_types: Dict[str, Any], **future_kwargs: Any)ΒΆ
Hook that is executed prior to node execution.
- Parameters:
node_name β Name of the node.
node_tags β Tags of the node
node_kwargs β Keyword arguments to pass to the node
node_return_type β Return type of the node
task_id β The ID of the task, none if not in a task-based environment
run_id β Run ID (unique in process scope) of the current run. Use this to track state.
node_input_types β the input types to the node and what it is expecting
future_kwargs β Additional keyword arguments β this is kept for backwards compatibility