We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

SDK ReferencePython SDKRunnables

Runnables

Runnables in the Hatchet SDK are things that can be run, namely tasks and workflows. The two main types of runnables you’ll encounter are:

  • Workflow, which lets you define tasks and call all of the run, schedule, etc. methods
  • Standalone, which is a single task that’s returned by hatchet.task and can be run, scheduled, etc.

Workflow

Bases: BaseWorkflow[TWorkflowInput]

A Hatchet workflow, which allows you to define tasks to be run and perform actions on the workflow.

Workflows in Hatchet represent coordinated units of work that can be triggered, scheduled, or run on a cron schedule. Each workflow can contain multiple tasks that can be arranged in dependencies (DAGs), have customized retry behavior, timeouts, concurrency controls, and more.

Example:

from pydantic import BaseModel
from hatchet_sdk import Hatchet
 
class MyInput(BaseModel):
    name: str
 
hatchet = Hatchet()
workflow = hatchet.workflow("my-workflow", input_type=MyInput)
 
@workflow.task()
def greet(input, ctx):
    return f"Hello, {input.name}!"
 
# Run the workflow
result = workflow.run(MyInput(name="World"))

Workflows support various execution patterns including:

  • One-time execution with run() or aio_run()
  • Scheduled execution with schedule()
  • Cron-based recurring execution with create_cron()
  • Bulk operations with run_many()

Tasks within workflows can be defined with @workflow.task() or @workflow.durable_task() decorators and can be arranged into complex dependency patterns.

Methods:

NameDescription
taskA decorator to transform a function into a Hatchet task that runs as part of a workflow.
durable_taskA decorator to transform a function into a durable Hatchet task that runs as part of a workflow.
on_failure_taskA decorator to transform a function into a Hatchet on-failure task that runs as the last step in a workflow that had at least one task fail.
on_success_taskA decorator to transform a function into a Hatchet on-success task that runs as the last step in a workflow that had all upstream tasks succeed.
runRun the workflow synchronously and wait for it to complete.
aio_runRun the workflow asynchronously and wait for it to complete.
run_no_waitSynchronously trigger a workflow run without waiting for it to complete.
aio_run_no_waitAsynchronously trigger a workflow run without waiting for it to complete.
run_manyRun a workflow in bulk and wait for all runs to complete.
aio_run_manyRun a workflow in bulk and wait for all runs to complete.
run_many_no_waitRun a workflow in bulk without waiting for all runs to complete.
aio_run_many_no_waitRun a workflow in bulk without waiting for all runs to complete.
scheduleSchedule a workflow to run at a specific time.
aio_scheduleSchedule a workflow to run at a specific time.
create_cronCreate a cron job for the workflow.
aio_create_cronCreate a cron job for the workflow.
create_bulk_run_itemCreate a bulk run item for the workflow. This is intended to be used in conjunction with the various run_many methods.
list_runsList runs of the workflow.
aio_list_runsList runs of the workflow.
create_filterCreate a new filter.
aio_create_filterCreate a new filter.

Attributes

name

The (namespaced) name of the workflow.

tasks

id cached

Get the ID of the workflow.

Returns:

TypeDescription
strThe ID of the workflow.

Raises:

TypeDescription
ValueErrorIf no workflow ID is found for the workflow name.

Functions

task

A decorator to transform a function into a Hatchet task that runs as part of a workflow.

Parameters:

