You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Dev-iL (via GitHub)" <gi...@apache.org> on 2026/04/02 19:37:15 UTC
[PR] Add `is_backfillable` property to DAG API responses [airflow]
Dev-iL opened a new pull request, #64644:
URL: https://github.com/apache/airflow/pull/64644
## Context
Currently, when attempting to backfill a Dag that has an Asset schedule, after going to the backfill section in the trigger form and choosing dates we get an error saying: "No runs matching selected criteria." (on 2.11 it says "No run dates were found for the given dates and dag interval."). This is confusing UX-wise: instead of being shown right from the start (because it is tied to how the Dag is configured), it appears only after the user selects a date range. This sequence of events implies causality between the user's choice and the error - which is not true.
## Summary
- Adds a computed `is_backfillable` boolean field to `DAGResponse`, `DAGDetailsResponse`, and `DAGWithLatestDagRunsResponse` that indicates whether a DAG's schedule supports backfilling.
- Replaces the backend's string-based `timetable_summary == "None"` check with a proper `timetable.periodic` check, catching all non-periodic schedules (`@once`, `@continuous`, asset-triggered, partitioned asset) — not just unscheduled DAGs.
- Renames `DagNoScheduleException` to `DagNonPeriodicScheduleException` to reflect the broader validation.
- Updates the UI to use the new `is_backfillable` field instead of the `hasSchedule` heuristic, so the Backfill option is correctly disabled for all non-periodic DAGs.
<img width="911" height="550" alt="image" src="https://github.com/user-attachments/assets/824a4ee9-32c1-4523-9c85-142ae4dbee0b" />
## Changes
**API / Models:**
- `DAGResponse.is_backfillable` — computed field based on `timetable_summary` not being in `{None, @once, @continuous, Asset, Partitioned Asset}`.
- `backfill.py` — both `_create_backfill` and `_do_dry_run` now check `dag.timetable.periodic` instead of comparing `timetable_summary` to `"None"`.
- Renamed `DagNoScheduleException` → `DagNonPeriodicScheduleException`.
**UI:**
- `TriggerDAGModal.tsx` uses `is_backfillable` to gate the Backfill radio option.
- Updated i18n strings (removed stale `tooltip` key, added `scheduleNotBackfillable`).
**Tests:**
- New `TestIsBackfillable` parametrized tests for the datamodel computed field.
- New `test_create_backfill_non_periodic_schedule_rejected` and `test_do_dry_run_non_periodic_schedule_rejected` tests covering `@once`, `@continuous`, `None`, and asset schedules.
- Updated existing `test_no_schedule_dag` to use `schedule=None` instead of `schedule="None"`.
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3056969897
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
Review Comment:
Done. The string-matching approach (`_NON_BACKFILLABLE_SUMMARIES` frozenset) has been replaced entirely:
- **Migration 0111** adds a `timetable_periodic` Boolean column to the `dag` table (same pattern as `timetable_partitioned` — `server_default="0"`, `nullable=False`).
- **`collection.py`** sets `dm.timetable_periodic = dag.timetable.periodic` during DAG sync, right next to `timetable_partitioned`.
- **`DAGResponse.is_backfillable`** now reads from `self.timetable_periodic` (the DB column) instead of string-matching `timetable_summary`. This means custom timetables that set `periodic = False` are handled correctly.
- The backend checks in `_do_dry_run` and `_create_backfill` continue to use `dag.timetable.periodic` from the serialized DAG directly — both derive from the same source.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3056969897
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
Review Comment:
Added migration 111 that introduces the `timetable_periodic` column.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3052650929
##########
uv.lock:
##########
Review Comment:
Right; had to be done to get a green CI...
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #64644:
URL: https://github.com/apache/airflow/pull/64644
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3052650929
##########
uv.lock:
##########
Review Comment:
Right; had to be done to get a green CI; should be gone after a rebase.
##########
uv.lock:
##########
Review Comment:
Right - had to be done to get a green CI; should be gone after a rebase.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3052753951
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
+
+ # Mypy issue https://github.com/python/mypy/issues/1362
+ @computed_field # type: ignore[prop-decorator]
+ @property
+ def is_backfillable(self) -> bool:
+ """Whether this DAG's schedule supports backfilling."""
+ return self.timetable_summary not in self._NON_BACKFILLABLE_SUMMARIES
Review Comment:
Correct me if I am wrong but I think this can be confusing given also `allowed_run_types` which was added in https://github.com/apache/airflow/pull/61833/
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3057036594
##########
airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx:
##########
@@ -72,6 +72,7 @@ const TriggerDAGModal: React.FC<TriggerDAGModalProps> = ({
},
);
+ const isBackfillable = dag?.is_backfillable ?? false;
const hasSchedule = dag?.timetable_summary !== null;
Review Comment:
`hasSchedule` is still needed as it serves a different purpose. It's passed to `TriggerDAGForm` (line 144) where it controls whether the data interval date pickers are shown in single-run trigger mode. A Dag with `@once` or `@continuous` schedule still has a schedule (so `hasSchedule = true`, data interval pickers shown), but isn't backfillable (`isBackfillable = false`, backfill radio card disabled).
In short: `hasSchedule` = "does this DAG have any schedule at all?" (controls data interval UI), `isBackfillable` = "can this DAG be backfilled?" (controls backfill radio card).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3073490838
##########
airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx:
##########
@@ -120,10 +121,13 @@ const TriggerDAGModal: React.FC<TriggerDAGModalProps> = ({
label={translate("triggerDag.selectLabel")}
value={RunMode.SINGLE}
/>
- <Tooltip content={translate("backfill.tooltip")} disabled={hasSchedule}>
+ <Tooltip
+ content={translate("backfill.scheduleNotBackfillable")}
+ disabled={isBackfillable}
+ >
Review Comment:
Small displaying issue for the tooltip
<img width="1074" height="386" alt="Image" src="https://github.com/user-attachments/assets/6b880566-d785-4c67-9f31-997ec1e8b759" />
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3077041852
##########
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:
Done — switched to `DagRunType.BACKFILL_JOB` and added a focused parametrized test for the `is_backfillable` computation in `_get_dagbag_dag_details`.
##########
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:
Fixed.
##########
airflow-core/src/airflow/ui/public/i18n/locales/ca/components.json:
##########
@@ -13,6 +13,7 @@
"permissionDenied": "Execució de prova fallida: l'usuari no té permís per crear reompliments.",
"reprocessBehavior": "Comportament de reprocessament",
"run": "Executar reompliment",
+ "scheduleNotBackfillable": "This DAG's schedule does not support backfills",
Review Comment:
Done — removed `scheduleNotBackfillable` from all 20 non-English locale files.
##########
airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx:
##########
@@ -120,10 +121,13 @@ const TriggerDAGModal: React.FC<TriggerDAGModalProps> = ({
label={translate("triggerDag.selectLabel")}
value={RunMode.SINGLE}
/>
- <Tooltip content={translate("backfill.tooltip")} disabled={hasSchedule}>
+ <Tooltip
+ content={translate("backfill.scheduleNotBackfillable")}
+ disabled={isBackfillable}
+ >
Review Comment:
Fixed — added the `portalled` prop to the Tooltip so it renders via a Portal at the document root, escaping the stacking context. This matches the convention used by other Tooltips in the codebase (TaskInstanceTooltip, VersionIndicator, PanelButtons, RunTypeLegend).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3073396265
##########
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:
+1 for this, we should use the enum I believe.
##########
airflow-core/src/airflow/ui/public/i18n/locales/ca/components.json:
##########
@@ -13,6 +13,7 @@
"permissionDenied": "Execució de prova fallida: l'usuari no té permís per crear reompliments.",
"reprocessBehavior": "Comportament de reprocessament",
"run": "Executar reompliment",
+ "scheduleNotBackfillable": "This DAG's schedule does not support backfills",
Review Comment:
Remove all translation for all languages please. Just keep the one for `en/components.json` other translation owners will do the extra translation later, let's not delay this PR over translation.
##########
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:
Irelevant, marking as resolved, catch is done right above.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3073690477
##########
airflow-core/src/airflow/ui/public/i18n/locales/ca/components.json:
##########
@@ -13,6 +13,7 @@
"permissionDenied": "Execució de prova fallida: l'usuari no té permís per crear reompliments.",
"reprocessBehavior": "Comportament de reprocessament",
"run": "Executar reompliment",
+ "scheduleNotBackfillable": "This DAG's schedule does not support backfills",
Review Comment:
Hmm I thought I got rid of all of these... I guess not. Good catch!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3073703916
##########
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:
Ignoring since "Dag" is the agreed capitalization.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3051432724
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
Review Comment:
It's still better than the current null table matching only. But will hold problems for custom timetables.
##########
uv.lock:
##########
Review Comment:
That seems unrelated to the PR.
##########
airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx:
##########
@@ -72,6 +72,7 @@ const TriggerDAGModal: React.FC<TriggerDAGModalProps> = ({
},
);
+ const isBackfillable = dag?.is_backfillable ?? false;
const hasSchedule = dag?.timetable_summary !== null;
Review Comment:
Is `hasSchedule` still needed? Or should we use `isBackfillable` now?
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
Review Comment:
This will diverge from the `.periodic` attribute (what access here in the API i.e timetable_summary vs the `timetable.periodic`). Is it possible similarly to the `timetable_partitioned` to store that in the `DagModel` via a migration ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3057049362
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -128,6 +128,17 @@ def get_timetable_summary(cls, tts: str | None) -> str | None:
return None
return str(tts)
+ _NON_BACKFILLABLE_SUMMARIES: frozenset[str | None] = frozenset(
+ {None, "@once", "@continuous", "Asset", "Partitioned Asset"}
+ )
+
+ # Mypy issue https://github.com/python/mypy/issues/1362
+ @computed_field # type: ignore[prop-decorator]
+ @property
+ def is_backfillable(self) -> bool:
+ """Whether this DAG's schedule supports backfilling."""
+ return self.timetable_summary not in self._NON_BACKFILLABLE_SUMMARIES
Review Comment:
Addressed as follows: `is_backfillable` now unifies both concerns into a single source of truth for the UI:
```python
@computed_field
@property
def is_backfillable(self) -> bool:
if not self.timetable_periodic:
return False
if self.allowed_run_types is not None and DagRunType.BACKFILL_JOB not in self.allowed_run_types:
return False
return True
```
So `is_backfillable` is `False` when:
1. The schedule is non-periodic (asset-triggered, `@once`, `@continuous`, no-schedule), **OR**
2. `allowed_run_types` explicitly excludes `BACKFILL_JOB`
The UI only needs to check `is_backfillable` (it doesn't need to reason about both `timetable_periodic` and `allowed_run_types` separately). The backend also checks both: `_do_dry_run` now validates `allowed_run_types` (it previously only checked this in `_create_backfill`), so dry-run and create are 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `is_backfillable` property to DAG API responses [airflow]
Posted by "Dev-iL (via GitHub)" <gi...@apache.org>.
Dev-iL commented on code in PR #64644:
URL: https://github.com/apache/airflow/pull/64644#discussion_r3030403958
##########
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:
Fixed.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org