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

⚗️ web-server refactoring backlog #2008

Open
6 of 16 tasks
pcrespov opened this issue Nov 30, 2020 · 2 comments
Open
6 of 16 tasks

⚗️ web-server refactoring backlog #2008

pcrespov opened this issue Nov 30, 2020 · 2 comments
Assignees
Labels
a:services-library issues on packages/service-libs a:webserver issue related to the webserver service dependencies Pull requests that update a dependency file

Comments

@pcrespov
Copy link
Member

pcrespov commented Nov 30, 2020

Refactoring to be done in webserver

  • OBaseException pydantic-exception based base exception for all repo -> code+message. Umbrella
  • remove middleware for openapi and envelope. The latter turn into a decorator instead
  • Remove trafaret dependency by pydantic-settings @pcrespov
  • Replace openapi-core by pydantic (evaluate https://github.com/Maillol/aiohttp-pydantic, https://pypi.org/project/aiohttp-asgi/)
  • Remove openapi-core and use pydantic
  • socket.io extract in separate service (or attach a broker to sync all replicas)
  • Remove constraints to python-socketio
  • Remove constraints to aiohttp
  • OAS checked in tests and not upon startup. Loading OAS takes very long time in rest.py app module
  • Refactor design of webserver/projects plugin
  • Remove / entrypoint from web-server @GitHK

webserver/projects plugin

  • review request/response in project CRUD at the OAS
    • reduce size of project items when listing, i.e. lists do not need to be that detailed
    • review read/write/nullable constraints
    • use hierarchichal to access subresources
    • standard naming of path and query parameters (e.g. ONLY project_uuid, or filtering query params)
  • pydantic models for all interaces and contexts (see issues in Fix issues reported by validate-pg-project diagnose #2552)
  • repository pattern: ProjectRepo class to interface the db and uses pydantic models to export/parse data
  • reduce coupling with other plugins by defining a clear api. module
  • profile plugin to speed up

python-socketio

From 5.0.0, https://github.com/miguelgrinberg/python-socketio/blob/main/CHANGES.md
test_resource_manager.py::test_websocket_resource_management fails because
socket_id saved in redis does not correspond to client's sio (see traceback in comments below).

plugins

  • logging settings to change levels of noisy logger?
  • plugin enhancements
@pcrespov pcrespov added a:services-library issues on packages/service-libs a:webserver issue related to the webserver service bug buggy, it does not work as expected dependencies Pull requests that update a dependency file labels Nov 30, 2020
@pcrespov pcrespov self-assigned this Nov 30, 2020
@pcrespov
Copy link
Member Author

  • check manually if cookie is received in browser

@pcrespov pcrespov changed the title test_access_to_studies.py::test_access_study_anonymously fails with aiohttp 3.7.X test_access_to_studies.py::test_access_study_anonymously fails with aiohttp 3.7.X Nov 30, 2020
@pcrespov pcrespov added this to the Alfred_Büchi milestone Nov 30, 2020
@pcrespov pcrespov changed the title test_access_to_studies.py::test_access_study_anonymously fails with aiohttp 3.7.X maintenance webserver refactoring May 21, 2021
pcrespov added a commit that referenced this issue May 21, 2021
…nd fixes testing fixtures (#2343)

- CHANGES: makes metrics_handler implementation async by using a thread pool executor ot execute prometheos_client.generate_latest call
- CHANGES: general upgrade of webserver dependencies:
aiohttp and python-socketio cannot be upgraded to the latest. Needs further refactoring (see #2008 and notes in requirement files)!
- FIXES: services/web/server/tests/integration/01/test_exporter.py was de-activated.
- CHANGES: unified pylint testing by reusing pytest-simcore utils
- CHANGES: moves socket-io fixtures to simcore-pytest
@pcrespov pcrespov changed the title maintenance webserver refactoring maintenance webserver refactoring backlog May 26, 2021
@pcrespov pcrespov changed the title maintenance webserver refactoring backlog webserver refactoring backlog May 26, 2021
@pcrespov pcrespov modified the milestones: Alfred_Büchi, Chinchilla May 26, 2021
@pcrespov pcrespov modified the milestones: Chinchilla, Marmoset Jun 17, 2021
pcrespov added a commit that referenced this issue Jun 17, 2021
CHANGES: removes constraint on aiohttp (due to bug #2008) and upgrades all web-server dependencies. Cannot upgrade yarl due to change in the quotation (see test for details)
FIXES: session cookies in studies_access

* Upgrades aiohttp

* FIX: redirect session cookies are lost when response is raised since aiohttp.web_protocol.RequestHandler._handler_request ignores cookies of HTTPException

* Fixes aiohttp cookies issue: Adds check on user-auth

* Fixes auth tests

* upgraded test/tooling dependencies

* doc issue

* Full upgrade of reqs in web-server

* Adds constraint on latest yarl version
@pcrespov pcrespov modified the milestones: Marmoset, Chevrotain Aug 20, 2021
@pcrespov pcrespov added the Epic label Aug 20, 2021
@pcrespov pcrespov changed the title webserver refactoring backlog ⚗️ Webserver refactoring backlog Sep 21, 2021
@pcrespov pcrespov modified the milestones: Chevrotain, Capra delle nevi Sep 21, 2021
@pcrespov pcrespov removed the bug buggy, it does not work as expected label Sep 22, 2021
@pcrespov
Copy link
Member Author

python-socketio~=4.6.1

st_access_study_anonymously` fails with aiohttp 3.7.X #2386

Upgrading aiohttp caused a test to fail. Needs further investigation before completing the upgrade.

test_access_to_studies fails since client.session.cookiejar is empty when study is redirected.

aiohttp                   3.7.3
aiohttp-jinja2            1.2.0
aiohttp-security          0.4.0
aiohttp-session           2.9.0
aiohttp-swagger           1.0.15
    
>       expected_prj_id = await assert_redirected_to_study(resp, client.session)

tests/unit/with_dbs/fast/test_access_to_studies.py:266: ...
        # Expects auth cookie for current user
>       assert "osparc.WEBAPI_SESSION" in [c.key for c in session.cookie_jar]
E       AssertionError: assert 'osparc.WEBAPI_SESSION' in []

tests/unit/with_dbs/fast/test_access_to_studies.py:187: AssertionError
aiohttp                   3.7.2
aiohttp-jinja2            1.2.0
aiohttp-security          0.4.0
aiohttp-session           2.9.0
aiohttp-swagger           1.0.15
        # Expects auth cookie for current user
>       assert "osparc.WEBAPI_SESSION" in [c.key for c in session.cookie_jar]
E       AssertionError: assert 'osparc.WEBAPI_SESSION' in []

tests/unit/with_dbs/fast/test_access_to_studies.py:187: AssertionError
aiohttp                   3.7.1
aiohttp-jinja2            1.2.0
aiohttp-security          0.4.0
aiohttp-session           2.9.0
aiohttp-swagger           1.0.15
        # Expects auth cookie for current user
>       assert "osparc.WEBAPI_SESSION" in [c.key for c in session.cookie_jar]
E       AssertionError: assert 'osparc.WEBAPI_SESSION' in []

tests/unit/with_dbs/fast/test_access_to_studies.py:187: AssertionError
aiohttp                   3.7.0
aiohttp-jinja2            1.2.0
aiohttp-security          0.4.0
aiohttp-session           2.9.0
aiohttp-swagger           1.0.15
        # Expects auth cookie for current user
>       assert "osparc.WEBAPI_SESSION" in [c.key for c in session.cookie_jar]
E       AssertionError: assert 'osparc.WEBAPI_SESSION' in []

next downgrade is 3.6.3

aiohttp                   3.6.3
aiohttp-jinja2            1.2.0
aiohttp-security          0.4.0
aiohttp-session           2.9.0
aiohttp-swagger           1.0.15

and test passes ...

@pcrespov pcrespov changed the title ⚗️ Webserver refactoring backlog ⚗️ web-server refactoring backlog Feb 10, 2022
@pcrespov pcrespov modified the milestones: Capra delle nevi, R.Schumann Feb 10, 2022
@pcrespov pcrespov removed this from the R.Schumann milestone Mar 14, 2022
@pcrespov pcrespov removed the Epic label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:services-library issues on packages/service-libs a:webserver issue related to the webserver service dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

1 participant