jedcunningham commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1458204102


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -573,10 +575,17 @@ def execute_sync(self, context: Context):
                 self.pod, istio_enabled, self.base_container_name
             )
         finally:
-            self.cleanup(
-                pod=self.pod or self.pod_request_obj,
-                remote_pod=self.remote_pod,
-            )
+            try:
+                self.cleanup(
+                    pod=self.pod or self.pod_request_obj,
+                    remote_pod=self.remote_pod,
+                )
+            except Exception:
+                # If task got marked as failed, it should not raise exception 
(which might cause retry).
+                # https://github.com/apache/airflow/issues/36471
+                if not self._killed:
+                    raise

Review Comment:
   Ah, good catch. I should have looked closer.  Now that I have though, should 
we even run cleanup after we hit on_kill? I don't see anything in there that we 
really need to run once we've decided to bail out?



-- 
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]

Reply via email to