kaxil commented on code in PR #67835:
URL: https://github.com/apache/airflow/pull/67835#discussion_r3337262869
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -272,4 +272,4 @@ def clear_task_state(
the ``map_index`` parameter is ignored.
"""
scope = _get_scope(dag_id, dag_run_id, task_id, map_index)
- get_state_backend().clear(scope, all_map_indices=all_map_indices,
session=session)
+ _db_backend.clear(scope, all_map_indices=all_map_indices, session=session)
Review Comment:
This clear route is now DB-direct, but `_clear_task_state_on_success` in
`services/public/task_instances.py:66` (run from the PATCH task-instance routes
when `clear_on_success` is enabled) still clears through `get_state_backend()`.
With a custom configured backend that path clears the custom store while these
routes clear the DB. Is leaving it on the configurable backend intended, or
should it be DB-direct like the routes here?
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -227,9 +229,7 @@ def patch_task_state(
)
scope = _get_scope(dag_id, dag_run_id, task_id, map_index)
- get_state_backend().set(
- scope, key, json.dumps(body.value), expires_at=existing.expires_at,
session=session
- )
+ _db_backend.set(scope, key, json.dumps(body.value),
expires_at=existing.expires_at, session=session)
Review Comment:
This is the line the PR fixes: patch used to read `existing.expires_at` from
the DB but write back through `get_state_backend()`. Nothing in
`test_task_state.py` asserts these routes bypass a custom configured backend,
so the mixed-backend behavior could regress silently. Pointing
`state_store.backend` at a spy and asserting it's never called would lock the
fix in.
--
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]