ipol-journal / ipolDevel

IPOL demo system development
GNU Affero General Public License v3.0
23 stars 3 forks source link

Rewrite the dispatcher module #134

Closed kidanger closed 1 year ago

kidanger commented 1 year ago

This PR is relatively large but simplifies a lot the code. The class Dispatcher is now used directly by the core module. Core exposes the endpoint get_demorunners_stats for the CP2. Typing annotations are added and most try/except blocks are removed. Error management is simplified using result.

Unit tests are cleaned-up, more exhaustive and reimplemented using pytest

Removed endpoints:

The last two were removed because I think it's better to have a system that is as much as possible declarative and not imperative. The dispatcher's policy is now set from core's config file.

mcolom commented 1 year ago

Before approving these changes, I have some questions:

kidanger commented 1 year ago

Thank you for the review.

  1. The new tests are using pytest and should be ran with pytest ipol_demo/modules/dispatcher/test.py. Right now ci_tests/ is dedicated to run integration tests against each service. The new tests for dispatcher are more meant to be ran to validate individual commits / PR. I can set-up a first github actions workflow to run the dispatcher tests from there, to avoid the blind spot that my removal of dispatcher in all.py creates.
  2. I agree; I'll take a look at cherrypy to see how we can have both URLs served by a single server.
  3. OK. I'll can move the files to the core folder. Once most modules are converted, we can think about clean-up the folder tree a bit.
mcolom commented 1 year ago

Thanks for the changes! You can merge it into devel when you wish.

kidanger commented 1 year ago

TODO when deploying on prod: