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 2020/02/03 15:11:05 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #7292: [AIRFLOW-6678] Pull event logs from Kubernetes pod on failure

potiuk commented on a change in pull request #7292: [AIRFLOW-6678] Pull event logs from Kubernetes pod on failure
URL: https://github.com/apache/airflow/pull/7292#discussion_r374156332
 
 

 ##########
 File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
 ##########
 @@ -277,11 +281,19 @@ def execute(self, context):
                     pod,
                     startup_timeout=self.startup_timeout_seconds,
                     get_logs=self.get_logs)
+            except AirflowException:
+                if self.log_events_on_failure:
+                    for event in launcher.read_pod_events(pod).items:
+                        self.log.error("Pod Event: %s - %s", event.reason, event.message)
+                raise
             finally:
                 if self.is_delete_operator_pod:
                     launcher.delete_pod(pod)
 
             if final_state != State.SUCCESS:
+                if self.log_events_on_failure:
 
 Review comment:
   I think we should protect against writing the logs twice. In case of Airflow Exception thrown it is more than likely that the final_state will not be a success, so the logs will be written twice. I think we should have a flag "logs_dumped" or smth like that an only write logs once.

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


With regards,
Apache Git Services