amoghrajesh commented on code in PR #77197:
URL: https://github.com/apache/airflow/pull/77197#discussion_r4715747827
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -942,6 +956,18 @@ def execute_sync(self, context: Context):
self.remote_pod = self.pod_manager.await_pod_completion(
self.pod, istio_enabled, self.base_container_name,
self.do_xcom_push
)
+ except AirflowTaskTimeout:
+ # The task runner calls on_kill only after this propagates, so
cleanup has to know now
+ # that the pod must be left running for the next try to reattach.
A retry_policy (Airflow
+ # 3.3+) can fail the task with tries left, which would leave the
kept pod running forever.
+ ti = context["ti"]
+ self._keep_pod_after_timeout = (
+ self.reattach_on_restart
+ and self.on_kill_action == OnKillAction.KEEP_POD
+ and ti.try_number <= ti.max_tries
+ and getattr(self, "retry_policy", None) is None
Review Comment:
Added an info log when `on_kill_action` is `keep_pod` and the keep is
declined, naming the condition: durable off, last try, or a `retry_policy` set.
The timeout test asserts the message per case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]