Deceivious
04/11/2023, 8:49 AMtask concurrency limit tag
?1
and now I want to update it to 2
.
The only way I see now is to delete the limit tag
and create a new one but if I have loads of tasks waiting for open slot and I do that, during the interval the limit tag
is recreated, the tasks will start executing.Anthony Head
04/11/2023, 4:16 PMpython
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/).Deceivious
04/11/2023, 4:18 PMNate
04/11/2023, 4:40 PMDeceivious
04/11/2023, 4:43 PMNate
04/11/2023, 4:54 PMDeceivious
04/11/2023, 4:54 PMNate
04/11/2023, 4:54 PMDeceivious
04/11/2023, 4:55 PMNate
04/11/2023, 4:55 PMBianca Hoch
04/11/2023, 5:01 PMcreate_concurrency_limit**
currently overwrites the concurrency limit for an existing tag. You just have to pass in the tag's name and the new concurrency limit value.Deceivious
04/11/2023, 5:02 PM