ashb commented on a change in pull request #16352:
URL: https://github.com/apache/airflow/pull/16352#discussion_r657799820
##########
File path: airflow/models/dag.py
##########
@@ -1812,19 +1815,40 @@ def create_dagrun(
if not isinstance(run_id, str):
raise ValueError(f"`run_id` expected to be a str is
{type(run_id)}")
run_type: DagRunType = DagRunType.from_run_id(run_id)
- elif run_type and execution_date:
+
+ # The preferred signature *requires* the data_interval argument. The
+ # legacy form of accepting an optional execution_date (and disallowing
+ # data_interval) is deprecated but accepted for compatibility.
+ if data_interval is None:
+ warnings.warn(
+ "Creating a DagRun without data_interval is deprecated.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ if execution_date is None:
+ start = timezone.utcnow()
+ else:
+ start = execution_date
+ if run_type == DagRunType.MANUAL:
+ data_interval = (start, start)
+ else:
+ data_interval = (start, self.following_schedule(start))
Review comment:
Shouldn't this go directly to a method on `self.timetable`?
--
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]