imrichardwu commented on code in PR #70804:
URL: https://github.com/apache/airflow/pull/70804#discussion_r3691494185
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/deadlines.py:
##########
@@ -177,6 +177,7 @@ def get_dag_deadline_alerts(
select(SerializedDagModel)
.where(SerializedDagModel.dag_id == dag_id)
.order_by(SerializedDagModel.id.desc())
+ .limit(1)
Review Comment:
I had the same question at first, but I think this is a separate concern.
This endpoint has always fetched the latest serialized DAG. Even before this
PR, it queried serialized_dag ordered by descending ID and passed the result to
session.scalar(), which returned the first row. The only thing this PR changes
is adding .limit(1), which tells the database to stop after finding that first
row instead of materializing the entire result set. The selected DAG version is
exactly the same.
Historical-version backfills are already supported, but through a different
mechanism. That behavior predates this PR (introduced in
[#52177](https://github.com/apache/airflow/pull/52177)). The backfill CLI
exposes --run-on-latest-version (and its inverse), and the final behavior is
resolved from the run or global configuration. That's run-level version
selection.
This endpoint is different. It's DAG-level and doesn't receive a DAG run or
version identifier, so it has no way to know which historical serialized DAG it
should use.
If we want deadline alerts to reflect the DAG definition for a specific
historical run, that would require a separate, version-aware API change. I
think that's a worthwhile discussion, but it's orthogonal to this PR. This
change is purely a performance optimization and doesn't change the existing
semantics.
--
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]