Skip to content

Allow users to opt-out of SIGTERM rescheduling on Kubernetes worker #18867

@masonmenges

Description

@masonmenges

Describe the current behavior

When a job runs through Kubernetes with a backoff limit of 0 we automatically reschedule the flow run based on the value of this env variable PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR

This is set automatically if the backoff_limit is 0 here even if the value is set as part of the job configuration through the work pool or job variables on a deployment.

if isinstance(self.env, dict):
self.env["PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR"] = "reschedule"
elif not any(
v.get("name") == "PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR"
for v in self.env
):
self.env.append(
{
"name": "PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR",
"value": "reschedule",
}
)

Describe the proposed behavior

Ideally a user would be able to set PREFECT_FLOW_RUN_EXECUTE_SIGTERM_BEHAVIOR to some value other than reschedule to opt out of this behavior.

Example Use

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions