This is an automated email from the ASF dual-hosted git repository. ephraimanierobi pushed a commit to branch v2-6-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 1a24e08d1fbd0d66b1683654f8295b8b132694ab Author: Tzu-ping Chung <[email protected]> AuthorDate: Thu Jun 29 06:09:26 2023 +0800 Add comment to warn off a potential wrong fix (#32230) (cherry picked from commit 73dd48083d1102b81b76ff6f5668cc41261c362e) --- airflow/models/dag.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/airflow/models/dag.py b/airflow/models/dag.py index 331feae28e..479c70524b 100644 --- a/airflow/models/dag.py +++ b/airflow/models/dag.py @@ -869,7 +869,9 @@ class DAG(LoggingMixin): this method only considers ``schedule_interval`` values valid prior to Airflow 2.2. - DO NOT use this method is there is a known data interval. + DO NOT call this method if there is a known data interval. + + :meta private: """ timetable_type = type(self.timetable) if issubclass(timetable_type, (NullTimetable, OnceTimetable, DatasetTriggeredTimetable)): @@ -879,6 +881,12 @@ class DAG(LoggingMixin): end = cast(CronDataIntervalTimetable, self.timetable)._get_next(start) elif issubclass(timetable_type, DeltaDataIntervalTimetable): end = cast(DeltaDataIntervalTimetable, self.timetable)._get_next(start) + # Contributors: When the exception below is raised, you might want to + # add an 'elif' block here to handle custom timetables. Stop! The bug + # you're looking for is instead at when the DAG run (represented by + # logical_date) was created. See GH-31969 for an example: + # * Wrong fix: GH-32074 (modifies this function). + # * Correct fix: GH-32118 (modifies the DAG run creation code). else: raise ValueError(f"Not a valid timetable: {self.timetable!r}") return DataInterval(start, end)
