This is an automated email from the ASF dual-hosted git repository.
potiuk 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 1cb057f5c27 Throttle HTTPError during consume pod logs (#54761)
1cb057f5c27 is described below
commit 1cb057f5c271e19ed8cb7ab8e955f3022ddc730d
Author: AutomationDev85 <[email protected]>
AuthorDate: Fri Aug 22 15:39:55 2025 +0200
Throttle HTTPError during consume pod logs (#54761)
Co-authored-by: AutomationDev85 <AutomationDev85>
---
.../providers/cncf/kubernetes/utils/pod_manager.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git
a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py
b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py
index ae30c5ca429..b426a17ccc2 100644
---
a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py
+++
b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py
@@ -560,10 +560,17 @@ class PodManager(LoggingMixin):
return val.add(seconds=2), e
except HTTPError as e:
exception = e
- self.log.exception(
- "Reading of logs interrupted for container %r; will
retry.",
- container_name,
- )
+ self._http_error_timestamps = getattr(self,
"_http_error_timestamps", [])
+ self._http_error_timestamps = [
+ t for t in self._http_error_timestamps if t > utcnow() -
timedelta(seconds=60)
+ ]
+ self._http_error_timestamps.append(utcnow())
+ # Log only if more than 2 errors occurred in the last 60
seconds
+ if len(self._http_error_timestamps) > 2:
+ self.log.exception(
+ "Reading of logs interrupted for container %r; will
retry.",
+ container_name,
+ )
return last_captured_timestamp or since_time, exception
# note: `read_pod_logs` follows the logs, so we shouldn't necessarily
*need* to