---
title: "ExecutionContext.submit_subtasks"
description: "Submit multiple subtasks from a currently executing task."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://tilebox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ExecutionContext.submit_subtasks

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```python
def ExecutionContext.submit_subtasks(
  tasks: Sequence[Task],
  depends_on: FutureTask | list[FutureTask] | None = None,
  cluster: str | None = None,
  max_retries: int = 0,
  optional: bool = False
) -> list[FutureTask]
```

Submit multiple [subtasks](/docs/workflows/concepts/tasks#task-composition-and-subtasks) from a currently executing task. Same as [submit_subtask](/docs/api-reference/python/tilebox.workflows/ExecutionContext.submit_subtask), but accepts a sequence of tasks.

## Parameters

**tasks**

type: Sequence[Task]

The tasks to submit as subtasks.

**depends_on**

type: FutureTask | list[FutureTask] | None

An optional task or list of tasks already submitted within the same context that the subtasks depend on.

**cluster**

type: str

An optional [cluster slug](/docs/workflows/concepts/clusters#managing-clusters) for running the subtasks. If not provided, the subtasks run on the same cluster as the parent task.

**max_retries**

type: int

Specify the maximum number of [retries](/docs/workflows/concepts/tasks#retry-handling) for the subtasks in case of failure. The default is 0.

**optional**

type: bool

Whether the subtasks are [optional](/docs/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.

<h2 id="request-example">Usage example</h2>

```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
)
```

Source: https://tilebox.com/docs/api-reference/python/tilebox.workflows/ExecutionContext.submit_subtasks/index.mdx
