-
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
✨ Enhancement/get node resources #2987
✨ Enhancement/get node resources #2987
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2987 +/- ##
=======================================
Coverage 79.5% 79.6%
=======================================
Files 686 688 +2
Lines 28571 28694 +123
Branches 3683 3701 +18
=======================================
+ Hits 22731 22847 +116
+ Misses 5030 5029 -1
- Partials 810 818 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
|
8270e68
to
295b0e7
Compare
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.
Excellent. Some comments and thoughts
packages/models-library/src/models_library/service_settings_labels.py
Outdated
Show resolved
Hide resolved
logger.debug("received %s", f"{service_settings}") | ||
|
||
def _from_service_settings( | ||
settings: List[SimcoreServiceSettingLabelEntry], |
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.
THOUGHT: I wonder if at some point this function should be attached as utils close to SimcoreServiceSettingsLabelEntrty
.
See for instance in integration-library
There a model can be exported to or parsed from to label annotations
NOTE1: export and parse are the fundamental operations in pydantic
NOTE2: OCI standard officially call to the docker labels as "label annotations".
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.
yes unless there are dependencies that the model_library cannot cope with.
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.
and I find a bit confusing to rename labels into annotations actually. but if the next docker version does it I'll do it too.
get_default_service_resources | ||
), | ||
): | ||
# TODO: --> PC: I'll need to go through that with you for function services, |
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.
Yes, we have to review this. Currently these servcies do not consume any significant resources. So either we set them to 0 or remove them from the listing. Let's discuss about it offline.
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.
0 is out of the discussion. I disagree. or we will end up with things suddenly consuming resource somewhere totally wild.
services/catalog/src/simcore_service_catalog/models/schemas/services.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/projects_nodes_handlers.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/projects_nodes_handlers.py
Show resolved
Hide resolved
aiohttp_client(app, server_kwargs={"port": app_cfg["main"]["port"]}) | ||
) | ||
# @pytest.fixture | ||
# def app_cfg(default_app_cfg: ConfigDict, unused_tcp_port_factory: Callable): |
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.
Forgot to delete? Why commented
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.
ah yes, that is what I was trying to ask you this morning...
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 would like to discuss app_cfg and client fixtures, cause I find them a bit confusing. and I wonder if I'm not missing something there.
7a699ad
to
9fa8567
Compare
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.
Nice. Just not sure about the 2Gb limit for all services which do not specify any limit. As said below I would go for something much lower and let the users adjust if their services fail.
"bootOptions": { | ||
"title": "Bootoptions", | ||
"type": "object", | ||
"description": "Some services provide alternative parameters to be injected at boot time. The user selection should be stored here, and it will overwrite the services's defaults." |
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.
how come I see bootOptions here? Uhm... I wonder what happened.
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.
well this is generated with the make openapi-spec
recipe.. not sure when it was run last time...
"limit": ByteSize(2 * 1024**3), | ||
"reservation": ByteSize(2 * 1024**3), |
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.
Wait, so by default you get 2 GB limit and reservation? Are we sure about this? Should we not bring the values in the MB ranges?
For example, when defining services like the sim4life. You have an Nginx without any constraints. It is not worth it to assign so many resources for a service which requires almost 100 MB.
I'd suggest to bump it down to 100MB (or something in this range), and let people explicitly ask for more resources if required. I think this will help with reducing memory consumption by a lot.
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.
ok, so that is the value that was here already before. Open to discussion but in a separate PR cause it might have other implications. That is what the current director-v0 also does (but not wired to this one for now), so it could have issues with some older services.
Now concerning your use case:
- this call returns the total envelope, not the nginx service. so for computing the nginx service in your compose it should go with: get service limit/resources - what is defined in the compose for specifics = nginx (+ maybe other) services limits
What do these changes do?
A resource is a number (int or float) or a string that represents a named resource (currently such as CPU, RAM, VRAM, AIRAM, MPI).
Each resource has 2 such values, one that represents a reservation (for schedule-time) to define if a service can be started (is there still machine with enough CPUs to start he service?) and a limit (for runtime) that is used to stop a service that would go over that limit.
A resource limit is always at least equal to a resource reservation.
Currently the resources used for running osparc services are statically defined on the service docker images.
These values may be retrieved using the following new API endpoints in the webserver:
/catalog/services/{service_key}/{service_version}/resources
/projects/{puuid}/nodes/{node_uuid}/resources
And in the catalog
/services/{service_key}/{service_version}/resources
In this PR, only the static values are ever retrieved. In the near future, it will be possible to modify the limits on a particular service.
This means the current implementation in the webserver ALWAYS returns the values from the catalog service
NOTE: this implementation returns "raw" resources such as VRAM. these are used as is for running dynamic services
Related issue/s
ITISFoundation/osparc-issues#618
How to test
Checklist