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



##########
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}')
+            context['task_instance'].xcom_push(key='pod_name', value=pod_name)

Review comment:
       ```suggestion
               context['task_instance'].xcom_push(key='pod_name', 
value=self.pod.metadata.name)
   ```




-- 
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:
[email protected]


Reply via email to