jason810496 commented on code in PR #70983:
URL: https://github.com/apache/airflow/pull/70983#discussion_r3721190925


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py:
##########
@@ -22,6 +22,7 @@
 
 from fastapi import Depends, HTTPException, Query, status
 from sqlalchemy import select
+from sqlalchemy.orm import Session

Review Comment:
   This should be imported under type checking only block.



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py:
##########
@@ -72,35 +128,16 @@ def _resolve_expires_at(expires_at: datetime | None | 
Literal["default"]) -> dat
     return expires_at
 
 
-def _require_ti(dag_id: str, dag_run_id: str, task_id: str, map_index: int, 
session: SessionDep) -> None:
-    ti_exists = session.scalar(
-        select(TI.task_id).where(
-            TI.dag_id == dag_id,
-            TI.run_id == dag_run_id,
-            TI.task_id == task_id,
-            TI.map_index == map_index,
-        )
-    )
-    if ti_exists is None:
-        raise HTTPException(
-            status_code=status.HTTP_404_NOT_FOUND,
-            detail=f"Task instance not found for dag_id={dag_id!r}, 
run_id={dag_run_id!r}, task_id={task_id!r}, map_index={map_index}",
-        )
-
-
 @task_state_store_router.get(
     "",
     responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
     dependencies=[Depends(requires_access_dag(method="GET", 
access_entity=DagAccessEntity.TASK_INSTANCE))],
 )
 def list_task_state_store(
-    dag_id: str,
-    dag_run_id: str,
-    task_id: str,
+    scope: TaskScopeDep,

Review Comment:
   However, for the list endpoint, we will check the unnecessary TI rows now.



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py:
##########
@@ -142,12 +179,9 @@ def list_task_state_store(
     dependencies=[Depends(requires_access_dag(method="GET", 
access_entity=DagAccessEntity.TASK_INSTANCE))],
 )
 def get_task_state_store(
-    dag_id: str,
-    dag_run_id: str,
-    task_id: str,
+    scope: TaskScopeDep,

Review Comment:
   Ditto.



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