Taragolis commented on code in PR #28693:
URL: https://github.com/apache/airflow/pull/28693#discussion_r1062852715


##########
airflow/api_internal/endpoints/rpc_api_endpoint.py:
##########
@@ -24,6 +24,7 @@
 
 from airflow.api_connexion.types import APIResponse
 from airflow.dag_processing.processor import DagFileProcessor
+from airflow.models import DagModel

Review Comment:
   Seem like this not help, I've just tried both options and it failed with 
same error (and also how to reproduce locally)
   
   ```console
   
   ❯ breeze --python 3.9 --backend postgres shell --db-reset
   
   Creating docker-compose_airflow_run ... done
   
   Running Initialization. Your basic configuration is:
   
     * Airflow home: /root/airflow
     * Airflow sources: /opt/airflow
     * Airflow core SQL connection: 
   
   
   Using airflow version from current sources
   
   
   Checking backend and integrations.
   
   PostgreSQL: OK.  
   
   
   Resetting the DB
   
   DB: postgresql+psycopg2://postgres:***@postgres/airflow
   [2023-01-05T20:06:21.922+0000] {db.py:1608} INFO - Dropping tables that exist
   Traceback (most recent call last):
     File "/usr/local/bin/airflow", line 33, in <module>
       sys.exit(load_entry_point('apache-airflow', 'console_scripts', 
'airflow')())
     File "/opt/airflow/airflow/__main__.py", line 39, in main
       args.func(args)
     File "/opt/airflow/airflow/cli/cli_parser.py", line 52, in command
       return func(*args, **kwargs)
     File "/opt/airflow/airflow/cli/commands/db_command.py", line 46, in resetdb
       db.resetdb(skip_init=args.skip_init)
     File "/opt/airflow/airflow/utils/session.py", line 75, in wrapper
       return func(*args, session=session, **kwargs)
     File "/opt/airflow/airflow/utils/db.py", line 1610, in resetdb
       import_all_models()
     File "/opt/airflow/airflow/models/__init__.py", line 61, in 
import_all_models
       __getattr__(name)
     File "/opt/airflow/airflow/models/__init__.py", line 83, in __getattr__
       val = import_string(f"{path}.{name}")
     File "/opt/airflow/airflow/utils/module_loading.py", line 36, in 
import_string
       module = import_module(module_path)
     File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in 
import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
     File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 850, in exec_module
     File "<frozen importlib._bootstrap>", line 228, in 
_call_with_frames_removed
     File "/opt/airflow/airflow/models/dag.py", line 65, in <module>
       from airflow.api_internal.internal_api_call import internal_api_call
     File "/opt/airflow/airflow/api_internal/internal_api_call.py", line 29, in 
<module>
       from airflow.serialization.serialized_objects import BaseSerialization
     File "/opt/airflow/airflow/serialization/serialized_objects.py", line 42, 
in <module>
       from airflow.models.dag import DAG, create_timetable
   ImportError: cannot import name 'DAG' from partially initialized module 
'airflow.models.dag' (most likely due to a circular import) 
(/opt/airflow/airflow/models/dag.py)
   
   Error: check_environment returned 1. Exiting.
   
   ERROR: 1
   Error 1 returned
   ```
   
   Unfortunetly local unit test can't handle circular import 😢 



-- 
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