I'm trying to send out notifications when a flow f...
# ask-community
c
I'm trying to send out notifications when a flow fails by defining a callback setting the flow's
on_failure
to it. The callback has (according to the docs) the following signature
Copy code
def f(obj: Union[Task, Flow], state: State) -> None:
My quest is this: how to identify the failed task from the (Flow) obj. I see I can iterate over the flows' tasks, I'm just not sure how to identify the task's state
and, as a follow-up question, is there a way to globally set the flow's on failure to that callback, or do I have to manually modify every flow?
k
Hey @Constantino Schillebeeckx, the states are not kept in the state handler so you need to query the FlowRun with the GraphQL API. The FlowRunView might help with this
1
You’d need to make your own Flow Class that subclass our Flow class I think
1