ultrabug commented on a change in pull request #2460: [AIRFLOW-1424] make the
next execution date of DAGs visible
URL: https://github.com/apache/incubator-airflow/pull/2460#discussion_r230588553
##########
File path: airflow/models.py
##########
@@ -3055,6 +3055,37 @@ def latest_execution_date(self):
session.close()
return execution_date
+ @property
+ def next_run_date(self):
+ """
+ Returns the next run date for which the dag will be scheduled
+ """
+ next_run_date = None
+ if not self.latest_execution_date:
+ # First run
+ task_start_dates = [t.start_date for t in self.tasks]
+ if task_start_dates:
+ next_run_date = self.normalize_schedule(min(task_start_dates))
+ else:
+ next_run_date = self.following_schedule(self.latest_execution_date)
+ return next_run_date
+
+ @property
+ def next_execution_date(self):
+ """
+ Returns the next execution date at which the dag will be scheduled by
Review comment:
The code base and terminology makes a distinction between run dates and
execution dates
I may be mistaken btu **run** is related to the DAG while **execution** is
related to the scheduler. So the actual execution date (which is what we want
to know here) is derived from the next run date of the DAG.
That's why the logic here adds a property of `next_run_date` which is
derived from the DAG's tasks while the following `next_execution_date` is using
this `next_run_date` property to calculate its own execution time.
I just re-read the code and it still looks valid to me. If not, tell me and
I'll adjust my mistakes!
Cheers
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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