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



##########
File path: airflow/timetables/interval.py
##########
@@ -211,6 +217,17 @@ def _align(self, current: DateTime) -> DateTime:
             return next_time
         return current
 
+    def _prev_align(self, current: DateTime) -> DateTime:
+        """Get the prev scheduled time.
+
+        This is ``current - interval``, unless ``current`` falls right on the
+        interval boundary, when ``current`` is returned.
+        """
+        prev_time = self._get_prev(current)
+        if self._get_next(prev_time) != current:
+            return prev_time
+        return current

Review comment:
       This seems to be always the same as 
`self._get_prev(self._get_next(current))`?
   
   Say a schedule runs one every midnight. For this implementation:
   
   * If `current` is at midnight, the return value is at midnight
   * If `current` is on 1am, the return value is at midnight
   
   For `self._get_prev(self._get_next(current))`:
   
   * If `current` is at midnight, `_get_next` returns the next midnight, and 
`_get_prev` returns _this_ midnight
   * If `current` is at 1am, `_get_next` returns the next midnight, and 
`_get_prev` returns _this_ midnight
   
   And for the timedelta interval, `self._get_prev(self._get_next(current))` is 
always `current`.
   
   So if I’m not mistaken, this function is not needed.




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