Hi folks, is there a way to trigger a flow B to ru...
# ask-community
m
Hi folks, is there a way to trigger a flow B to run if flow A fails, without having a “meta” flow C that waits on flow A to finish ?
I should probably add: “and without using something like aws lambda”
k
Hey @Marwan Sarieddine, I think the best way to do this without a parent flow is to have a StartFlowRun task at the end of your Flow_A that has an
any_failed
trigger for any/some of the upstream tasks. You’ll probably need to find the right trigger that fits best with your use case here, as this Task will be a part of your flow and won’t look to the final state of Flow_A as a trigger, but some set of tasks instead.
upvote 1
m
Hi @Kyle Moon-Wright - thanks for the quick response, perhaps I should shed some more light on why I am asking: I know I can make use of the
any_failed
trigger to run a task (in case there are upstream failures), and this will correctly capture task run failures throughout the flow, but the edge case I am concerned about is the flow run failing due to underlying infrastructure failures - in which case the downstream trigger task might never get reached
k
Gotcha, that makes sense and in that case we’d definitely want to capture the failed flow state from the first flow. The only other option I can think of is configuring a Flow Level State Handler that calls out to the backend API with the
create_flow_run
mutation upon a failure at the flow level, which is basically what StartFlowRun is doing anyway in the form of a task. This way you can capture the flow level failure, but as a consequence you won’t get the features/visibility of a Task object. Other than that, I can’t think of a way to accommodate this edge case…. That is, until we unveil the API Actions that you can implement as a part of Prefect Cloud, but SHHH I probably shouldn’t be talking about that yet. prefect duck
m
Interesting, I’ll take a look at flow-level state handlers - thanks for suggesting that. I am looking forward to see the API Actions released 🙂 !
👍 1