-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove greenlet
and add asyncio
extra to sqlalchemy
#895
Remove greenlet
and add asyncio
extra to sqlalchemy
#895
Conversation
Coverage reportThe coverage rate went from None of the new lines are part of the tested code. Therefore, there is no coverage data about them. |
…io-extra-to-sqlalchemy
This PR should solve the original Apple-M1 issue reported in #747 (comment), while sticking to the solution recommended by sqlalchemy. @jluethi would you mind re-trying the installation that triggered your original error? I don't have other Apple M1s available.. You would need to:
If it all goes through, we can safely merge. Thanks! |
@tcompa I can confirm that this installs without error on an M1 mac and then starts the server. I have not tested server functionality with it then, but I guess that shouldn't be necessary, right? |
Thanks!
It isn't necessary, indeed. If I remove greenlet from a working environment, even Run alembic.config, with argv=['-c', '/tmp/venv/lib/python3.10/site-packages/fractal_server/alembic.ini', 'upgrade', 'head']
fractal_server.app.db
Traceback (most recent call last):
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/app/db/__init__.py", line 32, in engine_async
return cls._engine_async
AttributeError: type object 'DB' has no attribute '_engine_async'. Did you mean: 'engine_async'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/venv/bin/fractalctl", line 8, in <module>
sys.exit(run())
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/__main__.py", line 83, in run
set_db()
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/__main__.py", line 74, in set_db
alembic.config.main(argv=alembic_args)
File "/tmp/venv/lib/python3.10/site-packages/alembic/config.py", line 630, in main
CommandLine(prog=prog).main(argv=argv)
File "/tmp/venv/lib/python3.10/site-packages/alembic/config.py", line 624, in main
self.run_cmd(cfg, options)
File "/tmp/venv/lib/python3.10/site-packages/alembic/config.py", line 601, in run_cmd
fn(
File "/tmp/venv/lib/python3.10/site-packages/alembic/command.py", line 399, in upgrade
script.run_env()
File "/tmp/venv/lib/python3.10/site-packages/alembic/script/base.py", line 578, in run_env
util.load_python_file(self.dir, "env.py")
File "/tmp/venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/tmp/venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 109, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/migrations/env.py", line 98, in <module>
asyncio.run(run_migrations_online())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/migrations/env.py", line 88, in run_migrations_online
engine = DB.engine_async()
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/app/db/__init__.py", line 34, in engine_async
cls.set_db()
File "/tmp/venv/lib/python3.10/site-packages/fractal_server/app/db/__init__.py", line 68, in set_db
cls._engine_async = create_async_engine(
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/ext/asyncio/engine.py", line 43, in create_async_engine
sync_engine = _create_engine(*arg, **kw)
File "<string>", line 2, in create_engine
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
return fn(*args, **kwargs)
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 660, in create_engine
event.listen(pool, "connect", on_connect)
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/event/api.py", line 115, in listen
_event_key(target, identifier, fn).listen(*args, **kw)
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py", line 232, in listen
self.dispatch_target.dispatch._listen(self, *args, **kw)
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/pool/events.py", line 69, in _listen
event_key.base_listen(**kw)
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/event/registry.py", line 270, in base_listen
for_modify._set_asyncio()
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/event/attr.py", line 265, in _set_asyncio
self._exec_once_mutex = AsyncAdaptedLock()
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py", line 67, in AsyncAdaptedLock
_not_implemented()
File "/tmp/venv/lib/python3.10/site-packages/sqlalchemy/util/concurrency.py", line 47, in _not_implemented
raise ValueError(
ValueError: the greenlet library is required to use this function. No module named 'greenlet' |
closes #894
Checklist before merging
CHANGELOG.md