This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 2f8c68c946f [v3-4-test] Fix triggerer startup with a fractional health
check threshold (#76211) (#77686)
2f8c68c946f is described below
commit 2f8c68c946ffabfb56dece245919dca08fc2cc78
Author: Rahul Vats <[email protected]>
AuthorDate: Fri Nov 27 19:35:50 2026 +0530
[v3-4-test] Fix triggerer startup with a fractional health check threshold
(#76211) (#77686)
[triggerer] triggerer_health_check_threshold is documented as a float,
and the health check behind /health and `airflow jobs check` reads it
as one. The triggerer module parsed it as an integer at import time, so
a schema-valid value such as 30.5 raised a config error in every
process importing that module: the triggerer could not start, and the
public API routes, which import it through the health check module,
could not be loaded either.
Reading it as a float lets those processes start with any value the
config schema allows, and keeps the heartbeat window the triggerer uses
to decide which triggerers are alive (and whose triggers to take over)
identical to the one the health check uses.
(cherry picked from commit 160c2a42bc0323102f28e42ec08d748637eb4422)
Co-authored-by: Hussein Awala <[email protected]>
Co-authored-by: Claude <[email protected]>
---
airflow-core/src/airflow/jobs/triggerer_job_runner.py | 2 +-
airflow-core/tests/unit/jobs/test_triggerer_job.py | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/jobs/triggerer_job_runner.py
b/airflow-core/src/airflow/jobs/triggerer_job_runner.py
index f8d94e069e8..62b1cbe795c 100644
--- a/airflow-core/src/airflow/jobs/triggerer_job_runner.py
+++ b/airflow-core/src/airflow/jobs/triggerer_job_runner.py
@@ -514,7 +514,7 @@ class TriggerRunnerSupervisor(WatchedSubprocess):
queues: set[str] | None = None
team_name: str | None = None
- health_check_threshold = conf.getint("triggerer",
"triggerer_health_check_threshold")
+ health_check_threshold = conf.getfloat("triggerer",
"triggerer_health_check_threshold")
runner_health_check_threshold = conf.getfloat("triggerer",
"runner_health_check_threshold")
runner: TriggerRunner | None = None
diff --git a/airflow-core/tests/unit/jobs/test_triggerer_job.py
b/airflow-core/tests/unit/jobs/test_triggerer_job.py
index 36c18674efc..6a9e2fdbcd7 100644
--- a/airflow-core/tests/unit/jobs/test_triggerer_job.py
+++ b/airflow-core/tests/unit/jobs/test_triggerer_job.py
@@ -20,6 +20,7 @@ from __future__ import annotations
import asyncio
import contextlib
import datetime
+import importlib.util
import itertools
import json
import os
@@ -306,6 +307,19 @@ def test_capacity_decode():
TriggererJobRunner(job=job, capacity=input_str)
+@conf_vars({("triggerer", "triggerer_health_check_threshold"): "30.5"})
+def test_health_check_threshold_accepts_float():
+ # The threshold is read when the class body runs, so execute a fresh copy
of the module.
+ # importlib.reload() would rebind the classes that the rest of this module
imported and patches.
+ spec = importlib.util.find_spec("airflow.jobs.triggerer_job_runner")
+ assert spec is not None
+ assert spec.loader is not None
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+
+ assert module.TriggerRunnerSupervisor.health_check_threshold == 30.5
+
+
@pytest.mark.parametrize("team_name", ["team_a", None])
@patch.object(TriggerRunnerSupervisor, "start")
def test_execute_passes_job_team_name_to_supervisor(mock_supervisor_start,
team_name):