Skip to content

Airflow does not register DAG unless it reads the keyword "airflow" in the python file  #39802

@dhawal-rathore

Description

@dhawal-rathore

Apache Airflow version

2.9.1

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

No response

What happened?

I am extending the DAG class in a class file, and importing it and creating an object did not list my DAG, but creating a DAG object worked. So after a while I figured out the scheduler does not add the DAG if it does not detect the string "airflow" inside the code.

What you think should happen instead?

It should go through the code to see if a DAG object exists in the code, or this should be mentioned in the documentation.

How to reproduce

  1. Make a class file and a class which extends the DAG class, should not have airflow in the name.
  2. Create the DAG file in your DAG folder, and import the class into the file. Make sure the word "airflow" is not in the file.
  3. Your DAG will not be registered

Operating System

Ubuntu

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

    Labels

    area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions