Repository navigation
Closed
Closed
Copy link
Labels
affected_version:3.0Issues Reported for 3.0Issues Reported for 3.0area:corearea:data-aware-schedulingassets, datasets, AIP-48, AIP-76, AIP-74, Asset Partitionsassets, datasets, AIP-48, AIP-76, AIP-74, Asset Partitionsarea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release
Description
Apache Airflow version
3.0.4
If "Other Airflow 2 version" selected, which one?
No response
What happened?
When using dynamic task mapping with asset outlets, if multiple mapped task instances are completed in quick succession (or at the same time) and produce events for the same asset, the downstream asset-triggered DAG does not receive all asset events in the triggering_asset_events context variable.
Context:
- DAG A has a dynamically mapped task with outlets=[Asset("example")]
- When the mapped task expands to 3 instances, each instance creates an AssetEvent upon
completion - DAG B is triggered by Asset("example")
- DAG B is triggered once (expected behavior due to batching events)
- However, triggering_asset_events in DAG B only contains 1 event instead of all 3
- The missing events appear in the NEXT trigger of DAG B with an Asset Event
I think this might occur because:
- Each mapped task instance creates an AssetEvent and an AssetDagRunQueue entry in separate
transactions - The AssetDagRunQueue table has a composite primary key (asset_id, target_dag_id) preventing
duplicates - The scheduler uses MAX(AssetDagRunQueue.created_at) as the cutoff timestamp for which events
to include - Due to transaction timing, not all AssetEvents may be committed before the scheduler
processes the queue
What you think should happen instead?
When DAG B is triggered by multiple asset events from DAG A's mapped tasks, ALL events that caused the trigger should be available in the triggering_asset_events context variable
Or, DAG B should be triggered more than once to "consume" all Asset Events and not wait for another later Asset Event to process the previous ones.
How to reproduce
- Create DAG A with dynamic task mapping:
from airflow.sdk import Asset, task, dag
from datetime import datetime
asset = Asset("s3://bucket/asset_c")
@dag(
start_date=datetime(2024, 1, 1),
schedule="@daily",
catchup=False,
def dag_a():
@task(outlets=[asset])
def produce_asset_event(item):
print(f"Producing event for item {item}")
return {"item": item}
# This creates 3 mapped task instances
produce_asset_event.expand(item=[1, 2, 3])
dag_a()
- Create DAG B triggered by the asset:
from datetime import datetime
@dag(
schedule=[asset]
)
def dag_b():
@task
def consume_events(triggering_asset_events=None):
print(f"Received events: {triggering_asset_events}")
# Count events for asset_c
asset_events = triggering_asset_events[asset]
print(f"Number of events for asset_c: {len(asset_events)}")
consume_events()
dag_b()
Operating System
MacOS 15.5
Versions of Apache Airflow Providers
No response
Deployment
Astronomer
Deployment details
Astro CLI
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
affected_version:3.0Issues Reported for 3.0Issues Reported for 3.0area:corearea:data-aware-schedulingassets, datasets, AIP-48, AIP-76, AIP-74, Asset Partitionsassets, datasets, AIP-48, AIP-76, AIP-74, Asset Partitionsarea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release
Activity
vikrantkumar-max commentedon Aug 19, 2025
Hi , I would like to work on this issue
vikramkoka commentedon Aug 27, 2025
cc: @uranusjr
phanikumv commentedon Sep 16, 2025
Lets not add this for 3.1.0 , as we are very close to the deadline and the review comments need to be addressed.
dipesh747 commentedon Oct 22, 2025
The same issue occurs when multiple upstream dags simultaneously trigger the same downstream dag, even if the Asset which is doing the triggering is different. If it happens in the same timestamp, only one trigger gets picked up.
I would like functionality where one asset run can always trigger one dag regardless of any other concurrency on the schedule.
jgoedeke commentedon Oct 29, 2025
potiuk commentedon Mar 2, 2026
@vikrantkumar-max We are unassigning you from this issue as part of our updated assignment policy.
This is not meant to discourage your contribution — quite the opposite! You are still very welcome to work on this issue and submit a PR for it. Simply comment that you are working on it and open a PR when ready.
We found that formal assignments were not working well, as they often prevented others from contributing when the assignee was not actively working on the issue.
Vamsi-klu commentedon Aug 23, 2026
Pin mapped outlet asset events in scheduler consume tests
Address review feedback for mapped outlet consume tests
Assert triggering_asset_events on mapped consume-all runs
uranusjr commentedon Sep 1, 2026
This was fixed as a side effect of #70972 changing ADRQ’s PK from (asset_id, target_dag_id) to (target_dag_id, asset_event_id). There’s a long chain of reasons behind the change, but for this issue specifically only the end result is important.