This is an automated email from the ASF dual-hosted git repository.
ash 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 8fd9a8167bf Wrap dictionary iteration with list to prevent dictionary
being changed during iteration. (#49241)
8fd9a8167bf is described below
commit 8fd9a8167bf810196ec461a7259ff172c2bbe3a2
Author: Karthikeyan Singaravelan <[email protected]>
AuthorDate: Tue Apr 15 01:47:21 2025 +0530
Wrap dictionary iteration with list to prevent dictionary being changed
during iteration. (#49241)
Wrap dictionary iteration with list to prevent dictionary being changed
during iteration. For a task group that got recently added previous runs won't
have task instance. Handle the error that assumes each group will always have a
task instance.
---
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py | 2 +-
airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
index 2b64551f982..4ae459b42bb 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
@@ -214,7 +214,7 @@ def grid_data(
(task_id_parent, run_id): parent_tis[(task_id_parent, run_id)] +
parent_tis[(task_id, run_id)]
for task_id, task_map in task_group_map.items()
if task_map["is_group"]
- for (task_id_parent, run_id), tis in parent_tis.items()
+ for (task_id_parent, run_id), tis in list(parent_tis.items())
if task_id_parent == task_map["parent_id"]
}
)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
index f35c4172e88..45ba4e42837 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
@@ -188,6 +188,9 @@ def fill_task_instance_summaries(
task_group_map_cache: dict[UUID, dict[str, dict[str, Any]]] = {}
for (task_id, run_id), tis in grouped_task_instances.items():
+ if not tis:
+ continue
+
sdm = _get_serdag(tis[0], session)
serdag_cache[sdm.id] = serdag_cache.get(sdm.id) or sdm.dag
dag = serdag_cache[sdm.id]