https://prefect.io logo
Title
s

Suresh R

03/25/2022, 1:12 AM
Hi! can you share graphql example to get the task result of a flow run
k

Kevin Kho

03/25/2022, 1:24 AM
Are you trying to load in or just see the location?
s

Suresh R

03/25/2022, 1:26 AM
We are storing metrics of our tasks as s3Result, We want to call graphql from our Portal and load the result.
k

Kevin Kho

03/25/2022, 1:28 AM
Using the
get_task_run_result
task will be easier. You can just call
get_task_run_result.run(...)
to use the Python under the hood
s

Suresh R

03/25/2022, 1:28 AM
there is no GraphQl API to load the result?
k

Kevin Kho

03/25/2022, 1:30 AM
GraphQL alone will find the result, and then you need to make the Storage for it and then call
Storage().load()
with the location, but this task logic will do it all for you in one call
Otherwise you want something like:
query {
  flow_run(where: {id: {_eq: "bb37bbfd-7fae-4357-8cf2-3d85cd8b1c6f"}}) {
    task_runs{
      state_result
    }
  }
}
and then you get the json, and then figure out how to load it
s

Suresh R

03/25/2022, 1:52 AM
Ok
We are in standard plan, all the flow related info gets expired in 14 days, how we can use our own mechanism to store all flow metadata?
k

Kevin Kho

03/25/2022, 2:56 AM
What do you need from the metadata? Success/Failed for all run sover time? Because normally what people do is they just send all of the logs to something like DataDog
s

Suresh R

03/25/2022, 6:12 AM
Flow run status, task status, result state
k

Kevin Kho

03/25/2022, 1:37 PM
Yeah I think you need to use the GraphQL API and run a batch job to get those