From 3177e527a93e4a386ebc5d4bd43906fa832737d7 Mon Sep 17 00:00:00 2001 From: insomnes Date: Thu, 9 Jan 2025 21:37:08 +0100 Subject: [PATCH 1/2] Fix watcher kube_client_request_args shadowing --- .../kubernetes/executors/kubernetes_executor_utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py index ad0207cdfa3b3..5c50ed8bc5924 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py +++ b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py @@ -147,10 +147,12 @@ def _run( # For info about k8s timeout settings see # https://github.com/kubernetes-client/python/blob/v29.0.0/examples/watch/timeout-settings.md # and https://github.com/kubernetes-client/python/blob/v29.0.0/kubernetes/client/api_client.py#L336-L339 - client_timeout = 30 - server_conn_timeout = 3600 - kwargs["_request_timeout"] = client_timeout - kwargs["timeout_seconds"] = server_conn_timeout + if "_request_timeout" not in kwargs: + client_timeout = 30 + kwargs["_request_timeout"] = client_timeout + if "timeout_seconds" not in kwargs: + server_conn_timeout = 3600 + kwargs["timeout_seconds"] = server_conn_timeout logical_date_key = get_logical_date_key() for event in self._pod_events(kube_client=kube_client, query_kwargs=kwargs): From f9f083f92d49256c65872724e07f12b4469c0d3b Mon Sep 17 00:00:00 2001 From: Mikhail Dengin Date: Fri, 10 Jan 2025 21:33:50 +0100 Subject: [PATCH 2/2] Update providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py Apply suggestion by review Co-authored-by: Ryan Hatter <25823361+RNHTTR@users.noreply.github.com> --- .../cncf/kubernetes/executors/kubernetes_executor_utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py index 5c50ed8bc5924..f21c2866e834b 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py +++ b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py @@ -148,11 +148,9 @@ def _run( # https://github.com/kubernetes-client/python/blob/v29.0.0/examples/watch/timeout-settings.md # and https://github.com/kubernetes-client/python/blob/v29.0.0/kubernetes/client/api_client.py#L336-L339 if "_request_timeout" not in kwargs: - client_timeout = 30 - kwargs["_request_timeout"] = client_timeout + kwargs["_request_timeout"] = 30 if "timeout_seconds" not in kwargs: - server_conn_timeout = 3600 - kwargs["timeout_seconds"] = server_conn_timeout + kwargs["timeout_seconds"] = 3600 logical_date_key = get_logical_date_key() for event in self._pod_events(kube_client=kube_client, query_kwargs=kwargs):