This is an automated email from the ASF dual-hosted git repository. dstandish 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 2023a76037 Remove before_log in KPO retry and add traceback when interrupted (#35423) 2023a76037 is described below commit 2023a76037f07a2003ace1d1a7497019316db7a6 Author: Daniel Standish <15932138+dstand...@users.noreply.github.com> AuthorDate: Fri Nov 3 18:55:31 2023 -0700 Remove before_log in KPO retry and add traceback when interrupted (#35423) 2 small logging "fixes" 1. usually tenacity retry will not be invoked. No need to add confusing log messages when there's not actually a retry. 2. When log read is interrupted and pod still running, something exceptional has happened. Let's just include the traceback rather than forcing user to enable debug logging. --- airflow/providers/cncf/kubernetes/utils/pod_manager.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/airflow/providers/cncf/kubernetes/utils/pod_manager.py b/airflow/providers/cncf/kubernetes/utils/pod_manager.py index 8e8fbe132d..aff4970cd9 100644 --- a/airflow/providers/cncf/kubernetes/utils/pod_manager.py +++ b/airflow/providers/cncf/kubernetes/utils/pod_manager.py @@ -20,7 +20,6 @@ from __future__ import annotations import enum import itertools import json -import logging import math import time import warnings @@ -37,7 +36,6 @@ from kubernetes.client.rest import ApiException from kubernetes.stream import stream as kubernetes_stream from pendulum import DateTime from pendulum.parsing.exceptions import ParserError -from tenacity import before_log from typing_extensions import Literal from urllib3.exceptions import HTTPError as BaseHTTPError @@ -392,7 +390,6 @@ class PodManager(LoggingMixin): retry=tenacity.retry_if_exception_type(ApiException), stop=tenacity.stop_after_attempt(10), wait=tenacity.wait_fixed(1), - before=before_log(self.log, logging.INFO), ) def consume_logs( *, @@ -452,17 +449,10 @@ class PodManager(LoggingMixin): self._progress_callback(line) self.log.info("[%s] %s", container_name, message_to_log) last_captured_timestamp = message_timestamp - except BaseHTTPError as e: - self.log.warning( - "Reading of logs interrupted for container %r with error %r; will retry. " - "Set log level to DEBUG for traceback.", + except BaseHTTPError: + self.log.exception( + "Reading of logs interrupted for container %r; will retry.", container_name, - e, - ) - self.log.debug( - "Traceback for interrupted logs read for pod %r", - pod.metadata.name, - exc_info=True, ) return last_captured_timestamp or since_time, logs