Skip to content

Commit

Permalink
Add asset event source from trigger to extra. (#45965)
Browse files Browse the repository at this point in the history
  • Loading branch information
tirkarthi authored Jan 24, 2025
1 parent f871e01 commit d7b750d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions airflow/models/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ def submit_event(cls, trigger_id, event, session: Session = NEW_SESSION) -> None
trigger = session.scalars(select(cls).where(cls.id == trigger_id)).one()
for asset in trigger.assets:
AssetManager.register_asset_change(
asset=asset.to_public(),
session=session,
asset=asset.to_public(), session=session, extra={"from_trigger": True}
)

@classmethod
Expand Down
3 changes: 3 additions & 0 deletions tests/models/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ def test_submit_event(session, create_task_instance):
# Check that the asset has received an event
assert session.query(AssetEvent).filter_by(asset_id=asset.id).count() == 1

event = session.query(AssetEvent).filter_by(asset_id=asset.id).first()
assert event.extra == {"from_trigger": True}


def test_submit_failure(session, create_task_instance):
"""
Expand Down

0 comments on commit d7b750d

Please sign in to comment.