Skip to content

Commit

Permalink
Faster grid view (#23951)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedcunningham authored May 27, 2022
1 parent 45b5cf0 commit c9b21b8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ def get_mapped_summary(parent_instance, task_instances):


def get_task_summaries(task, dag_runs: List[DagRun], session: Session) -> List[Dict[str, Any]]:
tis = session.query(TaskInstance).filter(
tis = session.query(
TaskInstance.task_id,
TaskInstance.run_id,
TaskInstance.map_index,
TaskInstance.state,
TaskInstance.start_date,
TaskInstance.end_date,
TaskInstance._try_number,
).filter(
TaskInstance.dag_id == task.dag_id,
TaskInstance.run_id.in_([dag_run.run_id for dag_run in dag_runs]),
TaskInstance.task_id == task.task_id,
Expand All @@ -144,9 +152,9 @@ def _get_summary(task_instance):
)

try_count = (
task_instance.prev_attempted_tries
if task_instance.prev_attempted_tries != 0
else task_instance.try_number
task_instance._try_number
if task_instance._try_number != 0 or task_instance.state in State.running
else task_instance._try_number + 1
)

return {
Expand Down

0 comments on commit c9b21b8

Please sign in to comment.