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 38aada7b8b Introducing class constant to make worker pod log lines
configurable (#33378)
38aada7b8b is described below
commit 38aada7b8b6afab177c009b237dd5e75d60d51af
Author: Amogh Desai <[email protected]>
AuthorDate: Mon Aug 14 11:45:52 2023 +0530
Introducing class constant to make worker pod log lines configurable
(#33378)
---
.../cncf/kubernetes/executors/kubernetes_executor.py | 3 ++-
.../cncf/kubernetes/executors/test_kubernetes_executor.py | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py
b/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py
index f7f2bd68d7..cf74c34d97 100644
--- a/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py
+++ b/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py
@@ -147,6 +147,7 @@ KUBERNETES_COMMANDS = (
class KubernetesExecutor(BaseExecutor):
"""Executor for Kubernetes."""
+ RUNNING_POD_LOG_LINES = 100
supports_ad_hoc_ti_run: bool = True
def __init__(self):
@@ -502,7 +503,7 @@ class KubernetesExecutor(BaseExecutor):
namespace=namespace,
container="base",
follow=False,
- tail_lines=100,
+ tail_lines=self.RUNNING_POD_LOG_LINES,
_preload_content=False,
)
for line in res:
diff --git
a/tests/providers/cncf/kubernetes/executors/test_kubernetes_executor.py
b/tests/providers/cncf/kubernetes/executors/test_kubernetes_executor.py
index f0d77d5c18..3bb886a8e2 100644
--- a/tests/providers/cncf/kubernetes/executors/test_kubernetes_executor.py
+++ b/tests/providers/cncf/kubernetes/executors/test_kubernetes_executor.py
@@ -228,6 +228,19 @@ class TestAirflowKubernetesScheduler:
finally:
kube_executor.end()
+ def test_running_pod_log_lines(self):
+ # default behaviour
+ kube_executor = KubernetesExecutor()
+ assert kube_executor.RUNNING_POD_LOG_LINES == 100
+
+ # monkey-patching for second executor
+ kube_executor_2 = KubernetesExecutor()
+ kube_executor_2.RUNNING_POD_LOG_LINES = 200
+
+ # monkey-patching should not affect the class constant
+ assert kube_executor.RUNNING_POD_LOG_LINES == 100
+ assert kube_executor_2.RUNNING_POD_LOG_LINES == 200
+
class TestKubernetesExecutor:
"""