Skip to main content
def JobClient.submit(
  job_name: str,
  root_task_or_tasks: Task | Iterable[Task],
  cluster: str | Cluster | Iterable[str | Cluster] | None = None,
  max_retries: int = 0
) -> Job
Submit a job.

Parameters

job_name
str
The name of the job.
root_task_or_tasks
Task
The root task for the job. This task is executed first and can submit subtasks to manage the entire workflow. A job can have optionally consist of multiple root tasks.
cluster
str | Cluster | Iterable[str | Cluster] | None
The cluster slug for the cluster to run the root task on. In case of multiple root tasks, a list of cluster slugs can be provided. If not provided, the default cluster is used.
max_retries
int
The maximum number of retries for the subtask in case it fails. Defaults to 0.
from my_workflow import MyTask

job = job_client.submit(
    "my-job",
    MyTask(
      message="Hello, World!", 
      value=42,
      data={"key": "value"}
    ),
)