Skip to content

Commit

Permalink
Display execution_date in graph view task instance tooltip. (apache#3…
Browse files Browse the repository at this point in the history
…2527)

* Fix displaying execution_date in graph view task instance tooltip.

* Fix tests.
  • Loading branch information
tirkarthi authored Jul 25, 2023
1 parent 58e21c6 commit ed689f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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,
}


Expand Down
7 changes: 7 additions & 0 deletions tests/www/views/test_views_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down

0 comments on commit ed689f2

Please sign in to comment.