Also, I was able to run a flow successfully. Happe...
# prefect-community
c
Also, I was able to run a flow successfully. Happen to know how to issue pause/resume queries in GraphQL for a flow run?
j
Pause/resume is set at the task run level. You could use the
set_task_run_states
mutation for the task run that your
manual_only
trigger is set
c
Thanks @Jenny! So I actually just found something called cancel_flow_run. That seems to do the trick of cancelling instead of explicitly meddling with the task run states. Would that be ok or is setting task run state preferred over this? Also, if tasks state is set while running say to Pause (if there is such a thing), can I set it back to continue running where it left off? Now I have to figure out how to run it from where it left off after I cancelled the flow run.
mutation {
cancel_flow_run(input: {flow_run_id: "931dfcf9-595c-4146-bc67-52cd95731c5d"}) {
state
}
}
j
Pause is really designed to be a trigger that stops a task run from running until it is approved/entered into a Resume state. You can read a bit more about it (and how to set the trigger) here: https://medium.com/the-prefect-blog/needs-approval-184f2512a3cf
Although in theory you could use the set_task_run_states mutation to set the task run into a paused state I think you could run into unintended consequences and timing issues.
The cancel_flow_run mutation is intended for cancelling a flow run mid run so sounds like it may be a better fit for you.
You can also use the cancel button in the UI. (And maybe check-out the restart button if you want to get the flow running again.)
c
so unfortunately after cancel, restart does not seem to work because it says restart is only for failed tasks (not cancelled). What I tried is changing the state of flow_run to scheduled. but that seems to run even the previously succeeded tasks in flow_run again which is odd.
j
Ah yes you're right about the restart button. If being able to restart is something that is valuable to you, please feel free to open an issue for that in the UI repo.
c
Got it. Thanks