Hello guys! I am trying to execute a function on f...
# ask-community
j
Hello guys! I am trying to execute a function on failure for a flow run but the arguments which admit are just flow, flow_run, state I want to know the task name which fails and also the message value but I don't know how access to it.
Copy code
on_failure=[function_to_execute]

def function_to_execute(flow, flow_run, state):
   #get task name an error
I am using prefect 2.10.10 version
1
d
https://github.com/PrefectHQ/prefect/blob/bffb8d1ebe735f2a631fe8e884ce175b1bb3280a/src/prefect/client/orchestration.py#L1890 You can use Prefect Client and query for task_runs that failed filtered on flow_run_id provided in flow_run.
🙌 1