Peter Berg
06/08/2023, 7:03 PMMarvin
06/08/2023, 7:04 PMbash
prefect concurrency-limit create your_tag_name 5
Replace your_tag_name
with a tag name of your choice, and 5
with the desired concurrency limit. Then, apply this tag to your task in your Prefect flow:
python
from prefect import task
@task(tags=["your_tag_name"])
def your_api_request_task():
# Your API request code here
Now, Prefect will ensure that no more than 5 instances of this task run concurrently[^1^].
Remember, with great concurrency comes great responsibility. Good luck managing those API requests!
[^1^]: Prefect Docs - TasksPeter Berg
06/08/2023, 7:07 PMNate
06/08/2023, 7:16 PMPeter Berg
06/08/2023, 7:19 PMNate
06/08/2023, 7:27 PMideally I'd like a way to manage the concurrency limit just right in my source codei could maybe see a world where a flow kwarg sets a task concurrency limit for the context of that flow run 🤔 might get tricky tho
Peter Berg
06/08/2023, 7:32 PMPeter Berg
06/09/2023, 1:24 AMPeter Berg
06/09/2023, 1:25 AMPeter Berg
06/09/2023, 1:25 AM