Skip to content

Fix import errors updating DAGs in other bundles#63615

Merged
gopidesupavan merged 1 commit intoapache:mainfrom
gopidesupavan:fix-dagbundle-import-error-updates
Mar 15, 2026
Merged

Fix import errors updating DAGs in other bundles#63615
gopidesupavan merged 1 commit intoapache:mainfrom
gopidesupavan:fix-dagbundle-import-error-updates

Conversation

@gopidesupavan
Copy link
Member

Import error updates in dag processing were matching DagModel rows by relative_fileloc only. When two DAG bundles contained files with the same relative path, an import error in one bundle could incorrectly mark the other bundle’s DAG as having import errors and even overwrite its bundle_name.

This is easily reproducible:

  1. Configure two DAG bundles that contain the same relative file name, for example:

files/bundle_a/example_dag.py
files/bundle_b/example_dag.py

  1. Set the bundle config:
    export AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST='[
    {"name":"bundle_a","classpath":"airflow.dag_processing.bundles.local.LocalDagBundle","kwargs":{"path":"/files/bundle_a","refresh_interval":0}},
    {"name":"bundle_b","classpath":"airflow.dag_processing.bundles.local.LocalDagBundle","kwargs":{"path":"/files/bundle_b","refresh_interval":0}}
    ]'

  2. Parse both bundles successfully:

  3. Introduce an import error only in files/bundle_a/example_dag.py.

  4. Reparse only bundle_a

airflow dags reserialize --bundle-name bundle_a

select dag_id, bundle_name, relative_fileloc, has_import_errors
from dag
where relative_fileloc = 'example_dag.py'
order by bundle_name, dag_id;

Before this fix, you can end up with both records marked as having import errors, even though only the DAG in bundle_a is broken.


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

  • 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.

@gopidesupavan gopidesupavan force-pushed the fix-dagbundle-import-error-updates branch from 6b037d6 to 0f5c42a Compare March 14, 2026 22:46
@gopidesupavan gopidesupavan requested review from kaxil and potiuk March 14, 2026 22:47
@potiuk potiuk added this to the Airflow 3.1.9 milestone Mar 15, 2026
@potiuk potiuk added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Mar 15, 2026
@gopidesupavan gopidesupavan merged commit b93d379 into apache:main Mar 15, 2026
71 of 73 checks passed
@gopidesupavan gopidesupavan deleted the fix-dagbundle-import-error-updates branch March 15, 2026 09:12
github-actions bot pushed a commit that referenced this pull request Mar 15, 2026
(cherry picked from commit b93d379)

Co-authored-by: GPK <gopidesupavan@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test PR Link

potiuk pushed a commit that referenced this pull request Mar 15, 2026
…#63629)

(cherry picked from commit b93d379)

Co-authored-by: GPK <gopidesupavan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:DAG-processing backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants