Skip to content

DAGs are not marked as stale if the AIRFLOW__CORE__DAGS_FOLDER changes #41432

@utkarsharma2

Description

@utkarsharma2

Apache Airflow version

2.9.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Suppose we start Airflow with the following DAGs located in /<user_root>/airflow/dags:

abc.py
xyz.py

Later, we decide to change the default DAG folder to /<user_root>/airflow/dags_backup/, which contains different DAG files, by setting the environment variable AIRFLOW__CORE__DAGS_FOLDER=/<user_root>/airflow/dags_backup/. After restarting the scheduler, the new folder includes the following DAGs:

efg.py
hij.py

At this point, the Airflow UI will display all the DAGs from both sets of files (abc.py, xyz.py, efg.py, and hij.py), even though the current dags_folder no longer contains the original abc.py and xyz.py.

Note: This behavior has been observed even for active DAGs.

What you think should happen instead?

The expectation is that the airflow UI should only dags belonging to the new dags folder /<user_root>/airflow/dags_backup/.

How to reproduce

  1. Start Airflow with some dags in the dags folder.
  2. Change the default dag folder using AIRFLOW__CORE__DAGS_FOLDER to another folder containing a different set of dags.
  3. Notice both sets of dags are visible on the UI.

Operating System

Ventura - Mac

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions