Running state for tasks with a given tag.
If a task has multiple tags, it will run only if all tags have available concurrency.
Tags without explicit limits are considered to have unlimited concurrency.
0 concurrency limit aborts task runsIf the concurrency limit is set to 0 for a tag, any attempt to run a task with that tag will abort instead of delay.
Execution behavior
Task tag limits are checked whenever a task run attempts to enter aRunning state.
If there are no concurrency slots available for any one of your task’s tags, it delays the transition to a Running state
and instructs the client to try entering a Running state again in 30 seconds
(or the value specified by the PREFECT_TASK_RUN_TAG_CONCURRENCY_SLOT_WAIT_SECONDS setting).
Configure concurrency limits
You can set concurrency limits on as few or as many tags as you wish. You can set limits through:- Prefect CLI
- Prefect API by using
PrefectClientPython client - Prefect server UI or Prefect Cloud
CLI
You can create, list, and remove concurrency limits with Prefect CLIconcurrency-limit commands.
| Command | Description |
|---|---|
| create | Create a concurrency limit by specifying a tag and limit. |
| delete | Delete the concurrency limit set on the specified tag. |
| inspect | View details about a concurrency limit set on the specified tag. |
| ls | View all defined concurrency limits. |
Python client
To update your tag concurrency limits programmatically, usePrefectClient.orchestration.create_concurrency_limit.
create_concurrency_limit takes two arguments:
tagspecifies the task tag on which you’re setting a limit.concurrency_limitspecifies the maximum number of concurrent task runs for that tag.
PrefectClient.delete_concurrency_limit_by_tag, passing the tag:
PrefectClient.read_concurrency_limit_by_tag, passing the tag:
To see all of your limits across all of your tags, use PrefectClient.read_concurrency_limits.