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

   ### Discussed in https://github.com/apache/airflow/discussions/31408
   
   <div type='discussions-op-text'>
   
   <sup>Originally posted by **gil-tober** May 18, 2023</sup>
   ### Apache Airflow version
   
   2.6.1
   
   ### What happened
   
   When upgrading Airflow from 2.5.3 to 2.6.1 the `airflow-run-migration` job 
fails.
   
   I have deployed the same setup to our DEV environment (where Sentry is 
disabled) and the upgrade succeeded without an issue.
   
   After that I tried deploying to our PROD environment where Sentry is enabled 
and the job failed with the error below.
   
   I tried enabling Sentry on DEV and the upgrade **failed**.
   
   Took a look at `airflow.executors.executor_loader.py` at lines 162-185 when 
the exception is raised from. Setting the environment variable 
`_AIRFLOW__SKIP_DATABASE_EXECUTOR_COMPATIBILITY_CHECK=1` fixed the error 
getting in the upgrade job. (Our metadb is Postgres)
   
   ```
   Traceback (most recent call last):
     File “/home/airflow/.local/bin/airflow”, line 5, in <module>
       from airflow.__main__ import main
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/__init__.py”, line 
66, in <module>
       settings.initialize()
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/settings.py”, line 
522, in initialize
       import_local_settings()
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/settings.py”, line 
467, in import_local_settings
       import airflow_local_settings
     File “/opt/airflow/dags/repo/airflow_local_settings.py”, line 5, in 
<module>
       from airflow.www.utils import UIAlert
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/www/utils.py”, line 
44, in <module>
       from airflow.models.dagrun import DagRun
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/models/dagrun.py”, 
line 57, in <module>
       from airflow.models.taskinstance import TaskInstance as TI
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/models/taskinstance.py”,
 line 100, in <module>
       from airflow.sentry import Sentry
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/sentry.py”, line 
195, in <module>
       Sentry = ConfiguredSentry()
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/sentry.py”, line 92, 
in __init__
       executor_class, _ = ExecutorLoader.import_default_executor_cls()
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/executors/executor_loader.py”,
 line 158, in import_default_executor_cls
       executor, source = cls.import_executor_cls(executor_name)
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/executors/executor_loader.py”,
 line 134, in import_executor_cls
       return _import_and_validate(cls.executors[executor_name]), 
ConnectorSource.CORE
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/executors/executor_loader.py”,
 line 130, in _import_and_validate
       cls.validate_database_executor_compatibility(executor)
     File 
“/home/airflow/.local/lib/python3.10/site-packages/airflow/executors/executor_loader.py”,
 line 181, in validate_database_executor_compatibility
       from airflow.settings import engine
   ImportError: cannot import name ‘engine’ from ‘airflow.settings’ 
(/home/airflow/.local/lib/python3.10/site-packages/airflow/settings.py)
   ```
   
   ### What you think should happen instead
   
   migrateDatabaseJob should not fail when Sentry is enabled
   
   ### How to reproduce
   
   Upgrade from 2.5.3 to 2.6.1 with CeleryKubernetesExecutor and **Sentry 
enabled**
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==8.0.0
   apache-airflow-providers-celery==3.1.0
   apache-airflow-providers-cncf-kubernetes==6.1.0
   apache-airflow-providers-common-sql==1.4.0
   apache-airflow-providers-docker==3.6.0
   apache-airflow-providers-elasticsearch==4.4.0
   apache-airflow-providers-ftp==3.3.1
   apache-airflow-providers-google==8.3.0
   apache-airflow-providers-grpc==3.1.0
   apache-airflow-providers-hashicorp==3.3.1
   apache-airflow-providers-http==4.3.0
   apache-airflow-providers-imap==3.1.1
   apache-airflow-providers-jenkins==3.2.1
   apache-airflow-providers-microsoft-azure==6.0.0
   apache-airflow-providers-mysql==5.0.0
   apache-airflow-providers-odbc==3.2.1
   apache-airflow-providers-postgres==5.3.1
   apache-airflow-providers-redis==3.1.0
   apache-airflow-providers-salesforce==5.3.0
   apache-airflow-providers-sendgrid==3.1.0
   apache-airflow-providers-sftp==4.2.4
   apache-airflow-providers-slack==7.2.0
   apache-airflow-providers-snowflake==4.0.5
   apache-airflow-providers-sqlite==3.3.2
   apache-airflow-providers-ssh==3.6.0
   apache-airflow-providers-tableau==4.1.0
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   Airflow deployed on an EKS cluster using the official Airflow Helm Chart 
(V1.9.0)
   MetaBD is a Postgres RDS
   CeleryKubernetesExecutor
   
   ### 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)
   </div>


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