vincbeck commented on code in PR #75521:
URL: https://github.com/apache/airflow/pull/75521#discussion_r4741776800


##########
airflow-core/docs/core-concepts/asset-state-store.rst:
##########
@@ -168,9 +168,15 @@ Calling the synchronous 
``get``/``set``/``delete``/``clear`` from inside an ``as
 Using ``asset_state_store`` inside a Watcher Trigger
 -----------------------------------------------------
 
-:class:`~airflow.triggers.base.BaseEventTrigger` subclasses (watcher triggers) 
can read and write asset state store directly from within ``run()``. The 
triggerer injects ``self.asset_state_store`` before ``run()`` is called, scoped 
to the asset the trigger is watching. It is not available during ``__init__`` 
or ``serialize()``, only access it from within ``run()``.
+:class:`~airflow.triggers.base.BaseEventTrigger` subclasses (watcher triggers) 
can read and write asset state store directly from within ``run()``. The 
triggerer injects ``self.asset_state_store`` before ``run()`` is called, scoped 
to the asset or assets this trigger watches. It is not available during 
``__init__`` or ``serialize()``, only access it from within ``run()``.
 
-Unlike task-based access (where the asset is identified by an inlet or outlet 
declaration), the accessor in a watcher trigger is automatically bound to the 
watched asset, so no subscripting is needed.
+Unlike task-based access (where the asset is identified by an inlet or outlet 
declaration), the accessor in a watcher trigger is automatically bound to the 
watched assets, so no subscripting is needed.
+
+Watchers on several assets that use the same trigger class and arguments share 
one trigger. The accessor then covers all of those assets: ``set`` and 
``delete`` apply to every one of them, and ``get`` returns the value from the 
first asset (by name) that holds the key. ``clear`` still needs exactly one 
asset, because it would also remove keys that tasks wrote, so a shared trigger 
should ``delete`` its own keys instead. Tasks and other triggers can use the 
same assets, so include what the trigger watches in the key name.

Review Comment:
   I also think we should have one asset store per trigger and not per asset



-- 
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]

Reply via email to