This is an automated email from the ASF dual-hosted git repository.
Miretpl 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 160c2a42bc0 Fix triggerer startup with a fractional health check
threshold (#76211)
160c2a42bc0 is described below
commit 160c2a42bc0323102f28e42ec08d748637eb4422
Author: Hussein Awala <[email protected]>
AuthorDate: Mon Nov 23 22:37:26 2026 +0100
Fix triggerer startup with a fractional health check threshold (#76211)
[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.
Co-authored-by: Przemysław Mirowski
<[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 ec7fe23d1c2..ce0cb855035 100644
--- a/airflow-core/src/airflow/jobs/triggerer_job_runner.py
+++ b/airflow-core/src/airflow/jobs/triggerer_job_runner.py
@@ -683,7 +683,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 82cc88fc7ba..8ad54ce66ef 100644
--- a/airflow-core/tests/unit/jobs/test_triggerer_job.py
+++ b/airflow-core/tests/unit/jobs/test_triggerer_job.py
@@ -22,6 +22,7 @@ import contextlib
import copy
import datetime
import errno
+import importlib.util
import itertools
import json
import logging
@@ -334,6 +335,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):