lifecycle.api.TaskSubmissionHookΒΆ

class hamilton.lifecycle.api.TaskSubmissionHookΒΆ

Implement this to hook into the task submission process. Tasks are submitted to an executor, which then controls how and where the nodes associated with the task are run.

pre_task_submission(*, run_id: str, task_id: str, nodes: List[Node], inputs: Dict[str, Any], overrides: Dict[str, Any], spawning_task_id: str | None, purpose: None)ΒΆ

Hook that is called immediately prior to task submission to an executor as a task future. 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.

  • nodes – Nodes that are being executed.

  • inputs – Inputs to the task.

  • overrides – Overrides to task execution.

  • spawning_task_id – ID of the task that spawned this task.

  • purpose – Purpose of the current task group.

abstractmethod run_before_task_submission(*, run_id: str, task_id: str, nodes: List[Node], inputs: Dict[str, Any], overrides: Dict[str, Any], spawning_task_id: str | None, purpose: None, **future_kwargs)ΒΆ

Runs prior to a task being submitted to an 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 we’re launching.

  • nodes – Nodes that are part of this task

  • inputs – Inputs to the task

  • overrides – Overrides passed to the task

  • spawning_task_id – ID of the task that spawned this task

  • purpose – Purpose of the current task group

  • future_kwargs – Reserved for backwards compatibility.