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 a694dc8281f Honor API server worker timeout configuration (#72859)
a694dc8281f is described below
commit a694dc8281f9acd6a44a5a2edaa0e05961220a17
Author: Ryo Manabe <[email protected]>
AuthorDate: Sat Nov 7 04:16:16 2026 +0900
Honor API server worker timeout configuration (#72859)
* Honor API server worker timeout configuration
The documented worker timeout setting should control API server worker
lifecycle unless users explicitly override it on the command line.
* Update airflow-core/tests/unit/cli/commands/test_api_server_command.py
check the type of api-server.worker_timeout.
Co-authored-by: Y-C <[email protected]>
---------
Co-authored-by: Y-C <[email protected]>
Co-authored-by: Przemysław Mirowski
<[email protected]>
---
airflow-core/src/airflow/cli/cli_config.py | 2 +-
.../tests/unit/cli/commands/test_api_server_command.py | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/cli/cli_config.py
b/airflow-core/src/airflow/cli/cli_config.py
index 7e8a1533c28..1ead45d21ea 100644
--- a/airflow-core/src/airflow/cli/cli_config.py
+++ b/airflow-core/src/airflow/cli/cli_config.py
@@ -767,7 +767,7 @@ ARG_API_SERVER_WORKERS = Arg(
)
ARG_API_SERVER_WORKER_TIMEOUT = Arg(
("-t", "--worker-timeout"),
- default=120,
+ default=conf.get("api", "worker_timeout"),
type=int,
help="The timeout for waiting on API server workers",
)
diff --git a/airflow-core/tests/unit/cli/commands/test_api_server_command.py
b/airflow-core/tests/unit/cli/commands/test_api_server_command.py
index 8cc7f91e5ed..c7fdcb3b88b 100644
--- a/airflow-core/tests/unit/cli/commands/test_api_server_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_api_server_command.py
@@ -16,7 +16,9 @@
# under the License.
from __future__ import annotations
+import os
import ssl
+import subprocess
import sys
from unittest import mock
@@ -35,6 +37,22 @@ console = Console(width=400, color_system="standard")
class TestCliApiServer(_CommonCLIUvicornTestClass):
main_process_regexp = r"airflow api-server"
+ def test_uses_worker_timeout_config_as_cli_default(self):
+ result = subprocess.run(
+ [
+ sys.executable,
+ "-c",
+ "from airflow.cli.cli_parser import get_parser; "
+
"print(f\"worker_timeout={get_parser().parse_args(['api-server']).worker_timeout!r}\")",
+ ],
+ env={**os.environ, "AIRFLOW__API__WORKER_TIMEOUT": "321"},
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+
+ assert "worker_timeout=321" in result.stdout.splitlines()
+
@pytest.mark.parametrize(
"args",
[