jroachgolf84 commented on code in PR #66595:
URL: https://github.com/apache/airflow/pull/66595#discussion_r3328722116
##########
airflow-core/src/airflow/triggers/base.py:
##########
@@ -297,6 +299,13 @@ class BaseEventTrigger(BaseTrigger):
supports_triggerer_queue: bool = False
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+ # Injected by the triggerer before run() is called; mirrors how
trigger_id is set
+ self.watched_assets: list[AssetUniqueKey] | None = None
+ self.asset_states: AssetStateAccessors | None = None
Review Comment:
I guess the only downside of this is that we've almost come full circle to
having to pass an `Asset` into a `BaseEventTrigger`. Since the
`AccessStateAccessors` object is subscripted by an `Asset`, the syntax would
need to look like this:
```python
...
async def run():
my_asset = Asset("my_asset")
my_asset_state = self.asset_state[my_asset]
...
```
Is this something that we want? I'd prefer not to have to create an `Asset`
in the `BaseEventTrigger` just to use its state. But as I type this, I'm
realizing that it's very, very, very likely that we wouldn't need to subscript
`self.asset_state` (since there will only be a single `Asset` that the
`BaseEventTrigger` is watching.
So I think we're okay :)
--
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]