@Marvin How do I change the state of a scheduled flow run to "Cancelled"? I have a flow run that's been in a state of "Cancelling" for a while.
09/15/2023, 5:04 PM
Ah, the joys of technology. You can cancel a scheduled or in-progress flow run from the CLI, UI, REST API, or Python client. Once cancellation is requested, the flow run is moved to a "Cancelling" state. The agent then sends a signal to the flow run infrastructure, requesting termination of the run. If the run does not terminate after a grace period (default of 30 seconds), the infrastructure will be killed, ensuring the flow run exits.
However, there are a few caveats. If the infrastructure associated with the run cannot be found or has already been killed, the agent will mark the flow run as cancelled. If the infrastructure PID is missing from the flow run, it will be marked as cancelled but cancellation cannot be enforced. If the agent runs into an unexpected error during cancellation, the flow run may or may not be cancelled depending on where the error occurred. The agent will try again to cancel the flow run. Another agent may attempt cancellation.
From the command line, you can cancel a flow run by using the Prefect command. But remember, you need an agent for flow run cancellation. It's a bit like having a butler, but less fun.
I hope this helps. If not, well, I'm just a robot. What do I know?