<@ULVA73B9P> what is `PREFECT_FLOW_RUN_EXECUTE_SIG...
# ask-community
d
@Marvin what is
PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR
for?
m
thought for 106.6 seconds
It controls how a Prefect 3.x flow run process reacts to a SIGTERM (e.g., when a Kubernetes pod is terminated). Allowed values: - reschedule — On SIGTERM, the flow run moves to AwaitingRetry and the process exits 0 (graceful reschedule instead of a crash). - unset or any other value (e.g., die) — On SIGTERM, the flow run is marked Crashed and the process exits non‑zero. Key points: - This only affects raw SIGTERM handling for the flow process started by
prefect flow-run execute
. It does not change how user-initiated cancellations work; cancellations use a control-channel intent and are handled separately. - Useful on Kubernetes when you want evictions/scale-downs to trigger Prefect retries instead of crashing the run. - The Kubernetes worker may set this automatically based on your job’s retry/backoff settings to avoid duplicate retries (Kubernetes vs. Prefect). Example:
Copy code
# e.g., in your pod/container env
PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR=reschedule
References: - Source: flow engine SIGTERM decision and exception handling - flow_engine.py (decision) - flow_engine.py (sync handling) - flow_engine.py (async handling) - Source: CLI signal handler for
prefect flow-run execute
- cli/flow_run.py - Docs: Cancel workflows (how cancellation works) - Kubernetes worker docs: Prefect Kubernetes worker