You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2022/03/29 20:48:57 UTC

[airflow] branch main updated: Log traceback only on ``DEBUG`` for KPO logs read interruption (#22595)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 67e2723  Log traceback only on ``DEBUG`` for KPO logs read interruption (#22595)
67e2723 is described below

commit 67e2723b7364ce1f73aee801522693d12d615310
Author: Daniel Standish <15...@users.noreply.github.com>
AuthorDate: Tue Mar 29 13:47:57 2022 -0700

    Log traceback only on ``DEBUG`` for KPO logs read interruption (#22595)
    
    Logging the traceback after every disconnect is a little overly scary when this is an expected occurrence for long-running pods, and this can create false alarm for users.  Here we reduce noise a bit while allowing users to troubleshoot if desired by changing the log level to debug.
---
 airflow/providers/cncf/kubernetes/utils/pod_manager.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/airflow/providers/cncf/kubernetes/utils/pod_manager.py b/airflow/providers/cncf/kubernetes/utils/pod_manager.py
index 3b3a7b7..f84a044 100644
--- a/airflow/providers/cncf/kubernetes/utils/pod_manager.py
+++ b/airflow/providers/cncf/kubernetes/utils/pod_manager.py
@@ -214,9 +214,14 @@ class PodManager(LoggingMixin):
                 for line in logs:
                     timestamp, message = self.parse_log_line(line.decode('utf-8'))
                     self.log.info(message)
-            except BaseHTTPError:  # Catches errors like ProtocolError(TimeoutError).
+            except BaseHTTPError as e:
                 self.log.warning(
-                    'Failed to read logs for pod %s',
+                    "Reading of logs interrupted with error %r; will retry. "
+                    "Set log level to DEBUG for traceback.",
+                    e,
+                )
+                self.log.debug(
+                    "Traceback for interrupted logs read for pod %r",
                     pod.metadata.name,
                     exc_info=True,
                 )