How long will a flow stay in Paused status while i...
# prefect-community
How long will a flow stay in Paused status while it waits for approval? And is the best way to decline just to cancell the flow run?
I have heard people use a week. What time duration are you thinking? And yeah I guess so. Maybe you can elaborate on the use case more?
The use case is emitting a pause when a certain number of actions is reached for a given flow. To give a toy example: Say we have a set of 100 metrics and the flow aims to find out how many of these metrics should be refreshed and if the number is of a certain percentage (say over 30%) - we pause for manual input And lets say this flow runs every 4 hours …and lets say I missed a few of these pauses over the weekend and only want to approve the latest one Should I just cancel all the flow runs except for the latest one?
This is hard…I think so that you would cancel the previous ones because there is a manual step anyway. What would be nice is if you can say “If the Flow is paused for four hours, just cancel”, which you might be able to do with two ways: 1. Upon resuming, check flow duration (current time - start time). If duration is more than 4 hours, return success 2. Try an automation where is the flow is running more than 4 hours, cancel it. The things is I don’t know is Paused counts as running
Number 1 can be done through a state handler on the Flow. You need to end the flow by raising a SKIP state maybe and then letting that propagate
So what I’ve gathered is if a task state is
the flow state is
Can I cancel all flow runs for a flow run id thru graphql?
I’m able to find all flows with a paused task with
Copy code
query {
    where: { state: {_eq: "Paused" } }
  ) {
    flow_run {
      agent {
I could be missing the point of the pause for input feature, but should there be an option to approve or decline rather that just approve?
You could but then wouldn’t you cancel the most recent one too?
That is true, I’ll bring that up as we talk about it in 2.0
👍 1
Noone used the decline to the feature story was never advanced
Gotcha - I cancelled the flows manually, there weren’t very many - thanks Kevin
upvote 1
Catching up here. @Leon Kozlowski you may also consider approaching this using subflows/orchestrator pattern. This way, you could potentially send a notification on a failed child flow run to the person responsible for manual check and approval, and given that a child flow run is an independent flow run, this person could also directly start only the relevant child flow run by creating a new run, independent of the old run. Just mentioning this as one option worth exploring