This is an automated email from the ASF dual-hosted git repository.
bbovenzi 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 ed689f2be9 Display execution_date in graph view task instance tooltip.
(#32527)
ed689f2be9 is described below
commit ed689f2be90cc8899438be66e3c75c3921e156cb
Author: Karthikeyan Singaravelan <[email protected]>
AuthorDate: Tue Jul 25 12:23:10 2023 +0530
Display execution_date in graph view task instance tooltip. (#32527)
* Fix displaying execution_date in graph view task instance tooltip.
* Fix tests.
---
airflow/www/utils.py | 6 +++++-
tests/www/views/test_views_tasks.py | 7 +++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index bcf368ea20..8d5ee60d0d 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -84,7 +84,10 @@ def get_mapped_instances(task_instance, session):
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 @@ def get_mapped_summary(parent_instance, task_instances):
"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 d8c6a488a9..32df99c047 100644
--- a/tests/www/views/test_views_tasks.py
+++ b/tests/www/views/test_views_tasks.py
@@ -1013,6 +1013,7 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"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 @@ def test_task_instances(admin_client):
"dag_id": "example_bash_operator",
"duration": None,
"end_date": None,
+ "execution_date": DEFAULT_DATE.isoformat(),
"executor_config": {},
"external_executor_id": None,
"hostname": "",