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 5ed4ffe4ac0 fix: fix mypy errors in /api/common/airflow_health.py 
(#57017)
5ed4ffe4ac0 is described below

commit 5ed4ffe4ac02bf2363cd3a30172def0fb326b21d
Author: Zhen-Lun (Kevin) Hong <[email protected]>
AuthorDate: Wed Oct 22 18:38:57 2025 +0800

    fix: fix mypy errors in /api/common/airflow_health.py (#57017)
---
 airflow-core/src/airflow/api/common/airflow_health.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/airflow-core/src/airflow/api/common/airflow_health.py 
b/airflow-core/src/airflow/api/common/airflow_health.py
index 343246a6394..1086e22df57 100644
--- a/airflow-core/src/airflow/api/common/airflow_health.py
+++ b/airflow-core/src/airflow/api/common/airflow_health.py
@@ -41,7 +41,8 @@ def get_airflow_health() -> dict[str, Any]:
         latest_scheduler_job = SchedulerJobRunner.most_recent_job()
 
         if latest_scheduler_job:
-            latest_scheduler_heartbeat = 
latest_scheduler_job.latest_heartbeat.isoformat()
+            if latest_scheduler_job.latest_heartbeat:
+                latest_scheduler_heartbeat = 
latest_scheduler_job.latest_heartbeat.isoformat()
             if latest_scheduler_job.is_alive():
                 scheduler_status = HEALTHY
     except Exception:
@@ -51,7 +52,8 @@ def get_airflow_health() -> dict[str, Any]:
         latest_triggerer_job = TriggererJobRunner.most_recent_job()
 
         if latest_triggerer_job:
-            latest_triggerer_heartbeat = 
latest_triggerer_job.latest_heartbeat.isoformat()
+            if latest_triggerer_job.latest_heartbeat:
+                latest_triggerer_heartbeat = 
latest_triggerer_job.latest_heartbeat.isoformat()
             if latest_triggerer_job.is_alive():
                 triggerer_status = HEALTHY
         else:
@@ -63,7 +65,8 @@ def get_airflow_health() -> dict[str, Any]:
         latest_dag_processor_job = DagProcessorJobRunner.most_recent_job()
 
         if latest_dag_processor_job:
-            latest_dag_processor_heartbeat = 
latest_dag_processor_job.latest_heartbeat.isoformat()
+            if latest_dag_processor_job.latest_heartbeat:
+                latest_dag_processor_heartbeat = 
latest_dag_processor_job.latest_heartbeat.isoformat()
             if latest_dag_processor_job.is_alive():
                 dag_processor_status = HEALTHY
         else:

Reply via email to