You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2024/01/12 11:41:31 UTC

[PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Lee-W opened a new pull request, #36749:
URL: https://github.com/apache/airflow/pull/36749

   
   #36471
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1453772696


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +680,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred 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:
   agree, no need wrap; doing so can obscure the actual problem



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #36749:
URL: https://github.com/apache/airflow/pull/36749


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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1458229220


##########
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:
   Indeed, just move the flag to `cleanup`. If the task has been killed, we'll not call it.



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "dirrao (via GitHub)" <gi...@apache.org>.
dirrao commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1451121124


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -535,6 +537,7 @@ def execute(self, context: Context):
 
     def execute_sync(self, context: Context):
         result = None
+        self.killed = False

Review Comment:
   are you referring to self._killed?



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +680,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred 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:
   isn't good idea to wrap the original exception with airflow exception and raise?



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1451998425


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +679,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred as failed, it should not raise exception which might cause retry.

Review Comment:
   Just fixed! Thanks!



##########
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 one task got makred as failed, it should not raise exception which might cause retry.

Review Comment:
   Just fixed! Thanks!



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -826,7 +842,11 @@ def on_kill(self) -> None:
             }
             if self.termination_grace_period is not None:
                 kwargs.update(grace_period_seconds=self.termination_grace_period)
-            self.client.delete_namespaced_pod(**kwargs)
+
+            try:
+                self.client.delete_namespaced_pod(**kwargs)
+            except kubernetes.client.exceptions.ApiException:
+                self.log.warning("The pod no longer exists")

Review Comment:
   Sure! Just added



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1451418594


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +680,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred 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:
   Hmmm... I would say I don't really like wrapping the original exception as an airflow exception. I use airflow exception for new customized. exception



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1454952681


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -826,7 +842,11 @@ def on_kill(self) -> None:
             }
             if self.termination_grace_period is not None:
                 kwargs.update(grace_period_seconds=self.termination_grace_period)
-            self.client.delete_namespaced_pod(**kwargs)
+
+            try:
+                self.client.delete_namespaced_pod(**kwargs)
+            except kubernetes.client.exceptions.ApiException:
+                self.log.warning("Pod %s no longer exists", self.pod.metadata.name)

Review Comment:
   Sure! Thanks!



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1453774397


##########
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 one task got marked as failed, it should not raise exception which might cause retry.

Review Comment:
   ```suggestion
                   # If task got marked as failed, it should not raise exception (which might cause retry).
   ```



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1455038360


##########
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:
   I think that probably won't fix this case as the exception was raised before `process_pod_deletion` is called



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1453905335


##########
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:
   I almost wonder if we should swallow the exception in `process_pod_deletion` instead, so we are a little more surgical with what we are ignoring.



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -826,7 +842,11 @@ def on_kill(self) -> None:
             }
             if self.termination_grace_period is not None:
                 kwargs.update(grace_period_seconds=self.termination_grace_period)
-            self.client.delete_namespaced_pod(**kwargs)
+
+            try:
+                self.client.delete_namespaced_pod(**kwargs)
+            except kubernetes.client.exceptions.ApiException:
+                self.log.warning("Pod %s no longer exists", self.pod.metadata.name)

Review Comment:
   ```suggestion
               except kubernetes.client.exceptions.ApiException:
                   self.log.exception("Unable to delete pod %s", self.pod.metadata.name)
   ```
   
   This can't be the only cause of an ApiException... Maybe this instad?



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +679,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got marked as failed, it should not raise exception which might cause retry.
+            # https://github.com/apache/airflow/issues/36471

Review Comment:
   ```suggestion
   ```



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

Review Comment:
   nit: git history is sufficient here imo
   ```suggestion
   ```



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1453772696


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +680,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred 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:
   agree, no need wrap



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1458206012


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +678,15 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got marked as failed, it should not raise exception which might cause retry.

Review Comment:
   ```suggestion
               # If task got marked as failed, it should not raise exception (which might cause retry).
   ```
   
   nit: lets keep the comments consistent



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1451415591


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -535,6 +537,7 @@ def execute(self, context: Context):
 
     def execute_sync(self, context: Context):
         result = None
+        self.killed = False

Review Comment:
   yep, this should be `self._killed`. Let me fixe it



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #36749:
URL: https://github.com/apache/airflow/pull/36749#discussion_r1451915291


##########
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 one task got makred as failed, it should not raise exception which might cause retry.

Review Comment:
   typo: marked



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,10 +679,16 @@ def write_logs(self, pod: k8s.V1Pod):
 
     def post_complete_action(self, *, pod, remote_pod, **kwargs):
         """Actions that must be done after operator finishes logic of the deferrable_execution."""
-        self.cleanup(
-            pod=pod,
-            remote_pod=remote_pod,
-        )
+        try:
+            self.cleanup(
+                pod=pod,
+                remote_pod=remote_pod,
+            )
+        except Exception:
+            # If one task got makred as failed, it should not raise exception which might cause retry.

Review Comment:
   Same typo as earlier



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -826,7 +842,11 @@ def on_kill(self) -> None:
             }
             if self.termination_grace_period is not None:
                 kwargs.update(grace_period_seconds=self.termination_grace_period)
-            self.client.delete_namespaced_pod(**kwargs)
+
+            try:
+                self.client.delete_namespaced_pod(**kwargs)
+            except kubernetes.client.exceptions.ApiException:
+                self.log.warning("The pod no longer exists")

Review Comment:
   Let us also mention which pod here in the warning



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


Re: [PR] avoid retrying after KubernetesPodOperator has been marked as failed [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org

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