manipatnam commented on code in PR #64162:
URL: https://github.com/apache/airflow/pull/64162#discussion_r3578873499


##########
airflow-core/src/airflow/timetables/trigger.py:
##########
@@ -485,15 +477,15 @@ def next_dagrun_info_v2(
             else:
                 next_start_time = self._align_to_next(restriction.earliest)
         else:
-            prev_candidate = self._align_to_prev(coerce_datetime(utcnow()))
-            start_time_candidates = [prev_candidate]
             if last_dagrun_info is not None:
-                next_candidate = self._get_next(last_dagrun_info.run_after)
-                start_time_candidates.append(next_candidate)
-            elif restriction.earliest is None:
-                # Run immediately has no effect if there is restriction on 
earliest
-                first_run = self._calc_first_run()
-                start_time_candidates.append(first_run)
+                # _calc_first_run respects run_immediately to decide between 
the
+                # most recent past cron point and the next future one.
+                start_time_candidates = [
+                    self._calc_first_run(),
+                    self._get_next(last_dagrun_info.run_after),
+                ]
+            else:

Review Comment:
   This one's actually fine — CronPartitionTimetable extends 
CronTriggerTimetable, so run_immediately really is in play here. The reason I 
left the note in: without it, it's not obvious why we're calling 
_calc_first_run() again on a resume, instead of just jumping straight to the 
most recent past boundary — this line is what makes sure a paused-then-resumed 
Dag still honours whatever run_immediately says, rather than ignoring it once 
there's history.



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