uranusjr commented on a change in pull request #17414:
URL: https://github.com/apache/airflow/pull/17414#discussion_r698308122
##########
File path: airflow/models/dag.py
##########
@@ -92,11 +91,34 @@
log = logging.getLogger(__name__)
-ScheduleInterval = Union[str, timedelta, relativedelta]
DEFAULT_VIEW_PRESETS = ['tree', 'graph', 'duration', 'gantt', 'landing_times']
ORIENTATION_PRESETS = ['LR', 'TB', 'RL', 'BT']
+ScheduleIntervalArgNotSet = type("ScheduleIntervalArgNotSet", (), {})
+
DagStateChangeCallback = Callable[[Context], None]
+ScheduleInterval = Union[str, timedelta, relativedelta]
+ScheduleIntervalArg = Union[ScheduleInterval, None,
Type[ScheduleIntervalArgNotSet]]
+
+
+# Backward compatibility: If neither schedule_interval nor timetable is
+# *provided by the user*, default to a one-day interval.
+DEFAULT_SCHEDULE_INTERVAL = timedelta(days=1)
+
+
+def create_timetable(interval: ScheduleIntervalArg, timezone: tzinfo) ->
Timetable:
+ """Create a Timetable instance from a ``schedule_interval`` argument."""
+ if interval is ScheduleIntervalArgNotSet:
+ return DeltaDataIntervalTimetable(DEFAULT_SCHEDULE_INTERVAL)
Review comment:
`DEFAULT_SCHEDULE_INTERVAL` is also used to provide a default value for
`DAG.schedule_interval` (see comment below for explaination)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]