To update an existing task concurrency limit, you can use the Prefect Python client. Here's an example of how to set a new concurrency limit for a tag:
python
from prefect.client import get_client
async with get_client() as client:
# set a new concurrency limit on the 'small_instance' tag
limit_id = await client.create_concurrency_limit(
tag="small_instance",
concurrency_limit=10
)
To remove all concurrency limits on a tag, you can use `PrefectClient.delete_concurrency_limit_by_tag`:
python
async with get_client() as client:
# remove a concurrency limit on the 'small_instance' tag
await client.delete_concurrency_limit_by_tag(tag="small_instance")
If you want to query the currently set limit on a tag, use `PrefectClient.read_concurrency_limit`:
python
async with get_client() as client:
# read the concurrency limit on the 'small_instance' tag
limit = await client.read_concurrency_limit(tag="small_instance")
For more information, you can refer to the [Prefect documentation on tasks](
https://docs.prefect.io/latest/concepts/tasks/) and the [Task Run Concurrency page](
https://docs.prefect.io/latest/ui/task-concurrency/).