NameTypeDescriptionDefault
namestr | NoneThe name of the task. If not specified, defaults to the name of the function being wrapped by the task decorator.None
schedule_timeoutDurationThe maximum time to wait for the task to be scheduled. The run will be canceled if the task does not begin within this time.timedelta(minutes=5)
execution_timeoutDurationThe maximum time to wait for the task to complete. The run will be canceled if the task does not complete within this time.timedelta(seconds=60)
parentslist[Task[TWorkflowInput, Any]] | NoneA list of tasks that are parents of the task. Note: Parents must be defined before their children.None
retriesintThe number of times to retry the task before failing.0
rate_limitslist[RateLimit] | NoneA list of rate limit configurations for the task.None
desired_worker_labelsdict[str, DesiredWorkerLabel] | NoneA dictionary of desired worker labels that determine to which worker the task should be assigned. See documentation and examples on affinity and worker labels for more details.None
backoff_factorfloat | NoneThe backoff factor for controlling exponential backoff in retries.None
backoff_max_secondsint | NoneThe maximum number of seconds to allow retries with exponential backoff to continue.None
concurrencylist[ConcurrencyExpression] | NoneA list of concurrency expressions for the task.None
wait_forlist[Condition | OrGroup] | NoneA list of conditions that must be met before the task can run.None
skip_iflist[Condition | OrGroup] | NoneA list of conditions that, if met, will cause the task to be skipped.None
cancel_iflist[Condition | OrGroup] | NoneA list of conditions that, if met, will cause the task to be canceled.None

Returns:

TypeDescription
Callable[[Callable[[TWorkflowInput, Context], R | CoroutineLike[R]]], Task[TWorkflowInput, R]]A decorator which creates a Task object.

durable_task

A decorator to transform a function into a durable Hatchet task that runs as part of a workflow.

IMPORTANT: This decorator creates a durable task, which works using Hatchet’s durable execution capabilities. This is an advanced feature of Hatchet.

See the Hatchet docs for more information on durable execution to decide if this is right for you.

Parameters:

NameTypeDescriptionDefault
namestr | NoneThe name of the task. If not specified, defaults to the name of the function being wrapped by the task decorator.None
schedule_timeoutDurationThe maximum time to wait for the task to be scheduled. The run will be canceled if the task does not begin within this time.timedelta(minutes=5)
execution_timeoutDurationThe maximum time to wait for the task to complete. The run will be canceled if the task does not complete within this time.timedelta(seconds=60)
parentslist[Task[TWorkflowInput, Any]] | NoneA list of tasks that are parents of the task. Note: Parents must be defined before their children.None
retriesintThe number of times to retry the task before failing.0
rate_limitslist[RateLimit] | NoneA list of rate limit configurations for the task.None
desired_worker_labelsdict[str, DesiredWorkerLabel] | NoneA dictionary of desired worker labels that determine to which worker the task should be assigned. See documentation and examples on affinity and worker labels for more details.None
backoff_factorfloat | NoneThe backoff factor for controlling exponential backoff in retries.None
backoff_max_secondsint | NoneThe maximum number of seconds to allow retries with exponential backoff to continue.None
concurrencylist[ConcurrencyExpression] | NoneA list of concurrency expressions for the task.None
wait_forlist[Condition | OrGroup] | NoneA list of conditions that must be met before the task can run.None
skip_iflist[Condition | OrGroup] | NoneA list of conditions that, if met, will cause the task to be skipped.None
cancel_iflist[Condition | OrGroup] | NoneA list of conditions that, if met, will cause the task to be canceled.None

Returns:

TypeDescription
Callable[[Callable[[TWorkflowInput, DurableContext], R | CoroutineLike[R]]], Task[TWorkflowInput, R]]A decorator which creates a Task object.

on_failure_task

A decorator to transform a function into a Hatchet on-failure task that runs as the last step in a workflow that had at least one task fail.

Parameters:

NameTypeDescriptionDefault
namestr | NoneThe name of the on-failure task. If not specified, defaults to the name of the function being wrapped by the on_failure_task decorator.None
schedule_timeoutDurationThe maximum time to wait for the task to be scheduled. The run will be canceled if the task does not begin within this time.timedelta(minutes=5)
execution_timeoutDurationThe maximum time to wait for the task to complete. The run will be canceled if the task does not complete within this time.timedelta(seconds=60)
retriesintThe number of times to retry the on-failure task before failing.0
rate_limitslist[RateLimit] | NoneA list of rate limit configurations for the on-failure task.None
backoff_factorfloat | NoneThe backoff factor for controlling exponential backoff in retries.None
backoff_max_secondsint | NoneThe maximum number of seconds to allow retries with exponential backoff to continue.None
concurrencylist[ConcurrencyExpression] | NoneA list of concurrency expressions for the on-success task.None

Returns:

