pierrejeambrun commented on code in PR #71441:
URL: https://github.com/apache/airflow/pull/71441#discussion_r3765718398
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py:
##########
@@ -377,8 +378,19 @@ def get_asset_events(
# dependency-applied timeout is still active.
assets_events = session.scalars(assets_event_select).all()
+ # An asset event is linked to every dag run that consumed it, so a run
that consumed several
+ # events would otherwise appear as "triggered" on each one. Only a run's
most recent consumed
+ # event actually triggers it; the rest were merely included.
+ triggering_event_id_by_run = resolve_triggering_event_ids(assets_events,
session=session)
+ asset_event_responses = []
+ for event in assets_events:
+ event_response = AssetEventResponse.model_validate(event)
+ for reference, dag_run in zip(event_response.created_dagruns,
event.created_dagruns):
+ reference.triggering = triggering_event_id_by_run.get(dag_run.id)
== event.id
Review Comment:
Done
--
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]