dirrao commented on code in PR #39414:
URL: https://github.com/apache/airflow/pull/39414#discussion_r1590531270


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -544,8 +544,14 @@ def find_pod(self, namespace: str, context: Context, *, 
exclude_checked: bool =
 
     def get_or_create_pod(self, pod_request_obj: k8s.V1Pod, context: Context) 
-> k8s.V1Pod:
         if self.reattach_on_restart:
-            pod = self.find_pod(self.namespace or 
pod_request_obj.metadata.namespace, context=context)
-            if pod:
+            pod_request_obj_namespace = (
+                pod_request_obj.metadata.namespace if pod_request_obj.metadata 
else None
+            )
+            namespace = self.namespace or pod_request_obj_namespace
+            if not namespace:
+                raise ValueError("Pod namespace is empty")
+            pod = self.find_pod(namespace, context=context)
+            if pod and pod.status and pod.status.phase == "Running":

Review Comment:
   When the next retry attempt comes back, by that time the task might move 
from running to completed state. Why do you want to rerun the same? 



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