Skip to content

Store executor callback DagRun references in the database - #71214

Open
fat-catTW wants to merge 3 commits into
apache:mainfrom
fat-catTW:callback-dagrun-fkey
Open

fat-catTW wants to merge 3 commits into
apache:mainfrom
fat-catTW:callback-dagrun-fkey

Conversation

@fat-catTW

Copy link
Copy Markdown
Contributor

Why

Executor callbacks need to know which DagRun they belong to when the scheduler
builds callback workloads. Keeping that reference only in callback.data makes
the scheduler depend on payload shape instead of a database-managed relationship.

Solution

Add a nullable callback.dagrun_id foreign key to dag_run.id and have executor
callbacks store their DagRun reference there. The scheduler now loads the
relationship through the ORM when enqueueing callback workloads.

The migration backfills existing rows from deadline relationships first, then
falls back to legacy callback payload data when needed.

Was generative AI tooling used to co-author this PR?
  • [X] Yes (please specify the tool below)

Generated-by: [Codex] 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.

@fat-catTW
fat-catTW force-pushed the callback-dagrun-fkey branch 2 times, most recently from 40f7be8 to 26897c6 Compare August 9, 2026 15:00
Comment thread airflow-core/src/airflow/jobs/scheduler_job_runner.py
@ferruzzi

Copy link
Copy Markdown
Contributor

I've merged everything in the chain that was blocking this; if you can get the migration rebased I can approve it and get it merged.

@fat-catTW
fat-catTW force-pushed the callback-dagrun-fkey branch from 0fb6db7 to aa3a9ee Compare October 16, 2026 04:36
@fat-catTW

Copy link
Copy Markdown
Contributor Author

Thanks for checking the PR.
I have rebased the PR!

@fat-catTW
fat-catTW force-pushed the callback-dagrun-fkey branch from 8f70e76 to 1ee8bb7 Compare October 17, 2026 13:42

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants