lifecycle.api.TaskReturnHookΒΆ
- class hamilton.lifecycle.api.TaskReturnHookΒΆ
Implement this to hook into the task return process. Tasks are submitted to an executor, which executes the task and returns the results (or raises an error).
- post_task_return(*, run_id: str, task_id: str, nodes: List[Node], result: Any, success: bool, error: Exception | None, spawning_task_id: str | None, purpose: None)ΒΆ
Hook called immediately after a task returns from an executor. Note that this is only useful in dynamic execution, although we reserve the right to add this back into the standard hamilton execution pattern.
- Parameters:
run_id β ID of the run, unique in scope of the driver.
task_id β ID of the task
result β Return value of the task.
success β Whether or not the task executed successfully
error β The error that was raised, if any
spawning_task_id β ID of the task that spawned this task
purpose β Purpose of the current task group
- abstractmethod run_after_task_return(*, run_id: str, task_id: str, nodes: List[Node], result: Any, success: bool, error: Exception | None, spawning_task_id: str | None, purpose: None, **future_kwargs)ΒΆ
Runs after a task has been returned from a executor. By definition this is run outside of the task executor, on the process that executed the driver.
- Parameters:
run_id β ID of the run this is under.
task_id β ID of the task that was just executed.
nodes β Nodes that were part of this task
result β Result of the task
success β Whether the task was successful
error β The error the task threw, if any
spawning_task_id β ID of the task that spawned this task
purpose β Purpose of the current task group
future_kwargs β Reserved for backwards compatibility.