Copilot commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3030020364


##########
airflow-core/src/airflow/models/backfill.py:
##########
@@ -284,11 +290,10 @@ def _do_dry_run(
     dag = serdag.dag
     _validate_backfill_params(dag, reverse, from_date, to_date, 
reprocess_behavior)
 
-    no_schedule = session.scalar(
-        select(func.count()).where(DagModel.timetable_summary == "None", 
DagModel.dag_id == dag_id)
-    )
-    if no_schedule:
-        raise DagNoScheduleException(f"{dag_id} has no schedule")
+    if not dag.timetable.periodic:
+        raise DagNonPeriodicScheduleException(
+            f"{dag_id} has a non-periodic schedule that does not support 
backfills"
+        )

Review Comment:
   In `_do_dry_run`, the non-periodic schedule check happens *after* 
`_validate_backfill_params`, but `_create_backfill` checks 
`dag.timetable.periodic` *before* validating dates/depends_on_past. This can 
lead to inconsistent error responses between dry-run and create for the same 
DAG (e.g., dry-run returning InvalidBackfillDate instead of the non-periodic 
schedule error). Consider moving the `dag.timetable.periodic` check before 
`_validate_backfill_params` here to match `_create_backfill` and keep API 
behavior consistent.



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