Kaap10 commented on code in PR #73753:
URL: https://github.com/apache/airflow/pull/73753#discussion_r4111248602
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py:
##########
@@ -172,13 +172,16 @@ def set_asset_state_store(
session: SessionDep,
) -> None:
"""Set an asset state store value. Creates or overwrites the key."""
- _get_db_backend().set_asset_state_store(
- AssetScope(asset_id=asset_id),
- key,
- json.dumps(body.value),
- kind=AssetStateStoreWriterKind.API,
- session=session,
- )
+ try:
+ _get_db_backend().set_asset_state_store(
+ AssetScope(asset_id=asset_id),
+ key,
+ json.dumps(body.value),
+ kind=AssetStateStoreWriterKind.API,
+ session=session,
+ )
+ except ValueError as e:
+ raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST,
detail=str(e)) from e
Review Comment:
Thanks for catching that, with kind=API and no task fields passed,
validate_writer_fields() won't raise a ValueError.
I've reverted the try/except block and test in the latest commit (e6e531e),
which also resolves the OpenAPI schema check in CI.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py:
##########
@@ -172,13 +172,16 @@ def set_asset_state_store(
session: SessionDep,
) -> None:
"""Set an asset state store value. Creates or overwrites the key."""
- _get_db_backend().set_asset_state_store(
- AssetScope(asset_id=asset_id),
- key,
- json.dumps(body.value),
- kind=AssetStateStoreWriterKind.API,
- session=session,
- )
+ try:
+ _get_db_backend().set_asset_state_store(
+ AssetScope(asset_id=asset_id),
+ key,
+ json.dumps(body.value),
+ kind=AssetStateStoreWriterKind.API,
+ session=session,
+ )
+ except ValueError as e:
+ raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST,
detail=str(e)) from e
Review Comment:
Thanks for catching that, with kind=API and no task fields passed,
validate_writer_fields() won't raise a ValueError.
I've reverted the try/except block and test in the latest commit (e6e531e),
which also resolves the OpenAPI schema check in CI.
--
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]