TypeDescription
Callable[[Callable[[TWorkflowInput, Context], R | CoroutineLike[R]]], Task[TWorkflowInput, R]]A decorator which creates a Task object.

on_success_task

A decorator to transform a function into a Hatchet on-success task that runs as the last step in a workflow that had all upstream tasks succeed.

Parameters:

NameTypeDescriptionDefault
namestr | NoneThe name of the on-success task. If not specified, defaults to the name of the function being wrapped by the on_success_task decorator.None
schedule_timeoutDurationThe maximum time to wait for the task to be scheduled. The run will be canceled if the task does not begin within this time.timedelta(minutes=5)
execution_timeoutDurationThe maximum time to wait for the task to complete. The run will be canceled if the task does not complete within this time.timedelta(seconds=60)
retriesintThe number of times to retry the on-success task before failing0
rate_limitslist[RateLimit] | NoneA list of rate limit configurations for the on-success task.None
backoff_factorfloat | NoneThe backoff factor for controlling exponential backoff in retries.None
backoff_max_secondsint | NoneThe maximum number of seconds to allow retries with exponential backoff to continue.None
concurrencylist[ConcurrencyExpression] | NoneA list of concurrency expressions for the on-success task.None

Returns:

TypeDescription
Callable[[Callable[[TWorkflowInput, Context], R | CoroutineLike[R]]], Task[TWorkflowInput, R]]A decorator which creates a Task object.

run

Run the workflow synchronously and wait for it to complete.

This method triggers a workflow run, blocks until completion, and returns the final result.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow, must match the workflow’s input type.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution like metadata and parent workflow ID.TriggerWorkflowOptions()

Returns:

TypeDescription
dict[str, Any]The result of the workflow execution as a dictionary.

aio_run

Run the workflow asynchronously and wait for it to complete.

This method triggers a workflow run, awaits until completion, and returns the final result.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow, must match the workflow’s input type.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution like metadata and parent workflow ID.TriggerWorkflowOptions()

Returns:

TypeDescription
dict[str, Any]The result of the workflow execution as a dictionary.

run_no_wait

Synchronously trigger a workflow run without waiting for it to complete. This method is useful for starting a workflow run and immediately returning a reference to the run without blocking while the workflow runs.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution.TriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowRunRefA WorkflowRunRef object representing the reference to the workflow run.

aio_run_no_wait

Asynchronously trigger a workflow run without waiting for it to complete. This method is useful for starting a workflow run and immediately returning a reference to the run without blocking while the workflow runs.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution.TriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowRunRefA WorkflowRunRef object representing the reference to the workflow run.

run_many

Run a workflow in bulk and wait for all runs to complete. This method triggers multiple workflow runs, blocks until all of them complete, and returns the final results.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[dict[str, Any]]A list of results for each workflow run.

aio_run_many

Run a workflow in bulk and wait for all runs to complete. This method triggers multiple workflow runs, blocks until all of them complete, and returns the final results.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[dict[str, Any]]A list of results for each workflow run.

run_many_no_wait

Run a workflow in bulk without waiting for all runs to complete.

This method triggers multiple workflow runs and immediately returns a list of references to the runs without blocking while the workflows run.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[WorkflowRunRef]A list of WorkflowRunRef objects, each representing a reference to a workflow run.

aio_run_many_no_wait

Run a workflow in bulk without waiting for all runs to complete.

This method triggers multiple workflow runs and immediately returns a list of references to the runs without blocking while the workflows run.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[WorkflowRunRef]A list of WorkflowRunRef objects, each representing a reference to a workflow run.

schedule

Schedule a workflow to run at a specific time.

Parameters:

NameTypeDescriptionDefault
run_atdatetimeThe time at which to schedule the workflow.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsScheduleTriggerWorkflowOptionsAdditional options for workflow execution.ScheduleTriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowVersionA WorkflowVersion object representing the scheduled workflow.

aio_schedule

Schedule a workflow to run at a specific time.

Parameters:

NameTypeDescriptionDefault
run_atdatetimeThe time at which to schedule the workflow.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsScheduleTriggerWorkflowOptionsAdditional options for workflow execution.ScheduleTriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowVersionA WorkflowVersion object representing the scheduled workflow.

