Repository navigation
Emit OpenLineage events for asset watcher asset events - #76773
Draft
kacpermuda wants to merge 8 commits into
Draft
kacpermuda wants to merge 8 commits into
kacpermuda wants to merge 8 commits into
Conversation
This was referenced Nov 12, 2026
kacpermuda
force-pushed
the
ol-asset-watcher-events
branch
4 times, most recently
from
November 13, 2026 14:31
f489bd4 to
d7aa032
Compare
1 task done
Asset events created by asset watchers in the triggerer were invisible to OpenLineage: task-produced asset events are reported as outputs of the task's own run, but watcher-produced ones have no task run to attach to. Reporting them as a START/COMPLETE run pair of a dedicated asset watcher job makes external asset changes visible in lineage. Emission happens off the triggerer's main loop on a bounded, best-effort queue, so a slow or failing transport can only drop events and never block or break the triggerer. Co-Authored-By: Claude <noreply@anthropic.com>
Asset watcher events ignored the admin emission policy, so a global emit: false or exclude_datasets rule did not stop them. They also lacked end-to-end coverage for the cases that matter in a deployment: several watchers on one asset, a trigger shared by two assets, events from tasks or the REST API that must not be reported, partitions, and excluded assets. When Airflow passes the asset event id and timestamp, the run id is now stable across sends and the event time matches the stored event; older versions keep the previous fallback. Co-Authored-By: Claude <noreply@anthropic.com>
Deployment managers could turn off OpenLineage events on the scheduler and workers, but not those sent from the triggerer for asset watchers or from the API server when a user changes a state. The API server also ignored the emission policy for task states changed by hand, so even `emit: false` for a Dag did not stop those events. Co-Authored-By: Claude <noreply@anthropic.com>
Deployments that turn asset watcher events off should not keep any OpenLineage machinery in the triggerer, and the size of the queue of waiting events must be up to them. The two events of an asset event shared their objects, which earlier caused facets to leak between events, and assets that can't be translated to a dataset were not covered end to end. Older Airflow versions report Dag run states set by hand with the same empty message as a Dag run that timed out, so those are only recognized from Airflow 3.3.1. The OpenLineage compat e2e image kept the released provider when it had the same version as the one under test, so those runs did not test the provider's code. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The watcher name and trigger classpath move into a nested `source` object with a `type`, which matches the job type, so asset events created through the REST API can later reuse the same facet, run id and adapter method with a new source type instead of a parallel set. Co-Authored-By: Claude <noreply@anthropic.com>
kacpermuda
force-pushed
the
ol-asset-watcher-events
branch
from
November 18, 2026 16:53
34c4be6 to
e286cec
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Asset events created by asset watchers in the triggerer (Airflow 3.2+) were invisible to OpenLineage. Asset events produced by a task are already reported as outputs of that task's own run, but a watcher-produced event has no task run to attach to.
This implements the
on_asset_event_emittedlistener hook in the OpenLineage provider:An event is treated as a watcher event when Airflow names its source watcher. On Airflow versions that don't, the provider falls back to: no source task,
from_triggerin extra, and not created through the REST API.Each watcher event emits a START and COMPLETE pair for the job
asset_watcher.<asset name>(job typeASSET_WATCHER), with the asset translated to an OpenLineage dataset as the output. All watchers of an asset share one job, so the job name is the same on every Airflow version. Each of the two events gets its own job, run, facet and dataset objects.An asset that can't be translated to an OpenLineage dataset is still reported, without outputs; its URI is in the facet.
A new
airflowAssetEventrun facet, with a schema listing every key:source: atype(ASSET_WATCHERhere, matching the job type), plus the watcher name and trigger classpath when Airflow passes them.The facet, run id and adapter method aren't specific to watchers, so events created through the REST API can later reuse them with a new source type.
When Airflow passes the asset event id and timestamp (Expose asset event id and source watcher to asset listeners #76750), the run id is the same for every send of an event, and the event time is the stored event time. Older versions get a uuid7 run id and the current time.
Emission policy: only global rules apply, since these events have no Dag, task, operator or hook.
emit_asset_watcher_eventscontrol turns them off. Likeemit_task_eventsandemit_dag_events, it beatsemitwithin a rule.emit: falsesuppresses them.exclude_datasetsis matched against the asset. When it matches, the events are skipped altogether, because their facet names the asset.selective_enablesuppresses them too.Manual state changes. The policy so far could turn events off on the scheduler and workers, but not those the API server sends when a user sets a task or Dag run state.
emit_manual_state_change_eventscontrol turns them off, globally or per Dag or task. An event is sent only if both this control and the usualemitresolution allow it, and per-Dag or per-task settings in Dag code can't turn them back on.dag_idanddag_id+task_idrules;operatorrules, per-Dag or per-task settings in Dag code, and legacy options need the task, so they are skipped.Triggerer safety. The hook runs on the triggerer's main loop, inside the transaction that records the asset change, so a dropped event is preferred to any impact on the triggerer:
0, negative or invalid, the hook logs that once and returns for every later event, creating no queue, thread or client.put_nowaitonto a bounded queue. The new[openlineage] asset_watcher_event_queue_sizesets its size (default 100). There is no unbounded mode, as each waiting event holds its trigger payload.Tests.
https://).exclude_datasetsrule.from_triggerin extra), neither of which may produce watcher events.emit_manual_state_change_eventsandemit_task_eventsrules.ASSET_WATCHERruns. A newunfinished_start_keysoption lets it accept a START whose COMPLETE the policy suppresses.Depends on #76750 (passes the event id, timestamp and source watcher to listeners) and #76982 (fixes wrong watcher names for assets sharing a trigger, which these e2e tests found). Both are expected to merge first: the 3.5+ expected events require the watcher fields. The OpenLineage e2e suite passed locally on main with both applied, and on Airflow 3.0.6, 3.1.8, 3.2.2, 3.3.2 and 3.4.0.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines
🤖 Generated with Claude Code