Is there any way to get the name/id/etc. of the ta...
# ask-community
s
Is there any way to get the name/id/etc. of the task that failed in a flow? Idea being to be able to put in a slack message which task in the flow failed.
j
Where are you trying to get it from? The API? The actual python code in the flow?
s
Using Prefect Automations
j
That is a very good question. I wonder if you could get it out of the state attribute. Hopefully someone else has an actual answer
s
Okay, yeah would be a nice treat to see which task failed 😄
I’ll look into state
Poked around some - most likely candidate seems to be
task_run_results
via your docs - but i’m not sure how i’d pull the task name from that. locally testing, and i’m not sure how to get a failed task and also get metadata from
get_run_context