Skip to content

Populate dag and note before firing dag run state-change listeners#69873

Open
kacpermuda wants to merge 1 commit into
apache:mainfrom
kacpermuda:dag-listeners-extend
Open

Populate dag and note before firing dag run state-change listeners#69873
kacpermuda wants to merge 1 commit into
apache:mainfrom
kacpermuda:dag-listeners-extend

Conversation

@kacpermuda

@kacpermuda kacpermuda commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

When patching a Dag Run's state to success or failed via the API, two issues
existed with the listener call:

  1. dag_run.dag was always None when the listener received the object, because the route loads the dag separately but never attached it to the run. After the change, the listener will have access to SerializedDag that is used for example by OpenLineage listener to create an AirflowDagRunFacet.
  2. The listener message was an empty string. After the change, we will match the messages passed to task listener methods when manually changing task's state. It will make it easier for listener (and end users) to figure out what caused the early success / failure of dagrun.
  3. When both note and state were patched in the same request (dagrun state was set and note was provided), the note could be applied after the listener fired, so the listener saw the old / no note. Fixed by sorting the patch fields so note is always processed before state.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Sonnet 4.6
    Generated-by: Claude Sonnet 4.6 following the guidelines

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant