PDHBE opened a new issue, #24457:
URL: https://github.com/apache/airflow/issues/24457

   ### Apache Airflow version
   
   2.2.4
   
   ### What happened
   
   The DAG I created is not registered.
   
   I'm using DAG Class and Operator by extending as follows:
   `class DefaultDAG(DAG):`
   `class BatchJobOperator(BaseOperator):`
   
   So I'm not using :
   `from airflow import DAG`
   `from airflow.operators.python import PythonOperator`
   `DAG(...)`
   
   I'm using:
   `from batch.dags.default_dag import DefaultDAG`
   `from common.operator.batch_job_operator import BatchJobOperator`
   `DefaultDAG(...)`
   
   Therefore, my DAG file does not exactly contain the string "airflow" or "DAG"
   
   And I found the following in the official document:
   `Does the file containing your DAG contain the string “airflow” and “DAG” 
somewhere in the contents? When searching the DAG directory, Airflow ignores 
files not containing “airflow” and “DAG” in order to prevent the DagBag parsing 
from importing all python files collocated with user’s DAGs.`
   
   Is it correct that it is not recognized as DAG because of this reason?
   
   And I added only one line of `from airflow import DAG` for testing, and the 
DAG is recognized successfully.
   
   ### What you think should happen instead
   
   If the reason is that the string "airflow" or "DAG" is not included exactly,
   I think it is limited to be recognized as DAG only if the string "airflow" 
or "DAG" is included exactly.
   
   Also, unlike the "DAG Import Errors" that can be clearly seen through the 
web UI,
   The cause of DAG not being recognized is not clearly indicated, so it is 
difficult to figure out what is the problem.
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   Debian GNU/Linux 10 (buster)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to