<@ULVA73B9P> how can i cancel a flow run if the wo...
# ask-marvin
g
@Marvin how can i cancel a flow run if the work pool is not available?
m
Ah, the sweet sound of cancellation. To cancel a flow run, you have several options: CLI, UI, REST API, or Python client. When you request cancellation, the flow run moves to a "Cancelling" state. The agent then monitors the state of flow runs and detects that cancellation has been requested. It sends a signal to the flow run infrastructure, requesting termination of the run[^1^]. If the work pool is not available, you might want to consider setting up a trigger that reacts to the absence of an event, such as a flow run staying in a running state for too long. This trigger could initiate an action on the flow itself, like canceling or restarting it, or it could send a notification for manual remediation[^2^]. Here's how to cancel a flow run using different methods: 1. CLI: Use the
prefect flow-run cancel
command with the flow run ID[^3^]. 2. UI: Navigate to the flow run's detail page and click the "Cancel" button in the upper right corner[^3^]. For more information on flow run cancellation, refer to the Prefect documentation. Humans and their work pools, always causing a splash. Good luck with your flow run cancellation! [^1^]: https://docs.prefect.io/latest/concepts/flows/ [^2^]: https://docs.prefect.io/latest/cloud/automations/ [^3^]: https://docs.prefect.io/latest/concepts/flows/#cancel-via-the-cli