uranusjr commented on code in PR #33535:
URL: https://github.com/apache/airflow/pull/33535#discussion_r1299289768


##########
airflow/www/views.py:
##########
@@ -3237,7 +3237,8 @@ def duration(self, dag_id: str, session: Session = 
NEW_SESSION):
 
         # we must group any mapped TIs by dag_id, task_id, run_id
         mapped_tis = set()
-        tis_grouped = itertools.groupby(task_instances, lambda x: (x.dag_id, 
x.task_id, x.run_id))
+        tis_group_sort = lambda ti: (ti.dag_id, ti.task_id, ti.run_id)

Review Comment:
   ```suggestion
   
           def tis_group_sort(ti):
               return ti.dag_id, ti.task_id, ti.run_id
   
   ```
   
   There’s a rule E731 that advises you to not assign a lambda but use def 
instead. We currently have it disabled, but it’s a good idea to follow it in 
new code.



##########
airflow/www/views.py:
##########
@@ -3237,7 +3237,8 @@ def duration(self, dag_id: str, session: Session = 
NEW_SESSION):
 
         # we must group any mapped TIs by dag_id, task_id, run_id
         mapped_tis = set()
-        tis_grouped = itertools.groupby(task_instances, lambda x: (x.dag_id, 
x.task_id, x.run_id))
+        tis_group_sort = lambda ti: (ti.dag_id, ti.task_id, ti.run_id)

Review Comment:
   ```suggestion
   
           def tis_group_sort(ti):
               return ti.dag_id, ti.task_id, ti.run_id
   
   ```
   
   There’s a rule E731 that advises you to not assign a lambda but use def 
instead. We currently have it disabled, but it’s a good idea to follow it in 
new code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to