ashb commented on a change in pull request #10315:
URL: https://github.com/apache/airflow/pull/10315#discussion_r483568891
##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -350,6 +359,19 @@ def _set_name(self, name):
validate_key(name, max_length=220)
return re.sub(r'[^a-z0-9.-]+', '-', name.lower())
+ def _log_pod_events_on_failure(self, pod, launcher):
+ 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)
+
+ def _log_pod_status_on_failure(self, pod, launcher):
+ try:
+ pod_status = launcher.read_pod_status(pod)
+ self.log.error('Pod not succeeded, look for OOMKilled in
containers statuses.')
+ self.log.error(pod_status.status.container_statuses)
+ except AirflowException as ex:
+ self.log.exception('Failed to get container statuses: %s', ex)
Review comment:
`log.exception` already includes the exception, so:
```suggestion
self.log.exception('Failed to get container status')
```
----------------------------------------------------------------
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]