Vaikath Job
04/11/2022, 11:09 PMKevin Kho
04/11/2022, 11:09 PMVaikath Job
04/11/2022, 11:38 PMclient = prefect.Client()
query = """
#Get latest flow run by flow name, project name combination, and parameters
#params is a JSON object and the query does a contains check
query($flow_name: String!, $project_name: String!, $params: jsonb!){
flow_run(
where: {
flow: {
name: {_eq: $flow_name}
project: {
name: {_eq: $project_name}
}
}
state: {_eq: "Success"},
parameters: {_contains: $params}
}
order_by : {end_time: desc}
limit : 1
){
id
version
end_time
name
state
task_runs {
id
state
task {
id
name
}
}
parameters
}
}
"""
variables = {"flow_name": flow_name, "project_name": project_name, "params": params}
flow_run_query = client.graphql(query=query, variables=variables)
Anna Geller
04/11/2022, 11:56 PM