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

✨ Personalized resource limits: add API to change node resources ⚠️🗃️ #4374

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Jun 16, 2023

What do these changes do?

  • open webserver API image
  • currently allows changes with no limits !!! --> reserved to TESTER users only for now then we will add per group allowance
  • webserver API for getting/putting node resources now directly connects with projects_nodes table @odeimaiz please ensure you do not use catalog//resources as this returns the default values not the ones saved into the project. The projects//nodes/*/resources also returns the default if it's missing from the database. Or let's check if this has any need. plan is to deprecate it.
  • udpated project duplication procedure to also copy project nodes table with defined resources
  • updated director-v2 computations creation to also use the projects_nodes table instead of direct call to catalog
  • updated dynamic services startup procedure to take the project node resources instead of default
  • default uses the service docker labels or whatever might be changed in services_specifications table as before
  • database migration code to create all the necessary projects_nodes entries required by each project (this may take some time to migrate, local tests with staging dalco takes about 10-20 seconds) ⚠️🗃️
  • all pytest fixtures in webserver/director-v2/postgres-database are adapted to also create entries in projects_nodes

Notice the procedure now for resources:

  • When a project is created, and nodes added currently both the projects/*workbench and a new row in projects_nodes is added with the default resources as given by the catalog service
  • If this is a dynamic node, at start the webserver retrieves the resources and uses them to start the service
  • If this is a computational node, at start the director-v2 retrieves the resources and uses them to schedule the service on the dask backend.

Bonuses:

  • utils_projects_nodes now allows bulk insertion instead of sequential, much faster
  • IMPORTANT NOTE: testing postgres-database will now turn into errors anything related to pre-sql 2.0 code
  • removed warnings that says DO NOT USE IN PRODUCTION, STILL UNDER DEVELOPMENT as it's a lie
  • skip test_acquire_all_available_node_locks_stress_test @GitHK to be removed with remove node rights from director-v2 #4405
  • test_project_db.py got some magnitude of orders faster

Related issue/s

How to test

make build up-prod
# then head to create a study, add a service
# go to check the projects_nodes table in adminer
# change the values there, or use the /dev/doc entrypoint
# break your computer 💥 

DevOps Checklist

  • breaks availability if used wildly. but not sure that is worse than before. reserved for TESTER users for now.

@sanderegg sanderegg added the a:webserver issue related to the webserver service label Jun 16, 2023
@sanderegg sanderegg added this to the Watermelon milestone Jun 16, 2023
@sanderegg sanderegg self-assigned this Jun 16, 2023
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #4374 (0f80be1) into master (7047efc) will decrease coverage by 0.5%.
The diff coverage is 96.6%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #4374     +/-   ##
========================================
- Coverage    86.1%   85.7%   -0.5%     
========================================
  Files         954     995     +41     
  Lines       40291   42585   +2294     
  Branches     1007    1009      +2     
========================================
+ Hits        34718   36521   +1803     
- Misses       5342    5832    +490     
- Partials      231     232      +1     
Flag Coverage Δ
integrationtests 54.6% <49.6%> (-13.4%) ⬇️
unittests 83.7% <96.6%> (+0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rc/simcore_service_webserver/projects/_db_utils.py 97.1% <ø> (ø)
...imcore_service_webserver/security/_access_roles.py 100.0% <ø> (ø)
..._service_webserver/studies_dispatcher/_projects.py 93.8% <ø> (ø)
...ce_webserver/studies_dispatcher/_studies_access.py 91.1% <ø> (ø)
...simcore_service_webserver/projects/projects_api.py 93.1% <88.0%> (-0.4%) ⬇️
.../simcore_postgres_database/utils_projects_nodes.py 96.0% <90.6%> (-4.0%) ⬇️
..._director_v2/modules/db/repositories/comp_tasks.py 97.3% <95.2%> (+0.1%) ⬆️
...s-library/src/models_library/services_resources.py 90.7% <100.0%> (ø)
...base/src/simcore_postgres_database/utils_models.py 100.0% <100.0%> (ø)
...rary/src/servicelib/aiohttp/requests_validation.py 86.3% <100.0%> (ø)
... and 7 more

... and 63 files with indirect coverage changes

@sanderegg sanderegg force-pushed the personalized-resource-limits/keep-selected-resources-in-projects-nodes branch 2 times, most recently from 2298fe0 to 4b837ba Compare June 16, 2023 14:29
@sanderegg sanderegg changed the title ✨ Personalized resource limits: keep selected resources in projects nodes ✨ Personalized resource limits: add API to change node resources Jun 16, 2023
@sanderegg sanderegg added the a:director-v2 issue related with the director-v2 service label Jun 16, 2023
@sanderegg sanderegg force-pushed the personalized-resource-limits/keep-selected-resources-in-projects-nodes branch 8 times, most recently from 993ff6d to a4c3d64 Compare June 22, 2023 07:57
@sanderegg sanderegg force-pushed the personalized-resource-limits/keep-selected-resources-in-projects-nodes branch 4 times, most recently from 9b864bf to ae17e2c Compare June 22, 2023 14:44
@sanderegg sanderegg changed the title ✨ Personalized resource limits: add API to change node resources ✨ Personalized resource limits: add API to change node resources ⚠️🗃️ Jun 22, 2023
@sanderegg sanderegg marked this pull request as ready for review June 22, 2023 15:22
@sanderegg sanderegg force-pushed the personalized-resource-limits/keep-selected-resources-in-projects-nodes branch from 74c1969 to 0f80be1 Compare June 23, 2023 12:23
@codeclimate
Copy link

codeclimate bot commented Jun 23, 2023

Code Climate has analyzed commit 0f80be1 and detected 0 issues on this pull request.

View more on Code Climate.

@sonarcloud
Copy link

sonarcloud bot commented Jun 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sanderegg sanderegg enabled auto-merge (squash) June 23, 2023 13:11
@sanderegg sanderegg disabled auto-merge June 23, 2023 13:12
@sanderegg sanderegg merged commit 610e363 into ITISFoundation:master Jun 23, 2023
@sanderegg sanderegg deleted the personalized-resource-limits/keep-selected-resources-in-projects-nodes branch June 23, 2023 13:12
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 👍 really nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:director-v2 issue related with the director-v2 service a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persist resources used by node in project (check comp_tasks, or new table)
4 participants