Hello everyone
Quick question, I want to ask please help me out, I am unable to find out. I have a project named ABC in which flow name is let say XYZ now whenever I run my XYZ flow as everyone knows prefect give random names to the runs.
Now I want to get the time at which the latest success run occurred using python. Please help me out. Thanks in advance!
Tushar Gupta
02/22/2023, 4:27 PM
@Joshua Grant Using prefect v1 version 1.2.4
j
Joshua Grant
02/22/2023, 4:29 PM
are you using cloud? deleted my comment because I don't know anything about cloud. If you can access the orion API, you can query there
t
Tushar Gupta
02/22/2023, 4:31 PM
Yes we use cloud to run our flow. Need python code to get latest success flow run
j
Joshua Grant
02/22/2023, 4:40 PM
if you can use the API, you can post this graphql query using requests (you can add some other adjustments to narrow it down, this query gives all the flow runs named "XYZ"):
Copy code
query FlowRuns {
flow_run(where: {flow: {name: {_eq: "XYZ"}}}) {
id
state
flow {
name
}
name
flow_id
parameters
}
}
🙏 1
Joshua Grant
02/22/2023, 4:43 PM
if you have the interactive API available, you can test/adjust the query there to give you exactly what you want and then adjust the python requests payload
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.