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



##########
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:
       They are different ha
   
   For self._prev_align()
   - If current is at 1am, the return value is at midnight 
   
   For self._align()  
   - If current is at 1am, the return value is next midnight.
   
   It is correct that `data_schedule_start` is equal to the `data_schedule_end` 
of the previous one when no scheduling time changes. However, when the 
scheduling time changes, The first `data_schedule_start` for a new schedule may 
not be the same as the `data_schedule_end` before the schedule was changed
   
![2022-02-23_16-55](https://user-images.githubusercontent.com/55907021/155287695-aa251f60-df19-43e3-9d12-d8fb24be36c8.png)
   
   
   




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