XD-DENG 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_r230786250
##########
File path: airflow/models.py
##########
@@ -3732,6 +3732,37 @@ def latest_execution_date(self, session=None):
).scalar()
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]
Review comment:
I'm not sure if this function will make sense when `latest_execution_date`
is not available.
Understand you're trying to decide the next run using `start_date`. But
`catchup` of the DAG can be either `True` or `False`, and it will affect the
actual next execution date (ref:
https://airflow.apache.org/scheduler.html?highlight=backfill#backfill-and-catchup).
----------------------------------------------------------------
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