You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/03/07 20:10:52 UTC

[GitHub] [airflow] hussein-awala commented on a diff in pull request #29000: Skip KubernetesPodOperator task when it returns a provided exit code

hussein-awala commented on code in PR #29000:
URL: https://github.com/apache/airflow/pull/29000#discussion_r1128523322


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -670,6 +675,24 @@ def cleanup(self, pod: k8s.V1Pod, remote_pod: k8s.V1Pod):
 
             error_message = get_container_termination_message(remote_pod, self.base_container_name)
             error_message = "\n" + error_message if error_message else ""
+            if self.skip_exit_code is not None:
+                container_statuses = (
+                    remote_pod.status.container_statuses if remote_pod and remote_pod.status else None
+                )
+                base_container_status = next(
+                    (x for x in container_statuses if x.name == self.base_container_name), None

Review Comment:
   :+1:  I added `or []` for container_statuses, this can fix the 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