Question about setting states in flows and tasks -...
# ask-community
s
Question about setting states in flows and tasks - specifically setting a flow to
Cancelling
state, and tasks still running after flow has entered
Cancelled
state - see thread
We’re manually cancelling flows in some cases before starting another run of the same flow, using
Copy code
async with get_client() as client:
    await client.set_flow_run_state(flow_run_id=run.id, state=Cancelling(), force=True)
That works to cancel a flow, but the tasks within that cancelled flow continue to run. I assumed the tasks would be cancelled if the flow run is cancelled, but apparently the Prefect Cloud UI Cancel button is doing something different?
I guess I need to cancel the tasks and the flow, not just the flow.
Any ideas?