Luca Schneider
09/15/2021, 6:34 PMquery GetLatest {
project(where: {name: {_eq: "project-test"}}) {
flows(
where: {name: {_eq: "flow-test"}, archived: {_eq: false}}
order_by: {version: desc}
limit: 1
) {
id
}
}
}
mutation TriggerLatest {
create_flow_run(input: {flow_id: "xxx"}) {
id
}
}
Kevin Kho
StartFlowRun
task and create_flow_run
task that do these for you here. You can also check the source here to see how it does it. These tasks will be easier than using the graphQL api in pythonLuca Schneider
09/15/2021, 7:30 PMLuca Schneider
09/15/2021, 7:31 PMLuca Schneider
09/15/2021, 7:36 PMKevin Kho
Kevin Kho
query = """query {flow{ name, id}}"""
url = '<https://api.prefect.io>'
r = <http://requests.post|requests.post>(url, json={'query': query}, headers={"authorization": "Bearer MY_TOKEN_HERE"})
print(r.status_code)
print(r.text)
Luca Schneider
09/15/2021, 7:47 PMKevin Kho
Luca Schneider
09/15/2021, 7:48 PM