Team, let's say I had a flow deployed to run every...
# ask-community
m
Team, let's say I had a flow deployed to run every 30 mins. If for whatever reason, my flow run took more than 30 mins, I want the next scheduled flow run to not run. What's the best way to do this in Prefect?
b
Hey Moe! Does it have to be scheduled flow? It sounds like an event-based pattern may help you out here. For example, after a flow run completes, it kicks off another flow run.
m
Hi Bianca, yeah it has to be a scheduled flow run. I want the next scheduled flow run(s) to not execute until the currently running flow is completed.
b
Hmm. Off the top of my head, you could potentially temporarily pause the schedule for your deployed flow whenever it's in flight, and then after it completes, re-enable the schedule
Or, alternatively, you could set a concurrency limit of 1 on the work pool or work queue which your flow runs are submitted to
That way, if a flow run is actively running, other scheduled flow runs will be delayed until the active process completes (the only caveat I see with this is that the delayed flows will enter a status of
Late
)
m
Hi, thank you for your advice. Is there a way to limit the concurrency to 1 just for the particular flow? I do need other workers to execute other flows running on same workpool.
@Bianca Hoch Hi! This is me just saying hello
b
Hi Moe! 👋 😄
I see you posted a question that I missed, my apologies.
Hmmm, maybe you can submit the flow to its own work queue within the greater work pool, and apply a concurrency limit of 1 to just that queue.
That way, flows can be submitted to other queues without being subject to the same concurrency limit
m
Hi Bianca, thank you so much.