When I cancel a flow in the UI, it stops further e...
# prefect-community
When I cancel a flow in the UI, it stops further execution of tasks right? I got two questions/remarks: • Is the active task killed in some way? Or will it wait until it completes? • When I use a resource manager, I noticed that unfortunately the cleanup will not be called 😕 . Is there some way I can cancel my flow, but still cleanup resources? Maybe force it with a state handler, if state handlers still are triggered?
Hi @Joël Luijmes - in theory yes, the cancellation method makes a best-attempt to stop all running processes, including any tasks in a Running state. This isn't true in cases where you're using a shared Dask cluster, where instead of stopping running tasks, the flow runner will stop submitting tasks but allow any active tasks to run to completion.
However, because cancellation means attempting to send a
signal to the main thread, cleanup tasks will not be run.