Hi, I've what is probably a fairly basic question,...
# prefect-community
t
Hi, I've what is probably a fairly basic question, but I can't find the right sequence of words to get an answer in the docs. Say I have a flow that takes 23 hours to run, and I kick it off at Midnight each night. Is it possible to block today's run if yesterdays is still running?
e
https://docs.prefect.io/orchestration/flow-runs/concurrency-limits.html#flow-run-limits This probably achieves what you want, but sadly is a cloud only feature. Otherwise, you can add an initial task to query the prefect server api, and check if a flow from the previous day is stil running, and
ENDRUN
if you want to block.
t
That works perfectly. In my initial reading I'd assumed that it was more to do with limiting the number of flows on an agent, rather than limiting the number of instances of a flow. Had forgotten that labels can be used in lots of places. Thanks for the clarification
k
There is a code snippet here to limit flow run concurrency by querying like that emre is suggesting if you are not on a paid tier of Cloud
💯 1
t
Thanks @Anna Geller
👍 1