create_cron

Create a cron job for the workflow.

Parameters:

NameTypeDescriptionDefault
cron_namestrThe name of the cron job.required
expressionstrThe cron expression that defines the schedule for the cron job.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
additional_metadataJSONSerializableMapping | NoneAdditional metadata for the cron job.None
priorityint | NoneThe priority of the cron job. Must be between 1 and 3, inclusive.None

Returns:

TypeDescription
CronWorkflowsA CronWorkflows object representing the created cron job.

aio_create_cron

Create a cron job for the workflow.

Parameters:

NameTypeDescriptionDefault
cron_namestrThe name of the cron job.required
expressionstrThe cron expression that defines the schedule for the cron job.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
additional_metadataJSONSerializableMapping | NoneAdditional metadata for the cron job.None
priorityint | NoneThe priority of the cron job. Must be between 1 and 3, inclusive.None

Returns:

TypeDescription
CronWorkflowsA CronWorkflows object representing the created cron job.

create_bulk_run_item

Create a bulk run item for the workflow. This is intended to be used in conjunction with the various run_many methods.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
keystr | NoneThe key for the workflow run. This is used to identify the run in the bulk operation and for deduplication.None
optionsTriggerWorkflowOptionsAdditional options for the workflow run.TriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowRunTriggerConfigA WorkflowRunTriggerConfig object that can be used to trigger the workflow run, which you then pass into the run_many methods.

list_runs

List runs of the workflow.

Parameters:

NameTypeDescriptionDefault
sincedatetime | NoneThe start time for the runs to be listed.None
untildatetime | NoneThe end time for the runs to be listed.None
limitintThe maximum number of runs to be listed.100
offsetint | NoneThe offset for pagination.None
statuseslist[V1TaskStatus] | NoneThe statuses of the runs to be listed.None
additional_metadatadict[str, str] | NoneAdditional metadata for filtering the runs.None
worker_idstr | NoneThe ID of the worker that ran the tasks.None
parent_task_external_idstr | NoneThe external ID of the parent task.None
only_tasksboolWhether to list only task runs.False
triggering_event_external_idstr | NoneThe event id that triggered the task run.None

Returns:

TypeDescription
list[V1TaskSummary]A list of V1TaskSummary objects representing the runs of the workflow.

aio_list_runs

List runs of the workflow.

Parameters:

NameTypeDescriptionDefault
sincedatetime | NoneThe start time for the runs to be listed.None
untildatetime | NoneThe end time for the runs to be listed.None
limitintThe maximum number of runs to be listed.100
offsetint | NoneThe offset for pagination.None
statuseslist[V1TaskStatus] | NoneThe statuses of the runs to be listed.None
additional_metadatadict[str, str] | NoneAdditional metadata for filtering the runs.None
worker_idstr | NoneThe ID of the worker that ran the tasks.None
parent_task_external_idstr | NoneThe external ID of the parent task.None
only_tasksboolWhether to list only task runs.False
triggering_event_external_idstr | NoneThe event id that triggered the task run.None

Returns:

TypeDescription
list[V1TaskSummary]A list of V1TaskSummary objects representing the runs of the workflow.

create_filter

Create a new filter.

Parameters:

NameTypeDescriptionDefault
expressionstrThe expression to evaluate for the filter.required
scopestrThe scope for the filter.required
payloadJSONSerializableMapping | NoneThe payload to send with the filter.None

Returns:

TypeDescription
V1FilterThe created filter.

aio_create_filter

Create a new filter.

Parameters:

NameTypeDescriptionDefault
expressionstrThe expression to evaluate for the filter.required
scopestrThe scope for the filter.required
payloadJSONSerializableMapping | NoneThe payload to send with the filter.None

Returns:

TypeDescription
V1FilterThe created filter.

Standalone

Bases: BaseWorkflow[TWorkflowInput], Generic[TWorkflowInput, R]

Methods:

