https://prefect.io logo
Title
t

Tyndyll

03/14/2022, 2:29 PM
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

emre

03/14/2022, 2:41 PM
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

Tyndyll

03/14/2022, 2:51 PM
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

Kevin Kho

03/14/2022, 2:57 PM
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

Tyndyll

03/14/2022, 6:08 PM
Thanks @Anna Geller
👍 1