This is an automated email from the ASF dual-hosted git repository.

uranusjr 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 c9b21b8026 Faster grid view (#23951)
c9b21b8026 is described below

commit c9b21b8026c595878ee4cc934209fc1fc2ca2396
Author: Jed Cunningham <66968678+jedcunning...@users.noreply.github.com>
AuthorDate: Thu May 26 22:00:09 2022 -0600

    Faster grid view (#23951)
---
 airflow/www/utils.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index 0a7de05abf..48512f03fa 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -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,
@@ -144,9 +152,9 @@ def get_task_summaries(task, dag_runs: List[DagRun], 
session: Session) -> List[D
             )
 
         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 {

Reply via email to