amoghrajesh commented on code in PR #67547:
URL: https://github.com/apache/airflow/pull/67547#discussion_r3309071339
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -87,7 +88,9 @@ def list_task_states(
)
rows = session.execute(paginated).all()
entries = [
- TaskStateResponse(key=r.key, value=r.value, updated_at=r.updated_at,
expires_at=r.expires_at)
+ TaskStateResponse(
+ key=r.key, value=json.loads(r.value), updated_at=r.updated_at,
expires_at=r.expires_at
Review Comment:
Both write paths (task execution and core rest API) guarantee the DB always
contains valid JSON: the execution API does `json.dumps(value)` before storing,
and the Core API PUT does `json.dumps(body.value)` before storing. json.loads
on the read path is always safe.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -87,7 +88,9 @@ def list_task_states(
)
rows = session.execute(paginated).all()
entries = [
- TaskStateResponse(key=r.key, value=r.value, updated_at=r.updated_at,
expires_at=r.expires_at)
+ TaskStateResponse(
+ key=r.key, value=json.loads(r.value), updated_at=r.updated_at,
expires_at=r.expires_at
Review Comment:
Both write paths (task execution and core rest API) guarantee the DB always
contains valid JSON: the execution API does `json.dumps(value)` before storing,
and the Core API PUT does `json.dumps(body.value)` before storing.`json.loads`
on the read path is always safe.
--
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]