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


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -262,7 +262,7 @@ def create_backfill(
     except (
         InvalidReprocessBehavior,
         InvalidBackfillDirection,
-        DagNoScheduleException,
+        DagNonPeriodicScheduleException,
         InvalidBackfillDate,
     ) as e:

Review Comment:
   `_create_backfill` can raise `DagRunTypeNotAllowed` (and the dry-run route 
now handles it), but `create_backfill` does not appear to catch it here, which 
can result in an unhandled exception and an incorrect HTTP response 
(potentially a 500). Add a handler for `DagRunTypeNotAllowed` in 
`create_backfill` (either in this tuple or as a dedicated `HTTPException` like 
dry-run) to keep behavior consistent.



##########
airflow-core/src/airflow/models/backfill.py:
##########
@@ -68,9 +68,16 @@ class AlreadyRunningBackfill(AirflowException):
     """
 
 
-class DagNoScheduleException(AirflowException):
+class DagNonPeriodicScheduleException(AirflowException):
     """
-    Raised when attempting to create backfill for a Dag with no schedule.
+    Raised when attempting to backfill a Dag whose schedule is fundamentally 
incompatible with backfills.
+
+    This covers the following timetables types:

Review Comment:
   Fix grammar: change 'timetables types' to 'timetable types'.



##########
airflow-core/src/airflow/cli/commands/dag_command.py:
##########
@@ -275,6 +276,8 @@ def _get_dagbag_dag_details(dag: DAG) -> dict:
         "next_dagrun_logical_date": None,
         "next_dagrun_run_after": None,
         "allowed_run_types": dag.allowed_run_types,
+        "is_backfillable": core_timetable.periodic
+        and (dag.allowed_run_types is None or "backfill" in 
dag.allowed_run_types),

Review Comment:
   `dag.allowed_run_types` is used elsewhere as a list of `DagRunType` enums 
(e.g., `DagRunType.BACKFILL_JOB`). Checking for the string `"backfill"` will 
evaluate to `False` if the list contains enums, causing `is_backfillable` to be 
wrong in CLI output. Use the same enum membership check pattern as in the API 
model/backfill logic (i.e., check for `DagRunType.BACKFILL_JOB`), or explicitly 
normalize `allowed_run_types` to strings before membership tests.



##########
airflow-core/src/airflow/ui/public/i18n/locales/en/components.json:
##########
@@ -13,6 +13,7 @@
     "permissionDenied": "Dry Run Failed: User does not have permission to 
create backfills.",
     "reprocessBehavior": "Reprocess Behavior",
     "run": "Run Backfill",
+    "scheduleNotBackfillable": "This Dag's schedule does not support 
backfills",

Review Comment:
   In English UI copy, 'DAG' should be capitalized consistently (currently 
'Dag'). This also helps keep the string consistent with other locales in this 
PR.



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