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 2021/05/10 16:39:25 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #15755: Save pod name to xcom for KubernetesPodOperator

mik-laj commented on a change in pull request #15755:
URL: https://github.com/apache/airflow/pull/15755#discussion_r629509871



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -367,8 +366,10 @@ def execute(self, context) -> Optional[str]:
                 self.log.info("creating pod with labels %s and launcher %s", labels, launcher)
                 final_state, _, result = self.create_new_pod_for_operator(labels, launcher)
             if final_state != State.SUCCESS:
-                status = self.client.read_namespaced_pod(self.pod.metadata.name, self.namespace)
-                raise AirflowException(f'Pod {self.pod.metadata.name} returned a failure: {status}')
+                status = self.client.read_namespaced_pod(pod_name, self.namespace)
+                raise AirflowException(f'Pod {pod_name} returned a failure: {status}')

Review comment:
       `pod_name` != `self.pod.metadata.name` in all cases. When we reattach to an existing task, then we have the old name. See: 
   https://github.com/apache/airflow/blob/0ec79d036b32c0c437b38972f9ecb6be64638b9b/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py#L403




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

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