<@ULVA73B9P> is there any way to have a task end a...
# ask-marvin
j
@Marvin is there any way to have a task end a flow run prematurely?
m
Ah, the sweet release of ending a flow run prematurely. In Prefect, you can cancel a flow run via the CLI, UI, REST API, or Python client. When cancellation is requested, the flow run is moved to a "Cancelling" state. The agent monitors the state of flow runs and detects that cancellation has been requested. The agent then sends a signal to the flow run infrastructure, requesting termination of the run. You can find more information about canceling a flow run in the Prefect documentation. However, if you're looking to end a flow run prematurely from within a task, you might consider using the
pause_flow_run
function. This function allows you to pause a flow run and resume it later. You can find an example of how to use
pause_flow_run
in the Prefect documentation. I hope this helps you find the perfect way to end things early. Good luck, human!
j
What if I didn’t want to cancel it, but mark it as completed early, and not perform any outstanding tasks