Skip to content

Initialize DAG bundles and sync dags in CLI get_dag function - #53699

Merged
ephraimbuddy merged 3 commits into
apache:mainfrom
astronomer:fix-dag-test
Jul 25, 2025
Merged

ephraimbuddy merged 3 commits into
apache:mainfrom
astronomer:fix-dag-test

Conversation

@ephraimbuddy

Copy link
Copy Markdown
Contributor

Add bundle.initialize() call before parsing DAGs in CLI commands to ensure
bundles are properly initialized. This fixes an issue where CLI commands
could not parse DAGs because serialized DAGs were required but bundles
were not initialized, preventing DAG runs from being created.

Closes:#53682

Comment thread airflow-core/src/airflow/utils/cli.py
@ephraimbuddy
ephraimbuddy force-pushed the fix-dag-test branch 3 times, most recently from 400b362 to 6be9f6a Compare July 24, 2025 15:02
Comment thread airflow-core/tests/unit/cli/commands/test_dag_command.py
@ephraimbuddy ephraimbuddy changed the title Initialize DAG bundles in CLI get_dag function Initialize DAG bundles and sync dags in CLI get_dag function Jul 25, 2025
@ephraimbuddy
ephraimbuddy requested a review from kaxil July 25, 2025 07:32
Add bundle.initialize() call before parsing DAGs in CLI commands to ensure
bundles are properly initialized, then sync the dags to the DB. This fixes an issue where CLI commands
could not parse DAGs because serialized DAGs were required but bundles
were not initialized, and dags not synced to the DB, preventing DAG runs from being created.

Closes:apache#53682
@ephraimbuddy
ephraimbuddy merged commit 7796cdc into apache:main Jul 25, 2025
@ephraimbuddy
ephraimbuddy deleted the fix-dag-test branch July 25, 2025 14:14
ephraimbuddy added a commit to astronomer/airflow that referenced this pull request Jul 28, 2025
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
…e#53699)

* Initialize DAG bundles and sync dags in CLI `get_dag` function

Add bundle.initialize() call before parsing DAGs in CLI commands to ensure
bundles are properly initialized, then sync the dags to the DB. This fixes an issue where CLI commands
could not parse DAGs because serialized DAGs were required but bundles
were not initialized, and dags not synced to the DB, preventing DAG runs from being created.

Closes:apache#53682

* fixup! Initialize DAG bundles and sync dags in CLI `get_dag` function

* sync bundles outside the loop
fweilun pushed a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
…e#53699)

* Initialize DAG bundles and sync dags in CLI `get_dag` function

Add bundle.initialize() call before parsing DAGs in CLI commands to ensure
bundles are properly initialized, then sync the dags to the DB. This fixes an issue where CLI commands
could not parse DAGs because serialized DAGs were required but bundles
were not initialized, and dags not synced to the DB, preventing DAG runs from being created.

Closes:apache#53682

* fixup! Initialize DAG bundles and sync dags in CLI `get_dag` function

* sync bundles outside the loop
Eason09053360 added a commit to Eason09053360/airflow that referenced this pull request Sep 21, 2026
Four CLI paths build a DagBag straight from bundle.path without first
calling bundle.initialize(). A LocalDagBundle already has its files on
disk, so the gap is invisible in local development and in the test
suite; a bundle that materialises its files in initialize() - a Git
bundle clones the repo there - is still an empty path at that point.

dags list and dags list-import-errors then report an empty bundle and
no import errors and exit 0, so a CI gate built on them passes while
the Dag files are never read. tasks test, dags test and the --dag-regex
lookups fall through to the "search every configured bundle" path,
which re-fetches and syncs every bundle to the metadata DB and can
return a same-named Dag from a bundle other than the requested one.

The three call sites that already initialize - dags report, dags
reserialize and the fallback loop in get_bagged_dag - show the intended
shape; that fallback loop got its call in apache#53699, which fixed only the
one occurrence it was reported for.
Eason09053360 added a commit to Eason09053360/airflow that referenced this pull request Sep 22, 2026
Four CLI paths build a DagBag straight from bundle.path without first
calling bundle.initialize(). A LocalDagBundle already has its files on
disk, so the gap is invisible in local development and in the test
suite; a bundle that materialises its files in initialize() - a Git
bundle clones the repo there - is still an empty path at that point.

dags list and dags list-import-errors then report an empty bundle and
no import errors and exit 0, so a CI gate built on them passes while
the Dag files are never read. tasks test, dags test and the --dag-regex
lookups fall through to the "search every configured bundle" path,
which re-fetches and syncs every bundle to the metadata DB and can
return a same-named Dag from a bundle other than the requested one.

The three call sites that already initialize - dags report, dags
reserialize and the fallback loop in get_bagged_dag - show the intended
shape; that fallback loop got its call in apache#53699, which fixed only the
one occurrence it was reported for.
Eason09053360 added a commit to Eason09053360/airflow that referenced this pull request Sep 28, 2026
Four CLI paths build a DagBag straight from bundle.path without first
calling bundle.initialize(). A LocalDagBundle already has its files on
disk, so the gap is invisible in local development and in the test
suite; a bundle that materialises its files in initialize() - a Git
bundle clones the repo there - is still an empty path at that point.

dags list and dags list-import-errors then report an empty bundle and
no import errors and exit 0, so a CI gate built on them passes while
the Dag files are never read. tasks test, dags test and the --dag-regex
lookups fall through to the "search every configured bundle" path,
which re-fetches and syncs every bundle to the metadata DB and can
return a same-named Dag from a bundle other than the requested one.

The three call sites that already initialize - dags report, dags
reserialize and the fallback loop in get_bagged_dag - show the intended
shape; that fallback loop got its call in apache#53699, which fixed only the
one occurrence it was reported for.
Eason09053360 added a commit to Eason09053360/airflow that referenced this pull request Oct 7, 2026
Four CLI paths build a DagBag straight from bundle.path without first
calling bundle.initialize(). A LocalDagBundle already has its files on
disk, so the gap is invisible in local development and in the test
suite; a bundle that materialises its files in initialize() - a Git
bundle clones the repo there - is still an empty path at that point.

dags list and dags list-import-errors then report an empty bundle and
no import errors and exit 0, so a CI gate built on them passes while
the Dag files are never read. tasks test, dags test and the --dag-regex
lookups fall through to the "search every configured bundle" path,
which re-fetches and syncs every bundle to the metadata DB and can
return a same-named Dag from a bundle other than the requested one.

The three call sites that already initialize - dags report, dags
reserialize and the fallback loop in get_bagged_dag - show the intended
shape; that fallback loop got its call in apache#53699, which fixed only the
one occurrence it was reported for.
Eason09053360 added a commit to Eason09053360/airflow that referenced this pull request Oct 7, 2026
Four CLI paths build a DagBag straight from bundle.path without first
calling bundle.initialize(). A LocalDagBundle already has its files on
disk, so the gap is invisible in local development and in the test
suite; a bundle that materialises its files in initialize() - a Git
bundle clones the repo there - is still an empty path at that point.

dags list and dags list-import-errors then report an empty bundle and
no import errors and exit 0, so a CI gate built on them passes while
the Dag files are never read. tasks test, dags test and the --dag-regex
lookups fall through to the "search every configured bundle" path,
which re-fetches and syncs every bundle to the metadata DB and can
return a same-named Dag from a bundle other than the requested one.

The three call sites that already initialize - dags report, dags
reserialize and the fallback loop in get_bagged_dag - show the intended
shape; that fallback loop got its call in apache#53699, which fixed only the
one occurrence it was reported for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants