amoghrajesh commented on code in PR #66859: URL: https://github.com/apache/airflow/pull/66859#discussion_r3271770408
########## shared/state/src/airflow_shared/state/__init__.py: ########## @@ -47,9 +47,21 @@ class TaskScope: @dataclass(frozen=True) class AssetScope: - """Identifies the state namespace for an asset.""" + """ + Identifies the state namespace for an asset. + + Server-side backends receive ``asset_id``. Worker-side backends receive ``name`` or ``uri`` + since workers do not have access to the integer ``asset_id``. + + Note: ``name`` and ``uri`` are not guaranteed to be unique over time — if an asset is + deactivated and a new one created with the same name, both share the same ``name`` value. + State for inactive assets is cleaned up by the orphan GC pass; until then, stale rows exist + in the DB but cannot be written to (the Execution API resolver filters to active assets only). + """ - asset_id: int + asset_id: int | None = None Review Comment: Nice catch, added a __post_init__ validation to AssetScope that raises ValueError if none of asset_id, name, or uri is set. -- 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]
