Skip to content
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

F-UJI is broken after connexion update #463

Closed
afuetterer opened this issue Dec 19, 2023 · 10 comments
Closed

F-UJI is broken after connexion update #463

afuetterer opened this issue Dec 19, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@afuetterer
Copy link
Contributor

Description

F-UJI does not work after the connexion update. I pointed this out in the related PR #460. There are breaking changes in the update.

Expected Behavior

F-UJI server should start.

Tests should finish.

Actual Behavior

F-UJI server is unable to start.

$ python -m fuji_server -c fuji_server/config/server.ini
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File ".../fuji_server/__main__.py", line 34, in <module>
    from fuji_server.app import create_app
  File ".../fuji_server/app.py", line 30, in <module>
    from fuji_server import encoder
  File ".../fuji_server/encoder.py", line 1, in <module>
    from connexion.apps.flask_app import FlaskJSONEncoder
ModuleNotFoundError: No module named 'connexion.apps.flask_app'

Tests not possible.

$ hatch run test    
ImportError while loading conftest '.../fuji/tests/conftest.py'.
tests/conftest.py:13: in <module>
    from fuji_server.app import create_app
fuji_server/app.py:30: in <module>
    from fuji_server import encoder
fuji_server/encoder.py:1: in <module>
    from connexion.apps.flask_app import FlaskJSONEncoder
E   ModuleNotFoundError: No module named 'connexion.apps.flask_app'

Your Environment

  • python --version Python 3.11.6
  • pip show fuji | grep "^Version\:" Version: 3.1.0
@afuetterer afuetterer added the bug Something isn't working label Dec 19, 2023
@dfsp-spirit
Copy link
Contributor

dfsp-spirit commented Dec 28, 2023

I just came here to report this, glad that this has been noticed already. It's broken for both manual installation and the Docker image, of course, I tried both.

Since we depend on F-UJI for our current project, is there any workaround for now, like running an older Docker image or checking out an older version? If so, which one do you recommend?

I guess monkeypatching pyproject.toml and pinning the connexion[swagger-ui] dependency to a specific version (the one before the error, maybe 2.14) should also do it.

Update: the monkeypatching approach works. One can clone the git repo, modify the connexion line in pyproject.toml (line 24) to read "connexion[swagger-ui]==2.14", and then pip install F-UJI. I did this in a fresh conda environment with Python 3.11. After installation, I got an error about Flask AttributeError: module 'flask.json' has no attribute 'JSONEncoder' when trying to start the F-UJI server, but that was easily fixed via pip uninstall Flask followed by pip install Flask==2.2.5 . For our development environment, this is good enough for now.

@huberrob
Copy link
Contributor

huberrob commented Jan 3, 2024

I am working on this but the migration to connexion 3 seems not to be that trivial

@afuetterer
Copy link
Contributor Author

Excellent.

For anyone finding this issue and in case it is still open, you can follow @dfsp-spirit's suggestion to get a working F-UJI server or checkout a commit before 3a9dd19.

@huberrob: In case you need help with this. Maybe add the "help wanted" tag to the issue?

@huberrob
Copy link
Contributor

huberrob commented Jan 4, 2024

OK, I think its done, at least all the tests are passed now and I can run it locally. Can you please take a try and verify?

@huberrob
Copy link
Contributor

huberrob commented Jan 4, 2024

And @dfsp-spirit maybe you can tell a bit more about your project and how you are using F-UJi there?

@dfsp-spirit
Copy link
Contributor

dfsp-spirit commented Jan 4, 2024

I'm working on infrastructure for a German NFDI and we're trying to get a picture of the technical level the repositories in our field are at, and also at metadata standards. If they offer a suitable API, we use F-UJI as part of the assessment of the FAIRness, by sampling some datasets from the repos.

@dfsp-spirit
Copy link
Contributor

dfsp-spirit commented Jan 5, 2024

@huberrob I tried it and it works for me, great, thanks. I guess this can be closed.

(I tested b0e2752).

@afuetterer
Copy link
Contributor Author

I get an error. Seems not to be working?

python -m fuji_server -c fuji_server/config/server.ini
YAML PATH .../fuji/fuji_server/yaml
Remote Logging not possible ,please correct : fuji.localhost /loghandler/index.php
.../.venv/lib/python3.11/site-packages/flask_limiter/extension.py:336: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
  warnings.warn(
`ConnexionMiddleware.run` is optimized for development. For production, run using a dedicated ASGI server.
INFO:     Started server process [89257]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
ERROR:    [Errno 99] error while attempting to bind on address ('::1', 1071, 0, 0): cannot assign requested address
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.

@huberrob
Copy link
Contributor

huberrob commented Jan 8, 2024

Maybe this is related to the config settings, can you check if this still appears when you change

service_host = localhost
to
service_host = 0.0.0.0

or
127.0.0.1
?

@afuetterer
Copy link
Contributor Author

Well. Today it just works. Nevermind my last comment. I think it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants