APIs & SDK
- Overview
- Python SDK Overview
- REST API
- REST API overview
- Cloud API
- Server API
- Server API Overview
- Root
- Flows
- Flow Runs
- Task Runs
- Flow Run States
- Task Run States
- Flow Run Notification Policies
- Deployments
- SavedSearches
- Logs
- Concurrency Limits
- Concurrency Limits V2
- Block types
- Block documents
- Work Pools
- Task Workers
- Work Queues
- Artifacts
- Block schemas
- Block capabilities
- Collections
- Variables
- GETCreate Csrf Token
- Events
- Automations
- UI
- Admin
- CLI Reference
Read Task Runs
Query for task runs.
[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"name": "my-task-run",
"flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_key": "<string>",
"dynamic_key": "<string>",
"cache_key": "<string>",
"cache_expiration": "2023-11-07T05:31:56Z",
"task_version": "<string>",
"empirical_policy": {
"max_retries": 0,
"retry_delay_seconds": 0,
"retries": 123,
"retry_delay": 123,
"retry_jitter_factor": 123
},
"tags": [
"tag-1",
"tag-2"
],
"labels": {
"key": "value1",
"key2": 42
},
"state_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_inputs": {},
"state_type": "SCHEDULED",
"state_name": "<string>",
"run_count": 0,
"flow_run_run_count": 0,
"expected_start_time": "2023-11-07T05:31:56Z",
"next_scheduled_start_time": "2023-11-07T05:31:56Z",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"total_run_time": 0,
"estimated_run_time": 0,
"estimated_start_time_delta": 0,
"state": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "SCHEDULED",
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Run started",
"data": "<any>",
"state_details": {
"flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"child_flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduled_time": "2023-11-07T05:31:56Z",
"cache_key": "<string>",
"cache_expiration": "2023-11-07T05:31:56Z",
"deferred": true,
"untrackable_result": false,
"pause_timeout": "2023-11-07T05:31:56Z",
"pause_reschedule": false,
"pause_key": "<string>",
"run_input_keyset": {},
"refresh_cache": true,
"retriable": true,
"transition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_parameters_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"traceparent": "<string>"
}
}
}
]
Headers
Body
Defines task run sorting options.
ID_DESC
, EXPECTED_START_TIME_ASC
, EXPECTED_START_TIME_DESC
, NAME_ASC
, NAME_DESC
, NEXT_SCHEDULED_START_TIME_ASC
, END_TIME_DESC
x > 0
Filter for flows. Only flows matching all criteria will be returned.
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for Flow.id
A list of flow ids to include
Filter criteria for Flow.tags
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of tags. Flows will be returned only if their tags are a superset of the list
If true, only include flows without tags
Filter flow runs. Only flow runs matching all criteria will be returned
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for FlowRun.tags
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of tags. Flow runs will be returned only if their tags are a superset of the list
A list of tags to include
If true, only include flow runs without tags
Filter criteria for FlowRun.deployment_id
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of flow run deployment ids to include
If true, only include flow runs without deployment ids
Filter criteria for `FlowRun.work_queue_name
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of work queue names to include
If true, only include flow runs without work queue names
Filter criteria for FlowRun.state
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for FlowRun.state_type
A list of flow run state types to include
SCHEDULED
, PENDING
, RUNNING
, COMPLETED
, FAILED
, CANCELLED
, CRASHED
, PAUSED
, CANCELLING
A list of flow run state types to exclude
SCHEDULED
, PENDING
, RUNNING
, COMPLETED
, FAILED
, CANCELLED
, CRASHED
, PAUSED
, CANCELLING
Filter criteria for FlowRun.flow_version
A list of flow run flow_versions to include
Filter criteria for FlowRun.start_time
Filter criteria for FlowRun.end_time
Filter criteria for FlowRun.next_scheduled_start_time
Filter criteria for FlowRun.parent_task_run_id
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of flow run parent_task_run_ids to include
If true, only include flow runs without parent_task_run_id
Filter task runs. Only task runs matching all criteria will be returned
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for TaskRun.id
A list of task run ids to include
Filter criteria for TaskRun.tags
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of tags. Task runs will be returned only if their tags are a superset of the list
If true, only include task runs without tags
Filter criteria for TaskRun.state
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for TaskRun.state_type
A list of task run state types to include
SCHEDULED
, PENDING
, RUNNING
, COMPLETED
, FAILED
, CANCELLED
, CRASHED
, PAUSED
, CANCELLING
Filter criteria for TaskRun.start_time
Filter criteria for TaskRun.subflow_run
If true, only include task runs that are subflow run parents; if false, exclude parent task runs
Filter criteria for TaskRun.flow_run_id
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of task run flow run ids to include
Filter for task runs with None as their flow run id
Filter for deployments. Only deployments matching all criteria will be returned.
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
Filter criteria for Deployment.id
A list of deployment ids to include
Filter criteria for Deployment.name
or Flow.name
A case-insensitive partial match on deployment or flow names. For example, passing 'example' might match deployments or flows with 'example' in their names.
Filter criteria for Deployment.paused
Only returns where deployment is/is not paused
Filter criteria for Deployment.tags
Operator for combining filter criteria. Defaults to 'and_'.
and_
, or_
A list of tags. Deployments will be returned only if their tags are a superset of the list
A list of tags to include
If true, only include deployments without tags
Filter criteria for Deployment.work_queue_name
A list of work queue names to include
DEPRECATED: Prefer Deployment.concurrency_limit_id
over Deployment.concurrency_limit
. If provided, will be ignored for backwards-compatibility. Will be removed after December 2024.
Only include deployments with a concurrency limit greater than or equal to this value
Only include deployments with a concurrency limit less than or equal to this value
If true, only include deployments without a concurrency limit
Defaults to PREFECT_API_DEFAULT_LIMIT if not provided.
Response
A unique identifier for the task being run.
A dynamic key used to differentiate between multiple runs of the same task within the same flow run.
The flow run id of the task run.
An optional cache key. If a COMPLETED state associated with this cache key is found, the cached COMPLETED state will be used instead of executing the task run.
Specifies when the cached state should expire.
The version of the task being run.
Defines of how a task run should retry.
The maximum number of retries. Field is not used. Please use retries
instead.
The delay between retries. Field is not used. Please use retry_delay
instead.
The number of retries.
A delay time or list of delay times between retries, in seconds.
Determines the amount a retry should jitter
A list of tags for the task run.
A dictionary of key-value labels. Values can be strings, numbers, or booleans.
The id of the current task run state.
The type of the current task run state.
SCHEDULED
, PENDING
, RUNNING
, COMPLETED
, FAILED
, CANCELLED
, CRASHED
, PAUSED
, CANCELLING
The name of the current task run state.
The number of times the task run has been executed.
If the parent flow has retried, this indicates the flow retry this run is associated with.
The task run's expected start time.
The next time the task run is scheduled to start.
The actual start time.
The actual end time.
Total run time. If the task run was executed multiple times, the time of each run will be summed.
A real-time estimate of total run time.
The difference between actual and expected start time.
The current task run state.
Enumeration of state types.
SCHEDULED
, PENDING
, RUNNING
, COMPLETED
, FAILED
, CANCELLED
, CRASHED
, PAUSED
, CANCELLING
Data associated with the state, e.g. a result. Content must be storable as JSON.
Was this page helpful?
[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"name": "my-task-run",
"flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_key": "<string>",
"dynamic_key": "<string>",
"cache_key": "<string>",
"cache_expiration": "2023-11-07T05:31:56Z",
"task_version": "<string>",
"empirical_policy": {
"max_retries": 0,
"retry_delay_seconds": 0,
"retries": 123,
"retry_delay": 123,
"retry_jitter_factor": 123
},
"tags": [
"tag-1",
"tag-2"
],
"labels": {
"key": "value1",
"key2": 42
},
"state_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_inputs": {},
"state_type": "SCHEDULED",
"state_name": "<string>",
"run_count": 0,
"flow_run_run_count": 0,
"expected_start_time": "2023-11-07T05:31:56Z",
"next_scheduled_start_time": "2023-11-07T05:31:56Z",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"total_run_time": 0,
"estimated_run_time": 0,
"estimated_start_time_delta": 0,
"state": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "SCHEDULED",
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Run started",
"data": "<any>",
"state_details": {
"flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"child_flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduled_time": "2023-11-07T05:31:56Z",
"cache_key": "<string>",
"cache_expiration": "2023-11-07T05:31:56Z",
"deferred": true,
"untrackable_result": false,
"pause_timeout": "2023-11-07T05:31:56Z",
"pause_reschedule": false,
"pause_key": "<string>",
"run_input_keyset": {},
"refresh_cache": true,
"retriable": true,
"transition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_parameters_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"traceparent": "<string>"
}
}
}
]