Lifecycle Adapters

lifecycle.api.TaskSubmissionHook

qianmoQqianmoQ· 更新于 2026-10-09· 阅读 5 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

lifecycle.api.TaskSubmissionHook

class hamilton.lifecycle.api.TaskSubmissionHook[source]

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)[source]

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)[source]

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.

评论

登录后参与评论

正在加载评论…