amoghrajesh commented on code in PR #67319:
URL: https://github.com/apache/airflow/pull/67319#discussion_r3296191887
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -147,24 +180,51 @@ def set_task_state(
map_index: Annotated[int, Query(ge=-1)] = -1,
) -> None:
"""Set a task state value. Creates or overwrites the key."""
- 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,
+ _require_ti(dag_id, dag_run_id, task_id, map_index, session)
+ expires_at = _resolve_expires_at(body.expires_at)
+ scope = _get_scope(dag_id, dag_run_id, task_id, map_index)
+ try:
+ get_state_backend().set(scope, key, body.value, expires_at=expires_at,
session=session)
+ except ValueError as e:
+ raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
detail=str(e)) from e
+
+
+@task_state_router.patch(
+ "/{key:path}",
+ status_code=status.HTTP_204_NO_CONTENT,
Review Comment:
You are right, checked other PATCH endpoints in the core API and they all
return 200 with the updated resource. Changing it
--
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]