NameDescription
runRun the workflow synchronously and wait for it to complete.
aio_runRun the workflow asynchronously and wait for it to complete.
run_no_waitTrigger a workflow run without waiting for it to complete.
aio_run_no_waitAsynchronously trigger a workflow run without waiting for it to complete.
run_manyRun a workflow in bulk and wait for all runs to complete.
aio_run_manyRun a workflow in bulk and wait for all runs to complete.
run_many_no_waitRun a workflow in bulk without waiting for all runs to complete.
aio_run_many_no_waitRun a workflow in bulk without waiting for all runs to complete.
scheduleSchedule a workflow to run at a specific time.
aio_scheduleSchedule a workflow to run at a specific time.
create_cronCreate a cron job for the workflow.
aio_create_cronCreate a cron job for the workflow.
create_bulk_run_itemCreate a bulk run item for the workflow. This is intended to be used in conjunction with the various run_many methods.
list_runsList runs of the workflow.
aio_list_runsList runs of the workflow.
create_filterCreate a new filter.
aio_create_filterCreate a new filter.

Functions

run

Run the workflow synchronously and wait for it to complete.

This method triggers a workflow run, blocks until completion, and returns the extracted result.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution.TriggerWorkflowOptions()

Returns:

TypeDescription
RThe extracted result of the workflow execution.

aio_run

Run the workflow asynchronously and wait for it to complete.

This method triggers a workflow run, awaits until completion, and returns the extracted result.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow, must match the workflow’s input type.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution like metadata and parent workflow ID.TriggerWorkflowOptions()

Returns:

TypeDescription
RThe extracted result of the workflow execution.

run_no_wait

Trigger a workflow run without waiting for it to complete.

This method triggers a workflow run and immediately returns a reference to the run without blocking while the workflow runs.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow, must match the workflow’s input type.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution like metadata and parent workflow ID.TriggerWorkflowOptions()

Returns:

TypeDescription
TaskRunRef[TWorkflowInput, R]A TaskRunRef object representing the reference to the workflow run.

aio_run_no_wait

Asynchronously trigger a workflow run without waiting for it to complete. This method is useful for starting a workflow run and immediately returning a reference to the run without blocking while the workflow runs.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsTriggerWorkflowOptionsAdditional options for workflow execution.TriggerWorkflowOptions()

Returns:

TypeDescription
TaskRunRef[TWorkflowInput, R]A TaskRunRef object representing the reference to the workflow run.

run_many

Run a workflow in bulk and wait for all runs to complete. This method triggers multiple workflow runs, blocks until all of them complete, and returns the final results.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[R]A list of results for each workflow run.

aio_run_many

Run a workflow in bulk and wait for all runs to complete. This method triggers multiple workflow runs, blocks until all of them complete, and returns the final results.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[R]A list of results for each workflow run.

run_many_no_wait

Run a workflow in bulk without waiting for all runs to complete.

This method triggers multiple workflow runs and immediately returns a list of references to the runs without blocking while the workflows run.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[TaskRunRef[TWorkflowInput, R]]A list of WorkflowRunRef objects, each representing a reference to a workflow run.

aio_run_many_no_wait

Run a workflow in bulk without waiting for all runs to complete.

This method triggers multiple workflow runs and immediately returns a list of references to the runs without blocking while the workflows run.

Parameters:

NameTypeDescriptionDefault
workflowslist[WorkflowRunTriggerConfig]A list of WorkflowRunTriggerConfig objects, each representing a workflow run to be triggered.required

Returns:

TypeDescription
list[TaskRunRef[TWorkflowInput, R]]A list of WorkflowRunRef objects, each representing a reference to a workflow run.

schedule

Schedule a workflow to run at a specific time.

Parameters:

NameTypeDescriptionDefault
run_atdatetimeThe time at which to schedule the workflow.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsScheduleTriggerWorkflowOptionsAdditional options for workflow execution.ScheduleTriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowVersionA WorkflowVersion object representing the scheduled workflow.

aio_schedule

Schedule a workflow to run at a specific time.

Parameters:

NameTypeDescriptionDefault
run_atdatetimeThe time at which to schedule the workflow.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
optionsScheduleTriggerWorkflowOptionsAdditional options for workflow execution.ScheduleTriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowVersionA WorkflowVersion object representing the scheduled workflow.

