https://prefect.io logo
Title
d

Dileep Damodaran

05/27/2022, 5:07 AM
Hi, I have been working with the prefect flows terminal state handler. From the terminal atate handler, Its possible to get only the state of every related tasks , but unable to identity the corresponding task details including task name. Is it possible to get all the reference tasks and its corresponding states to prepare a detailed summary of the flow run.
k

Kevin Kho

05/27/2022, 1:35 PM
Not quite. So this works in Prefect Core because the results are held when running locally. But the results are not held when you run in Cloud because they can be very big and it’s not performant to hold them. Because of that, you need to query for the specific task states using the GraphQL API. I actually think the easier thing to do is to attach a state handler on the terminal tasks themselves to notify you if they fail. You can also have a reporting task with a
trigger
always_run
that takes in your terminal tasks and checks if they suceeded or not
d

Dileep Damodaran

05/30/2022, 4:23 AM
Thank you so much for your suggession@Kevin Kho My requirement is to summarise the flow run with all the reference task summary(state , start time and endtime). So I think prefect GraphQL approach should work well here. But for that I need the flow run id. How do we get that from the Flow object inside terminal_state_handler? Thanks in advance!
k

Kevin Kho

05/30/2022, 4:25 AM
prefect.context.get("flow_run_id")