ferruzzi commented on code in PR #30092:
URL: https://github.com/apache/airflow/pull/30092#discussion_r1136033014


##########
airflow/models/dagrun.py:
##########
@@ -870,10 +875,11 @@ def 
_emit_true_scheduling_delay_stats_for_finished_state(self, finished_tis: lis
                 # We can't emit this metric if there is no following schedule 
to calculate from!
                 return
 
-            ordered_tis_by_start_date = [ti for ti in finished_tis if 
ti.start_date]
-            ordered_tis_by_start_date.sort(key=lambda ti: ti.start_date, 
reverse=False)
-            first_start_date = ordered_tis_by_start_date[0].start_date if 
ordered_tis_by_start_date else None
-            if first_start_date:
+            try:
+                first_start_date = min(ti.start_date for ti in finished_tis if 
ti.start_date)

Review Comment:
   It's beautiful :chefkiss:



-- 
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