create_cron

Create a cron job for the workflow.

Parameters:

NameTypeDescriptionDefault
cron_namestrThe name of the cron job.required
expressionstrThe cron expression that defines the schedule for the cron job.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
additional_metadataJSONSerializableMapping | NoneAdditional metadata for the cron job.None
priorityint | NoneThe priority of the cron job. Must be between 1 and 3, inclusive.None

Returns:

TypeDescription
CronWorkflowsA CronWorkflows object representing the created cron job.

aio_create_cron

Create a cron job for the workflow.

Parameters:

NameTypeDescriptionDefault
cron_namestrThe name of the cron job.required
expressionstrThe cron expression that defines the schedule for the cron job.required
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
additional_metadataJSONSerializableMapping | NoneAdditional metadata for the cron job.None
priorityint | NoneThe priority of the cron job. Must be between 1 and 3, inclusive.None

Returns:

TypeDescription
CronWorkflowsA CronWorkflows object representing the created cron job.

create_bulk_run_item

Create a bulk run item for the workflow. This is intended to be used in conjunction with the various run_many methods.

Parameters:

NameTypeDescriptionDefault
inputTWorkflowInputThe input data for the workflow.cast(TWorkflowInput, EmptyModel())
keystr | NoneThe key for the workflow run. This is used to identify the run in the bulk operation and for deduplication.None
optionsTriggerWorkflowOptionsAdditional options for the workflow run.TriggerWorkflowOptions()

Returns:

TypeDescription
WorkflowRunTriggerConfigA WorkflowRunTriggerConfig object that can be used to trigger the workflow run, which you then pass into the run_many methods.

list_runs

List runs of the workflow.

Parameters:

NameTypeDescriptionDefault
sincedatetime | NoneThe start time for the runs to be listed.None
untildatetime | NoneThe end time for the runs to be listed.None
limitintThe maximum number of runs to be listed.100
offsetint | NoneThe offset for pagination.None
statuseslist[V1TaskStatus] | NoneThe statuses of the runs to be listed.None
additional_metadatadict[str, str] | NoneAdditional metadata for filtering the runs.None
worker_idstr | NoneThe ID of the worker that ran the tasks.None
parent_task_external_idstr | NoneThe external ID of the parent task.None
only_tasksboolWhether to list only task runs.False
triggering_event_external_idstr | NoneThe event id that triggered the task run.None

Returns:

TypeDescription
list[V1TaskSummary]A list of V1TaskSummary objects representing the runs of the workflow.

aio_list_runs

List runs of the workflow.

Parameters:

NameTypeDescriptionDefault
sincedatetime | NoneThe start time for the runs to be listed.None
untildatetime | NoneThe end time for the runs to be listed.None
limitintThe maximum number of runs to be listed.100
offsetint | NoneThe offset for pagination.None
statuseslist[V1TaskStatus] | NoneThe statuses of the runs to be listed.None
additional_metadatadict[str, str] | NoneAdditional metadata for filtering the runs.None
worker_idstr | NoneThe ID of the worker that ran the tasks.None
parent_task_external_idstr | NoneThe external ID of the parent task.None
only_tasksboolWhether to list only task runs.False
triggering_event_external_idstr | NoneThe event id that triggered the task run.None

Returns:

TypeDescription
list[V1TaskSummary]A list of V1TaskSummary objects representing the runs of the workflow.

create_filter

Create a new filter.

Parameters:

NameTypeDescriptionDefault
expressionstrThe expression to evaluate for the filter.required
scopestrThe scope for the filter.required
payloadJSONSerializableMapping | NoneThe payload to send with the filter.None

Returns:

TypeDescription
V1FilterThe created filter.

aio_create_filter

Create a new filter.

Parameters:

NameTypeDescriptionDefault
expressionstrThe expression to evaluate for the filter.required
scopestrThe scope for the filter.required
payloadJSONSerializableMapping | NoneThe payload to send with the filter.None

Returns:

TypeDescription
V1FilterThe created filter.