guan404ming commented on code in PR #61398:
URL: https://github.com/apache/airflow/pull/61398#discussion_r2792291316


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/partitioned_dag_runs.py:
##########
@@ -0,0 +1,236 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from fastapi import Depends, HTTPException, status
+from sqlalchemy import exists, func, select
+
+from airflow.api_fastapi.common.db.common import SessionDep, 
apply_filters_to_select
+from airflow.api_fastapi.common.parameters import (
+    QueryPartitionedDagRunDagIdFilter,
+    QueryPartitionedDagRunPendingFilter,
+)
+from airflow.api_fastapi.common.router import AirflowRouter
+from airflow.api_fastapi.core_api.datamodels.ui.partitioned_dag_runs import (
+    PartitionedDagRunAssetResponse,
+    PartitionedDagRunCollectionResponse,
+    PartitionedDagRunDetailResponse,
+    PartitionedDagRunResponse,
+)
+from airflow.api_fastapi.core_api.security import requires_access_asset, 
requires_access_dag
+from airflow.models import DagModel
+from airflow.models.asset import (
+    AssetModel,
+    AssetPartitionDagRun,
+    DagScheduleAssetReference,
+    PartitionedAssetKeyLog,
+)
+from airflow.models.dagrun import DagRun
+
+partitioned_dag_runs_router = AirflowRouter(tags=["PartitionedDagRun"])
+
+
+def _build_response(row, required_count: int) -> PartitionedDagRunResponse:
+    return PartitionedDagRunResponse(
+        id=row.id,
+        dag_id=row.target_dag_id,
+        partition_key=row.partition_key,
+        created_at=row.created_at.isoformat() if row.created_at else None,
+        total_received=row.total_received or 0,
+        total_required=required_count,
+        state=row.dag_run_state if row.created_dag_run_id else "pending",
+        created_dag_run_id=row.dag_run_id,
+    )
+
+
+@partitioned_dag_runs_router.get(
+    "/partitioned_dag_runs",
+    dependencies=[Depends(requires_access_asset(method="GET"))],
+)
+def get_partitioned_dag_runs(
+    session: SessionDep,
+    dag_id: QueryPartitionedDagRunDagIdFilter,
+    pending: QueryPartitionedDagRunPendingFilter,

Review Comment:
   I renamed it from `pending` to `has_created_dag_run_id`. Please let me know 
if there is better option, thanks!



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