And for my next question - is there a way to use t...
# prefect-community
d
And for my next question - is there a way to use the graphql API to stop/kill a flow run with a flow_id? I can see an update_state mutation, it’s just unclear whether that actually stops it..
j
We're actually working on supporting cancelling running flows right now, see https://github.com/PrefectHQ/prefect/issues/2771
Currently you can cancel a flow run that hasn't started yet, but not a flow that's already running. See: https://github.com/PrefectHQ/prefect/issues/2766
d
HAHA you’ve linked me to a github issue that was opened from one of my own previous questions 😂 😂
😆 1
So can I even change state on a running flow? That might be enough for now…
That’ll teach me to read over my pervious comments 🙂
j
You can change state of a running flow, and future tasks will not be run, but current tasks won't be stopped. That's on the todo list.
d
That will do perfectly, I just need to know the magic words - it’s non obvious to me from looking at the API…
j
I'm not 100% sure, but I believe that
client.set_flow_run_state
is the method you want. @josh might know more here.
j
Yep
set_flow_run_state
would be the client function you want to update the state of the flow run 👍
d
Great, thanks guys, digging into it now
set_flow_run_state
takes a version parameter, is it required?
More accurately, do I need to know the version or can I supply something like “CURRENT” to kill the current version of the flow?
j
I believe it's required, but I'm not sure what it should be here. cc @josh?
j
You can pass any integer into that for the version if using server (which bypasses the verison locking feature that’s used for Cloud)
I have an open PR in which part of it actually makes that kwarg optional so that will change soon 🙂
upvote 2
d
Guys i have to hand it to you - you’re the single most responsive community I’ve ever dealt with. Any question I ask either has a fix or a PR in minutes, its amazing!!
🎉 6
j
Good user questions help make things better for everyone, we wouldn't be where we are without the supportive community :)