Display execution_date in graph view task instance tooltip. (#32527)
* Fix displaying execution_date in graph view task instance tooltip.
* Fix tests.
diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index bcf368e..8d5ee60 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -84,7 +84,10 @@
def get_instance_with_map(task_instance, session):
if task_instance.map_index == -1:
- return alchemy_to_dict(task_instance)
+ data = alchemy_to_dict(task_instance)
+ # Fetch execution_date explicitly since it's not a column and a proxy
+ data["execution_date"] = task_instance.execution_date
+ return data
mapped_instances = get_mapped_instances(task_instance, session)
return get_mapped_summary(task_instance, mapped_instances)
@@ -137,6 +140,7 @@
"end_date": group_end_date,
"mapped_states": mapped_states,
"try_number": get_try_count(parent_instance._try_number, parent_instance.state),
+ "execution_date": parent_instance.execution_date,
}
diff --git a/tests/www/views/test_views_tasks.py b/tests/www/views/test_views_tasks.py
index d8c6a48..32df99c 100644
--- a/tests/www/views/test_views_tasks.py
+++ b/tests/www/views/test_views_tasks.py
@@ -1013,6 +1013,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1044,6 +1045,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1075,6 +1077,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1106,6 +1109,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1137,6 +1141,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1168,6 +1173,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",
@@ -1199,6 +1205,7 @@
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",