Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.87 KB

File metadata and controls

54 lines (43 loc) · 1.87 KB
title Context.submit_subtasks
icon folder-gear
def ExecutionContext.submit_subtasks(
  tasks: Sequence[Task],
  depends_on: list[FutureTask] = None,
  cluster: str | None = None,
  max_retries: int = 0,
  optional: bool = False
) -> list[FutureTask]

Submit multiple subtasks from a currently executing task. Same as submit_subtask, but accepts a sequence of tasks.

Parameters

The tasks to submit as subtasks. An optional list of tasks already submitted within the same context that the subtasks depend on. An optional [cluster slug](/workflows/concepts/clusters#managing-clusters) for running the subtasks. If not provided, the subtasks run on the same cluster as the parent task. Specify the maximum number of [retries](/workflows/concepts/tasks#retry-handling) for the subtasks in case of failure. The default is 0. Whether the subtasks are [optional](/workflows/concepts/tasks#optional-tasks). If `True`, the subtasks will not fail the job if they fail. Tasks that depend on them will still execute even if they failed. The default is `False`.

Returns

A list of FutureTask objects representing the submitted subtasks. Can be used to set up dependencies between tasks.

```python Python # within the execute method of a Task: subtasks = context.submit_subtasks([ MySubtask(i) for i in range(10) ]) dependent_subtask = context.submit_subtask( MyOtherSubtask(), depends_on=subtasks ) ```