-
Notifications
You must be signed in to change notification settings - Fork 26
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
♻️ Is638/webserver's project and directorv2 plugins refactoring #3189
♻️ Is638/webserver's project and directorv2 plugins refactoring #3189
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3189 +/- ##
======================================
Coverage 78.0% 78.0%
======================================
Files 701 701
Lines 29862 29862
Branches 3884 3884
======================================
Hits 23297 23297
Misses 5827 5827
Partials 738 738
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see if my comments below make sense.
from .director_v2_core_dynamic_services import ( | ||
DirectorServiceError, | ||
get_dynamic_service_state, | ||
get_dynamic_services, | ||
request_retrieve_dyn_service, | ||
restart, | ||
restart_dynamic_service, | ||
retrieve, | ||
start_service, | ||
stop_service, | ||
stop_services, | ||
update_cluster, | ||
run_dynamic_service, | ||
stop_dynamic_service, | ||
stop_dynamic_services_in_project, | ||
update_dynamic_service_networks_in_project, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't like how it was previously done, and not how it is done right now. It does not make it clear.
Could I suggest we only export something like.
from . import director_v2_core_computations as api_comp
from . import director_v2_core_dynamic_services as api_dynamic
And where we need to use them we do it like the following:
from director_v2_api import api_dynamic
# example usage
api_dynamic.restart()
What do you think about this suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the general idea of separating the apis. This is actually a step in that direction.
But it needs a bit more refactoring of the underlying code and tst structure before I would do the full separation. For instance, this plugin should not be centered in the director-v2,
or another example, the mock.patches should be easily modified: currently a simple change like the one you are suggesting above, it is a huge burden to make the tests pass.
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this contribution, excited to see this progress :) Very much appreciated
services/web/server/src/simcore_service_webserver/director_v2_core_base.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/director_v2_core_utils.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 let's go for this, it will definitely work for now
adapts test mocks
moves DirectorV2API as ComputationsApi
5efc355
to
12b9762
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What do these changes do?
This refactoring is a pre-requisite to extend the web-server API to selectively start/stop/restart dynamic services (in PR ##3186):
director_v2_core*.py
plugin that wraps interaction with director-v2 service rest API:director_v2_core_computations
provides python APIs for thecomputations
andcluster
resourcesdirector_v2_core_dynamic_services
provides python APIs for thedynamic_services
director_v2_core_base/utils
for common and utilsprojects
pluginprojects/projects_api.py
projects/projects_events.py
Related issue/s
How to test
CI tests in place