amoghrajesh commented on code in PR #67902:
URL: https://github.com/apache/airflow/pull/67902#discussion_r3350489663
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_store.py:
##########
@@ -35,15 +35,39 @@
from fastapi import HTTPException, Query, status
from sqlalchemy import select
-from airflow._shared.state import AssetScope
+from airflow._shared.state import AssetScope, AssetStoreWriterKind
from airflow.api_fastapi.common.db.common import SessionDep
from airflow.api_fastapi.execution_api.datamodels.asset_store import (
AssetStorePutBody,
AssetStoreResponse,
)
-from airflow.api_fastapi.execution_api.security import ExecutionAPIRoute
+from airflow.api_fastapi.execution_api.datamodels.token import TIToken
+from airflow.api_fastapi.execution_api.security import CurrentTIToken,
ExecutionAPIRoute
from airflow.models.asset import AssetModel
+from airflow.models.taskinstance import TaskInstance
from airflow.state import get_state_backend
+from airflow.state.metastore import MetastoreStoreBackend
+
+_TIWriterFields = tuple[str, str, str, int]
+
+
+def _fetch_ti_writer_fields(token: TIToken, session: SessionDep) ->
_TIWriterFields:
+ """Return (dag_id, run_id, task_id, map_index) for the TI identified by
the token."""
+ row = session.execute(
+ select(
+ TaskInstance.dag_id,
+ TaskInstance.run_id,
+ TaskInstance.task_id,
+ TaskInstance.map_index,
+ ).where(TaskInstance.id == token.id)
+ ).one_or_none()
+ if row is None:
+ raise HTTPException(
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
Review Comment:
Fixed 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]