William Grim
10/21/2021, 5:14 AMprefect
CLI tool to do things like check which flows are running and see their logs.
If a flow is running and I want to cancel it, how could I do this? There doesn't seem to be a command, and I'm assuming I need to do it with graphql. Is there an example of how to do this anyway?
I appreciate it in advance.Kevin Kho
William Grim
10/21/2021, 5:19 AMKevin 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)
But the Client is already authenticated for you. I think you’re thinking of just cURL directly? I think it might work.William Grim
10/21/2021, 5:21 AMWilliam Grim
10/21/2021, 5:21 AMWilliam Grim
10/21/2021, 5:21 AMKevin Kho
William Grim
10/21/2021, 6:32 AMfrom prefect.client import Client
client = Client("<https://myurlhere>:myport")
client.cancel_flow_run("my_uuid_here")
William Grim
10/21/2021, 6:32 AMKevin Kho