Hi everyone, I have a question about how to correctly search for flows/tasks in a given state using the API. What I’d like to do is search for all flow runs that have finished. If I use
flow_run(where: {state: {_eq: "Finished"}})
that returns nothing, I think because it is using string matching. Is the set of strings that can appear in
state
listed somewhere? Thank you!
k
Kevin Kho
02/28/2022, 6:06 PM
Maybe you can do:
Copy code
query {
flow_run(where: {state: {_in: ["Success","Failed"]}}) {
id
}
}
to get the Finished states?
upvote 2
a
Anna Geller
02/28/2022, 6:07 PM
or even all three
Copy code
{
flow_run(
where: {state: {_in: ["Failed", "Success", "Finished"]}}
order_by: {state_timestamp: desc}
limit: 5
) {
name
start_time
end_time
version
agent {
type
}
}
}
d
Daniel Komisar
02/28/2022, 6:08 PM
There are more states than just that though. What about
Cancelled
? You’d need a list of all the possible states.
k
Kevin Kho
02/28/2022, 6:14 PM
Looking where we can find this
d
Daniel Komisar
02/28/2022, 6:15 PM
I would think there was some way of doing this through the API, since this means that if you add new states here it could break code written as you suggest.
k
Kevin Kho
02/28/2022, 6:30 PM
As far as I can tell the state is not a strict Enum. The state Python object gets converted to JSON and contains the info for the UI to load it appropriately. For example, there is a color in the Python class here .
The best exhaustive list would be what the UI renders here
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.