Я использую Airflow v1.9.0
с Python 3.5.2
.
У меня есть рабочая промежуточная и производственная среда, в которой она работает нормально.
Я также использовал ее локально на своей локальной машине Ubuntu, где она работала нормально .
Недавно я переключился на MacOS 10.15.2
со своего старого Ubuntu 18
.
Проблема
Когда я делаю $airflow initdb
или $airflow upgradedb
, я получаю этот беспорядок SQL Ошибка алхимии.
Traceback (most recent call last):
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/bin/airflow", line 27, in <module>
args.func(args)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/airflow/bin/cli.py", line 897, in initdb
db_utils.initdb()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/airflow/utils/db.py", line 103, in initdb
upgradedb()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/airflow/utils/db.py", line 320, in upgradedb
command.upgrade(config, 'heads')
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/alembic/command.py", line 174, in upgrade
script.run_env()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/alembic/script/base.py", line 416, in run_env
util.load_python_file(self.dir, 'env.py')
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/alembic/util/compat.py", line 68, in load_module_py
module_id, path).load_module(module_id)
File "<frozen importlib._bootstrap_external>", line 388, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 809, in load_module
File "<frozen importlib._bootstrap_external>", line 668, in load_module
File "<frozen importlib._bootstrap>", line 268, in _load_module_shim
File "<frozen importlib._bootstrap>", line 693, in _load
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/airflow/migrations/env.py", line 86, in <module>
run_migrations_online()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/airflow/migrations/env.py", line 73, in run_migrations_online
with connectable.connect() as connection:
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2102, in connect
return self._connection_cls(self, **kwargs)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 90, in __init__
if connection is not None else engine.raw_connection()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2188, in raw_connection
self.pool.unique_connection, _connection)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2162, in _wrap_pool_connect
e, dialect, self)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception_noconnection
exc_info
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 248, in reraise
raise value.with_traceback(tb)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
return fn()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 342, in unique_connection
return _ConnectionFairy._checkout(self)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 788, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 529, in checkout
rec = pool._do_get()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1193, in _do_get
self._dec_overflow()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 249, in reraise
raise value
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1190, in _do_get
return self._create_connection()
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 347, in _create_connection
return _ConnectionRecord(self)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 474, in __init__
self.__connect(first_connect_check=True)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/pool.py", line 671, in __connect
connection = pool._invoke_creator(self)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 106, in connect
return dialect.connect(*cargs, **cparams)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 412, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/Users/userabc/.pyenv/versions/3.5.2/envs/vmds/lib/python3.5/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
(Background on this error at: http://sqlalche.me/e/e3q8)
Конфигурация
Когда я делаю
$ grep sql_alchemy_conn $AIRFLOW_HOME/airflow.cfg
, я вижу этот вывод на своем терминале
sql_alchemy_conn=postgresql://airflow-user:airflow-pwd@localhost/airflow-db
Я даже могу подключиться к этой базе данных, учитывая учетные данные, указанные в строке подключения, используя DataGrip
.
Проверено
Я сделал
$brew services list | grep postgres
, и я вижу, что служба работает нормально
postgresql started saadali /Users/userabc/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Просто для двойной проверки, хотя он и работал, поэтому я смог подключиться через Datagrip
.
Что я делаю не так? Есть ли что-то другое на MacOS
?
Примечание : 2/3 дня a go Я настраиваю поток воздуха с теми же настройками на MacOS
коллеги и там такой ошибки не произошло, хотя я не уверен, какая у него была версия MacOS.