You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/01 06:17:21 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #27845: Patch "checked" when pod not successful

dstandish commented on code in PR #27845:
URL: https://github.com/apache/airflow/pull/27845#discussion_r1036727232


##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -472,34 +471,36 @@ def execute(self, context: Context):
         if self.do_xcom_push:
             return result
 
+    def _read_pod_log_events(self, pod, *, reraise=True):
+        """Will fetch and emit events from pod"""
+        with _optionally_suppress(reraise=reraise):
+            for event in self.pod_manager.read_pod_events(pod).items:
+                self.log.error("Pod Event: %s - %s", event.reason, event.message)
+
     def cleanup(self, pod: k8s.V1Pod, remote_pod: k8s.V1Pod):
         pod_phase = remote_pod.status.phase if hasattr(remote_pod, "status") else None
-        if not self.is_delete_operator_pod:
-            with _suppress(Exception):
-                self.patch_already_checked(remote_pod)
+        if pod_phase != PodPhase.SUCCEEDED or not self.is_delete_operator_pod:

Review Comment:
   this is the key change in this PR.
   
   We patch not just if "is delete" but also any time tha pod phase is not successful.
   
   this is to ensure that if the pod takes a long time to get removed (or if it simply failed to start in the first place) that we make sure we don't reattach to it on the retry. 
   
   everything else is drive by refactor / cleanup



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org