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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]