ashb commented on a change in pull request #10956:
URL: https://github.com/apache/airflow/pull/10956#discussion_r490827114
##########
File path: airflow/models/dag.py
##########
@@ -458,6 +458,101 @@ def previous_schedule(self, dttm):
elif self.normalized_schedule_interval is not None:
return timezone.convert_to_utc(dttm -
self.normalized_schedule_interval)
+ def next_dagrun_info(self, date_last_automated_dagrun :
Optional[pendulum.DateTime]):
+ """
+ Get information about the next DagRun of this dag after
``date_last_automated_dagrun`` -- the
+ execution date, and the earliest it could be scheduled
+
+ :param date_last_automated_dagrun: The max(execution_date) of existing
+ "automated" DagRuns for this dag (scheduled or backfill, but not
+ manual)
+ """
+ next_execution_date =
self.next_dagrun_after_date(date_last_automated_dagrun)
+
+ if next_execution_date is None or self.schedule_interval in (None,
'@once'):
+ return None
+
+ return {
+ 'execution_date': next_execution_date,
+ 'can_be_created_after':
self.following_schedule(next_execution_date)
+ }
Review comment:
Nice idea, will do.
----------------------------------------------------------------
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]