uranusjr commented on a change in pull request #15397:
URL: https://github.com/apache/airflow/pull/15397#discussion_r644664894



##########
File path: airflow/www/views.py
##########
@@ -2298,8 +2298,10 @@ def duration(self, session=None):
         else:
             base_date = dag.get_latest_execution_date() or timezone.utcnow()
 
-        dates = dag.date_range(base_date, num=-abs(num_runs))
-        min_date = dates[0] if dates else timezone.utc_epoch()
+        min_date = next(
+            dag.time_table.iter_next_n(base_date, 1),
+            timezone.utc_epoch(),
+        )

Review comment:
       1. Don’t do `abs()` in `iter_next_n()`, raise a `ValueError`.
   2. Change the places that are relying on `iter_next_n()` to return previous 
runs to get the actual `DagRun`s instead.




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

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


Reply via email to