uranusjr commented on code in PR #64571:
URL: https://github.com/apache/airflow/pull/64571#discussion_r3194092917
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/partitioned_dag_runs.py:
##########
@@ -134,32 +199,62 @@ def get_partitioned_dag_runs(
query = query.order_by(AssetPartitionDagRun.created_at.desc())
if not (rows := session.execute(query).all()):
+ if dag_id.value is not None:
+ dag_info = session.execute(
+ select(DagModel.timetable_partitioned).where(DagModel.dag_id
== dag_id.value)
+ ).one_or_none()
+ if dag_info is None:
+ raise HTTPException(status.HTTP_404_NOT_FOUND, f"Dag with id
{dag_id.value} was not found")
return PartitionedDagRunCollectionResponse(partitioned_dag_runs=[],
total=0)
- if dag_id.value is not None:
- results = [_build_response(row, required_count) for row in rows]
- return
PartitionedDagRunCollectionResponse(partitioned_dag_runs=results,
total=len(results))
+ # Load per-Dag timetable + required assets and batch-fetch the log entries
+ # for every APDR in a single query, so total_received uses the rollup-aware
+ # Python computation uniformly across single-Dag and global views. The
+ # alternative (a SQL count subquery) cannot honour rollup windows without
+ # also running the mapper, and silently divergent semantics between
branches
+ # are worse than paying the per-Dag timetable load cost.
+ unique_dag_ids = list({row.target_dag_id for row in rows})
+ dag_timetables_assets: dict[
+ str, tuple[PartitionedAssetTimetable | None, list[AssetNameUri],
dict[int, AssetNameUri]]
+ ] = {did: _load_timetable_and_assets(did, session) for did in
unique_dag_ids}
Review Comment:
Same problem
--
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]