Fokko commented on a change in pull request #4871: [AIRFLOW-3844][WIP] Remove
DagBag from /landing_times.
URL: https://github.com/apache/airflow/pull/4871#discussion_r264040267
##########
File path: airflow/models/__init__.py
##########
@@ -2872,6 +2885,143 @@ def create_dagrun(self,
conf=conf,
session=session)
+ def date_range(self, start_date, num=None, end_date=utcnow()):
+ if num:
+ end_date = None
+ return utils_date_range(
+ start_date=start_date, end_date=end_date,
+ num=num, delta=self._schedule_interval)
+
+ def is_fixed_time_schedule(self):
+ """
+ Figures out if the DAG schedule has a fixed time (e.g. 3 AM).
+
+ :return: True if the schedule has a fixed time, False if not.
+ """
+
+ # TODO: Fix behaviour on timedelta's.
+
+ now = datetime.now()
+ cron = croniter(self._schedule_interval, now)
+
+ start = cron.get_next(datetime)
+ cron_next = cron.get_next(datetime)
+
+ if cron_next.minute == start.minute and cron_next.hour == start.hour:
Review comment:
This could be simplified to `return cron_next.minute == start.minute and
cron_next.hour == start.hour`. Less is more :-)
----------------------------------------------------------------
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]
With regards,
Apache Git Services