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 486ccba4cf Remove inconsequential code bits in KPO logging (#35416)
486ccba4cf is described below
commit 486ccba4cfc373f2864ad1c88ac5093988e61a73
Author: Daniel Standish <[email protected]>
AuthorDate: Mon Nov 13 10:36:51 2023 -0800
Remove inconsequential code bits in KPO logging (#35416)
We were passing around the `logs` variable (actually PodLogConsumer object)
for no reason. And the `termination_timeout` param was not used. It seems
that the passing around of the object was first introduced in #34127, then
perhaps accidentally removed in #34127. Someone may want to try to
re-introduce the original fix.
---
airflow/providers/cncf/kubernetes/utils/pod_manager.py | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/airflow/providers/cncf/kubernetes/utils/pod_manager.py
b/airflow/providers/cncf/kubernetes/utils/pod_manager.py
index 856f5fa19b..b215d7b68a 100644
--- a/airflow/providers/cncf/kubernetes/utils/pod_manager.py
+++ b/airflow/providers/cncf/kubernetes/utils/pod_manager.py
@@ -385,13 +385,7 @@ class PodManager(LoggingMixin):
:meta private:
"""
- def consume_logs(
- *,
- since_time: DateTime | None = None,
- follow: bool = True,
- termination_timeout: int = 120,
- logs: PodLogsConsumer | None,
- ) -> tuple[DateTime | None, PodLogsConsumer | None]:
+ def consume_logs(*, since_time: DateTime | None = None) -> DateTime |
None:
"""
Try to follow container logs until container completes.
@@ -448,20 +442,14 @@ class PodManager(LoggingMixin):
"Reading of logs interrupted for container %r; will
retry.",
container_name,
)
- return last_captured_timestamp or since_time, logs
+ return last_captured_timestamp or since_time
# note: `read_pod_logs` follows the logs, so we shouldn't necessarily
*need* to
# loop as we do here. But in a long-running process we might
temporarily lose connectivity.
# So the looping logic is there to let us resume following the logs.
- logs = None
last_log_time = since_time
while True:
- last_log_time, logs = consume_logs(
- since_time=last_log_time,
- follow=follow,
- termination_timeout=post_termination_timeout,
- logs=logs,
- )
+ last_log_time = consume_logs(since_time=last_log_time)
if not follow:
return
if self.container_is_running(pod, container_name=container_name):