Netanel Malka
08/25/2024, 9:21 AMreturn StateType.CANCELLED
Marvin
08/25/2024, 9:21 AMStateType.CANCELLED
directly in the flow may not work as expected. In Prefect, states are managed by the orchestration layer and not by directly returning a state type from within the flow function.
2. Setting the flow or task state to CANCELLED:
- For task cancellation, you should use the set_task_run_state
method.
- For flow cancellation, use the set_flow_run_state
method.
3. Enhanced Cancellation:
- Enabling PREFECT_EXPERIMENTAL_ENABLE_ENHANCED_CANCELLATION
on your worker/agents can improve the cancellation experience. Configure it via:
prefect config set PREFECT_EXPERIMENTAL_ENABLE_ENHANCED_CANCELLATION=True
For detailed steps, you can refer to the Prefect documentation and specific issues related to cancellations:
- Concepts of flows: Prefect Flows Concepts
- GitHub issues on cancellations: Issue #14984, Issue #12864, Issue #13076
If you need more specific examples or additional help, feel free to ask!