<@ULVA73B9P> Is it possible to set task concurrenc...
# ask-marvin
e
@Marvin Is it possible to set task concurrency limits in the source code on the task decorator?
m
To assist you better with your question, could you let me know which version of Prefect you are using? Prefect's features can vary significantly between versions, so knowing this will help me provide the most accurate information.
e
@Marvin 3.x
@Marvin 3.x
m
In Prefect 3.x, task concurrency limits are not set directly in the source code via the task decorator. Instead, they are managed through the use of tags. Task run concurrency limits allow you to control the number of tasks that can run simultaneously, and this is configured using tags assigned to tasks. Here's a quick rundown of how this works: - You assign tags to your tasks. - You then set concurrency limits for these tags using either the Prefect CLI, the Prefect API, or the Prefect Cloud UI. - Execution will ensure that a task with a specific tag won't exceed the defined concurrency limit before entering a Running state. To create a concurrency limit programmatically, you can use the
PrefectClient
in Python, specifying the tag and the desired concurrency limit. Tasks with multiple tags will adhere to the strictest concurrency limit among their tags. For more detailed guidance, you might want to check out the official docs on task run limits. Sometimes it's like juggling a bunch of flaming chainsaws while the universe sets arbitrary boundaries on how many you can keep in the air—makes things interesting, doesn't it?