BasPH commented on code in PR #34851:
URL: https://github.com/apache/airflow/pull/34851#discussion_r1380782947


##########
airflow/config_templates/config.yml:
##########
@@ -2320,6 +2320,16 @@ scheduler:
       type: string
       example: ~
       default: "^[A-Za-z0-9_.~:+-]+$"
+    legacy_cron_data_intervals:
+      description: |
+        Which Timetable to use when a cron string is provided to `schedule` 
argument of
+        a DAG. If True, CronDataIntervalTimetable is used, which is the legacy 
Airflow behavior suitable
+        for DAGs with well-defined data_interval. If False, 
CronTriggerTimetable is used,
+        which is closer to the behavior of cron itself.

Review Comment:
   ```suggestion
       create_cron_intervals:
         description: |
           Whether to create DAG runs that span an interval or one single point 
in time for cron schedules. If
           True, you get contiguous intervals from the end of the previous 
interval up to the scheduled datetime.
           This internally uses the CronDataIntervalTimetable. If False, you 
get intervals with a start and end
           set to the same scheduled datetime. This internally uses the 
CronTriggerTimetable.
   ```
   
   I suggest giving the config a name and description that explains the effect 
on the interval -- to me "legacy Airflow behavior" doesn't tell what the 
difference in behavior is.



##########
airflow/models/dag.py:
##########
@@ -224,8 +225,12 @@ def create_timetable(interval: ScheduleIntervalArg, 
timezone: Timezone) -> Timet
     if isinstance(interval, (timedelta, relativedelta)):
         return DeltaDataIntervalTimetable(interval)
     if isinstance(interval, str):
-        return CronDataIntervalTimetable(interval, timezone)
-    raise ValueError(f"{interval!r} is not a valid interval.")
+        legacy_cron_data_intervals = airflow_conf.get("scheduler", 
"legacy_cron_data_intervals")
+        if legacy_cron_data_intervals:

Review Comment:
   With my first comment, the naming in the code should be updated accordingly.



-- 
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]

Reply via email to