Skip to content

Consume every queued asset event from concurrent mapped outlets - #71994

Closed
Vamsi-klu wants to merge 2 commits into
apache:mainfrom
Vamsi-klu:pr1/54659-mapped-outlet-events
Closed

Consume every queued asset event from concurrent mapped outlets#71994
Vamsi-klu wants to merge 2 commits into
apache:mainfrom
Vamsi-klu:pr1/54659-mapped-outlet-events

Conversation

@Vamsi-klu

@Vamsi-klu Vamsi-klu commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

closes: #54659

GitHub still lists a few other pull requests under This was referenced. I named them in an early draft of this writeup and then deleted those lines. GitHub keeps the timeline row even after the text is gone. Those pull requests are not part of this change. The only real link is the issue this PR is meant to fix.

What I did

Tests only. Mapped producer @task(outlets=[asset]).expand(...) succeeds, then one scheduler tick. Assert all N events land on the consumer run and in triggering_asset_events. No production change. No newsfragment.

Why I did

Three mapped outlets were finishing together and the consumer only saw a subset in triggering_asset_events. Consume-by-event-id is already on main. Existing tests still insert ADRQ by hand, so they never covered this emit path.

How I did

Emit: dag_maker.run_ti(..., map_index=N)register_asset_changes_in_db.
Consume: SchedulerJobRunner._create_dagruns_for_dags.
Context: get_template_context after loading consumed_asset_events.

One tick batches all visible events. That is the default, not a bug. Leftovers stay for the next tick.

What's the impact

None at runtime. If the mapped emit path regresses, these tests fail instead of silently dropping events.

What's the testing

airflow-core/tests/unit/jobs/test_scheduler_job.py

  • test_mapped_outlet_asset_events_consumed_in_one_tick
  • test_mapped_outlet_asset_events_consumed_across_staggered_ticks
  • test_mapped_outlet_asset_events_same_timestamp_are_all_consumed
  • test_mapped_outlet_asset_events_and_condition_waits_for_all_assets
  • test_mapped_outlet_asset_alias_events_are_all_consumed
uv run --project airflow-core pytest airflow-core/tests/unit/jobs/test_scheduler_job.py \
  -k test_mapped_outlet -q

Was generative AI tooling used to co-author this PR?
  • Yes (Grok 4.6)

Generated-by: Grok 4.6 following the guidelines

apache#70972 already consumes queued asset events by id, so concurrent mapped
outlets no longer strand events behind a timestamp watermark. These
tests lock that contract for mapped producers so a later consume-path
change cannot silently drop events from triggering_asset_events.

closes: apache#54659
The same-timestamp and AND cases only pinned consume if events were
already queued by hand. Running mapped TIs through register/queue
keeps those pins on the user path, including alias context lookup.

closes: apache#54659

@Vamsi-klu Vamsi-klu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description review:

  • closes: #54659 is correct.
  • Tests-only is stated; no newsfragment is correct.
  • Default batching in one tick is called out as intended, not a bug.
  • Test names and the pytest command match the diff.

Ready for maintainer review.


Drafted-by: Cursor Grok 4.6 (no human review before posting)

@Vamsi-klu

Vamsi-klu commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

The extra pull requests under This was referenced are leftover from an earlier draft of the description. I put those names in, then took them out. GitHub keeps the timeline row anyway. Nothing in this PR depends on them. The only real link is the issue this PR is meant to fix.


Drafted-by: Cursor Grok 4.6

@Vamsi-klu Vamsi-klu closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asset-triggered DAGs miss events from concurrently completing dynamic mapped tasks

1 participant