Hi everybody! Just started recently using Prefect ...
# ask-community
r
Hi everybody! Just started recently using Prefect and it looks great! I have a simple question which I am finding hard to find the solution. If I have a flow with a schedule, say every minute, what is the proper way to stop that flow to run and all the following runs? Maybe using states?
1
b
Hello Ruggiero, here's a helpful article for cancelling several flow runs https://discourse.prefect.io/t/how-can-i-cancel-several-submitted-flow-runs-at-once/751
r
Hi Bianca, I am not sure this solves my issue. I'd like Prefect to automatically stop running the schedule of the flow once a certain exception happen without manual intervention
b
Ah, thank you for clarifying. You should be able to use states to handle that. Are you using 1.0 or 2.0?
r
1.0
Is there any documentation or post on how to stop subsequent runs of a flow with a IntervalSchedule in a state handler?
The thing is that as far as I understand a state is a property of a run not of the flow. So I am not sure how to stop all the subsequent runs of a flow with a schedule using states. Maybe there is another way?
j
Hi @Ruggiero Dargenio so i believe what you are asking for is a cancellation of a schedule given that a flow fails? You should be able to achieve this with automations https://docs-v1.prefect.io/orchestration/concepts/automations.html#events-reference
minor correction- the automation will allow you to pause a schedule
r
Hi James thank you, this at first glance is what I was looking at. Is there a way also to do it with core or is only a Cloud feature? At the moment I was experimenting locally
j
It would be a feature only available on cloud. I'm not sure if there is an alternate way to do this locally