From 32394ac9b959c7657ff28c0484364ede8fdadc8b Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Thu, 7 Nov 2024 15:40:33 +0800 Subject: [PATCH] fix(serialization): serialize both name, uri and group for Asset --- airflow/serialization/serialized_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/serialization/serialized_objects.py b/airflow/serialization/serialized_objects.py index 52b0bcb1530a0..857f0fa2c4fb8 100644 --- a/airflow/serialization/serialized_objects.py +++ b/airflow/serialization/serialized_objects.py @@ -254,7 +254,7 @@ def encode_asset_condition(var: BaseAsset) -> dict[str, Any]: :meta private: """ if isinstance(var, Asset): - return {"__type": DAT.ASSET, "uri": var.uri, "extra": var.extra} + return {"__type": DAT.ASSET, "name": var.name, "uri": var.uri, "group": var.group, "extra": var.extra} if isinstance(var, AssetAlias): return {"__type": DAT.ASSET_ALIAS, "name": var.name} if isinstance(var, AssetAll): @@ -272,7 +272,7 @@ def decode_asset_condition(var: dict[str, Any]) -> BaseAsset: """ dat = var["__type"] if dat == DAT.ASSET: - return Asset(var["uri"], extra=var["extra"]) + return Asset(uri=var["uri"], name=var["name"], group=var["group"], erxtra=var["extra"]) if dat == DAT.ASSET_ALL: return AssetAll(*(decode_asset_condition(x) for x in var["objects"])) if dat == DAT.ASSET_ANY: