-
Notifications
You must be signed in to change notification settings - Fork 27
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
♻️ gc as a service (preparation) #2828
♻️ gc as a service (preparation) #2828
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2828 +/- ##
========================================
- Coverage 78.9% 78.7% -0.2%
========================================
Files 671 673 +2
Lines 27290 27336 +46
Branches 3174 3182 +8
========================================
- Hits 21550 21534 -16
- Misses 4978 5041 +63
+ Partials 762 761 -1
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.
Looking nice.
One thing. Why refer to the same item with the words plugin and add-on? Can't we just use one of them to avoid confusion?
services/web/server/src/simcore_service_webserver/resource_manager/module_setup.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/resource_manager/module_setup.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/resource_manager/module_setup.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.
Great! please just have a look at my comments and especially about the resource manager plugin being an ADDON vs SYSTEM where I am not sure that is safe to do
else: | ||
assert isinstance(searched_config, bool) # nosec | ||
return searched_config |
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.
why the else
here?
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.
it is part of try ... except ... else
. From https://docs.python.org/3/tutorial/errors.html#handling-exceptions
The try … except statement has an optional else clause, which, when present, must follow all except clauses. It is useful for code that must be executed if the try clause does not raise an exception
uninitialized = [ | ||
dep for dep in depends if dep not in app[APP_SETUP_KEY] | ||
] | ||
# TODO: no need to enforce. Use to deduce order instead. |
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 am not sure I get the meaning of that comment. you raise an exception if a dependency is missing right? is that not enforcing?
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.
Right, my point here is that perhaps there is no need to enforce that those were already initialized but instead e.g. the decorator's wrapper could could them itself. It is just a note to think about it ... not relevant for this PR.
The dependencies is a design feature I got from s4l but my experience tells me that it does not really get updated.
@@ -358,8 +358,7 @@ services: | |||
- default | |||
|
|||
postgres: | |||
image: "postgres:10.11@sha256:2aef165ab4f30fbb109e88959271d8b57489790ea13a77d27\ | |||
c02d8adb8feb20f" | |||
image: "postgres:10.11@sha256:2aef165ab4f30fbb109e88959271d8b57489790ea13a77d27c02d8adb8feb20f" |
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.
just a thought but I wonder if we should not update that one once... current version is 14.x
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.
@sanderegg please add a maintenance case for it and we can follow up
services/web/server/src/simcore_service_webserver/application_settings.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/resource_manager/module_setup.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/resource_manager/module_setup.py
Outdated
Show resolved
Hide resolved
@@ -15,7 +15,7 @@ | |||
|
|||
|
|||
@app_module_setup( | |||
"simcore_service_webserver.socketio", ModuleCategory.SYSTEM, logger=log | |||
"simcore_service_webserver.socketio", ModuleCategory.ADDON, logger=log |
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.
this one I do agree. this can be an ADDON since this is something that does not prevent the webserver from functioning
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.
this is not the case for the webserver-GC . AFAIK it is not needed there, right?
eb29468
to
c20b77a
Compare
thanks for the notice and for the detailed write-up! |
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.
👍
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.
thx
c8d21ee
to
da0cf81
Compare
469cc68
to
7ca4ec6
Compare
What do these changes do?
In preparation to have a garbage-collector (gc) as a stand-alone service and separate from the the web-server ( coming in PR #2819) , the web-server needed some refactoring. Most of the work focus on two ideas:
resource_manager
plugin (where gc functionality is) and the rest of the web-server modulesThat lead to two main changes:
app_module_setup
decorator usesApplicationSettings.WEBSERVER_*
values to disable addonsresource_manager
plugin to stand-alone plugins calledgarbage_collector
andredis
resp.Plugins Design Rationale (reminder)
The web-server consists of multiple plugins (also referred as app modules) that can be enable/disabled via env vars to compose an app with different functionality.
Each plugin consists of one or more python modules with the same name prefix or under the same folder. It has settings (added as a section in the
application_settings.ApplicationSettings
) and has a setup function that is called duringapplication.create_application
.For instance, a hypothetical
myplugin
plugin might have this skeletonIn
myplugin_settings.py
defines the plugin's settingsIn
myplugin.py
a setup function that is registered using theapp_module_setup
decorator.To disable the plugin, we just need to set
WEBSERVER_MYPLUGIN=null
the setup will be skip. That means that all the filesmyplugin_*
could eventually only be imported to be used as a library.With this PR, we will be able to enable all plugins to compose a web-server with only the functionality of the garbage-collector. Then we can create a dedicated service in the stack (e.g.
webserver-garbage-collector
) responsible for that task and remove that responsibility from the currentwebserver
.NOTE: @mrnicegyu11 @Surfict @colinRawlings @KZzizzle rationale above might be of interest for you.
Related issue/s
How to test
web-server tests cover all changes
Checklist
make openapi-specs
,git commit ...
and thenmake version-*
)cd packages/postgres-database
,make setup-commit
,sc-pg review -m "my changes"