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

   ### Apache Airflow version
   
   2.5.0
   
   ### What happened
   
   TaskFlow `@dag`s don't register without explicitly calling the function that 
defines it. 
   
   ### What you think should happen instead
   
   My understanding is that since Airflow 2.4 DAGs don't require explicit 
registration as a global object anymore (this is also mentioned in 
https://airflow.apache.org/docs/apache-airflow/stable/tutorial/taskflow.html#instantiate-a-dag).
 However, this seems to only be true for the classic style and not for taskflow 
style DAGs.
   
   ### How to reproduce
   
   ```python
   import datetime
   
   from airflow import DAG
   from airflow.decorators import dag, task
   from airflow.operators.empty import EmptyOperator
   
   with DAG(dag_id="no_global_dag_registration", 
start_date=datetime.datetime(2023, 1, 1), schedule=None):
       EmptyOperator(task_id="test")
   
   
   @dag(start_date=datetime.datetime(2023, 1, 1), schedule=None)
   def no_global_dag_registration_taskflow():
       @task
       def test():
           pass
   ```
   
   My understanding both styles should register the DAG, however only DAG 
"no_global_dag_registration" does. For the taskflow-style DAG I have to call 
`no_global_dag_registration_taskflow()` for it to register.
   
   ### Operating System
   
   varying
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### 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
   
   - [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: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to