amoghrajesh commented on issue #75352:
URL: https://github.com/apache/airflow/issues/75352#issuecomment-7031518005

   Hey @vincbeck @seanghaeli @jroachgolf84, I thought about this a bit more 
today, and I am still aligned with the approach in #75521, with one 
simplification that I have in mind.
   
   My proposal is a state store accessor used only by the triggerer:
   
   - `set` and `delete` write to every asset the trigger watches.
   - `get` returns the value from the first asset (sorted by name) that has the 
key.
   - `clear` still needs exactly one asset, so it doesn't remove keys that 
tasks wrote.
   - Tasks keep the current accessor and the current error. For a task, two 
assets really do hold different state, so the error is correct there but not 
here.
   
   Trigger code doesn't change. `S3KeyUpdateTrigger` in #74293 works as is, and 
the Kinesis and Iceberg triggers can drop their `except ValueError` fallbacks.
   
   Ok coming to the important part: why not the other options ....?
   
   - **`get` only when all assets agree:** a newly linked asset starts empty, 
so the assets will never agree. `get` returns the default, and the trigger 
fires again for a change it already reported.
   - **Tell the trigger which assets it watches:** the triggerer already has 
the list today, and it is quite easy to build. But every copy holds the same 
value, so there is nothing to choose between. Each trigger author would end up 
writing "pick the first one", which is this fix copied into every provider for 
not much value.
   - **Don't share triggers that use the store:** we would poll the same source 
twice, and Airflow would need to know ahead of time which triggers use the 
store.
   - **One store per trigger:** I see the appeal honestly, since an etag 
describes the s3 object, not the asset. Although what holds me back is:
     1. The asset state store concept has a promise that "Values written by the 
trigger are visible to any task that declares `my_asset` as an inlet or outlet, 
and vice versa." Keeping state on the trigger does not seem right and is 
overkill for a not-very-generic use case.
     2. A trigger's identity is the hash of its classpath and kwargs. If one 
kwarg changes, we get a new trigger row and the state is lost. Asset names 
survive those edits.
   
     And to add - it also is a schema change. If we still want state scoped to 
the trigger, maybe lets take it up as its own design discussion and not block 
this bug on it.
   


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