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

   ### Apache Airflow version
   
   3.0.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   FROM air.astronomer.io/runtime-dev:3.0-1-nightly20250319 (3.0.0.dev20250318)
   
   ### What happened?
   
   (This bug does not exist in beta3, only got it in the nightly from last 
night, can't get current main to run so could not test there)
   
   Tried to add this dag:
   
   ```python
   from airflow.decorators import task
   from pendulum import datetime
   from airflow.sdk import dag
   
   
   @dag(
       start_date=datetime(2025, 1, 1),
       schedule="@daily",
       catchup=False,
   )
   def test_dag():
   
       @task
       def test_task():
           pass
   
       test_task()
   
   
   test_dag()
   
   ```
   
   Getting the import error:
   
   ```
   [2025-03-20T19:44:44.482+0000] {dag.py:1866} INFO - Sync 1 DAGs
   Traceback (most recent call last):
     File "/usr/local/bin/airflow", line 10, in <module>
       sys.exit(main())
                ^^^^^^
     File "/usr/local/lib/python3.12/site-packages/airflow/__main__.py", line 
58, in main
       args.func(args)
     File "/usr/local/lib/python3.12/site-packages/airflow/cli/cli_config.py", 
line 49, in command
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/airflow/utils/cli.py", line 
111, in wrapper
       return f(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/utils/providers_configuration_loader.py",
 line 55, in wrapped_function
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 101, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/cli/commands/remote_commands/dag_command.py",
 line 711, in dag_reserialize
       dag_bag.sync_to_db(bundle.name, 
bundle_version=bundle.get_current_version(), session=session)
     File "/usr/local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 98, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/airflow/models/dagbag.py", 
line 649, in sync_to_db
       update_dag_parsing_results_in_db(
     File 
"/usr/local/lib/python3.12/site-packages/airflow/dag_processing/collection.py", 
line 326, in update_dag_parsing_results_in_db
       for attempt in run_with_db_retries(logger=log):
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
443, in __iter__
       do = self.iter(retry_state=retry_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
376, in iter
       result = action(retry_state)
                ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
398, in <lambda>
       self._add_action_func(lambda rs: rs.outcome.result())
                                        ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in 
result
       return self.__get_result()
              ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in 
__get_result
       raise self._exception
     File 
"/usr/local/lib/python3.12/site-packages/airflow/dag_processing/collection.py", 
line 336, in update_dag_parsing_results_in_db
       DAG.bulk_write_to_db(bundle_name, bundle_version, dags, session=session)
     File "/usr/local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 98, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/airflow/models/dag.py", line 
1872, in bulk_write_to_db
       dag_op.update_dags(orm_dags, session=session)
     File 
"/usr/local/lib/python3.12/site-packages/airflow/dag_processing/collection.py", 
line 471, in update_dags
       last_automated_data_interval = 
dag.get_run_data_interval(last_automated_run)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   AttributeError: 'DAG' object has no attribute 'get_run_data_interval'
   ```
   
   
   ### What you think should happen instead?
   
   The same dag works when using `from airflow.decorators import dag`.  
   
   ### How to reproduce
   
   1. Add the dag above
   2. run airflow dags reserialize
   3. see the error
   
   ### Operating System
   
   Mac M1 Pro 15.3.1 (24D70)
   
   ### Versions of Apache Airflow Providers
   
   None
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   Astro CLI
   
   ### 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: [email protected]

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

Reply via email to