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

🎨 expose service_run_id as an env var for both comp and new style dynamic services #6942

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

GitHK
Copy link
Contributor

@GitHK GitHK commented Dec 11, 2024

What do these changes do?

NOTE: this became very noisy due to a rename and unification of the names

The ${OSPARC_VARIABLE_SERVICE_RUN_ID} will now be replaced in the compose spec with the actual service_run_id.

The service_run_id must be exposed for both comp and dynamic services it's a requirement for some comp services.

Bonus: unified service_run_id under one type ServiceRunID shared by all services

Related issue/s

How to test

Dev-ops checklist

@GitHK GitHK self-assigned this Dec 11, 2024
@GitHK GitHK added the a:director-v2 issue related with the director-v2 service label Dec 11, 2024
@GitHK GitHK added this to the Event Horizon milestone Dec 11, 2024
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.32%. Comparing base (acd677a) to head (e726e78).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6942      +/-   ##
==========================================
- Coverage   87.06%   85.32%   -1.74%     
==========================================
  Files        1611     1394     -217     
  Lines       63621    58279    -5342     
  Branches     2026     1637     -389     
==========================================
- Hits        55392    49729    -5663     
- Misses       7895     8279     +384     
+ Partials      334      271      -63     
Flag Coverage Δ
integrationtests 64.65% <89.28%> (-2.34%) ⬇️
unittests 83.96% <95.31%> (-1.39%) ⬇️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 91.46% <100.00%> (+0.09%) ⬆️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 70.02% <ø> (ø)
pkg_service_library 74.20% <0.00%> (ø)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.38% <ø> (ø)
agent 96.82% <100.00%> (ø)
api_server 90.13% <ø> (ø)
autoscaling 96.09% <ø> (ø)
catalog ∅ <ø> (∅)
clusters_keeper 99.48% <ø> (ø)
dask_sidecar 91.26% <ø> (ø)
datcore_adapter 93.18% <ø> (ø)
director 76.49% <ø> (+0.08%) ⬆️
director_v2 91.43% <93.33%> (ø)
dynamic_scheduler 97.10% <ø> (ø)
dynamic_sidecar 89.75% <100.00%> (ø)
efs_guardian 90.12% <ø> (ø)
invitations 93.44% <ø> (ø)
osparc_gateway_server ∅ <ø> (∅)
payments 92.66% <ø> (ø)
resource_usage_tracker 89.62% <100.00%> (+0.30%) ⬆️
storage 89.54% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 79.94% <100.00%> (-4.46%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acd677a...e726e78. Read the comment docs.

Andrei Neagu added 3 commits December 12, 2024 16:34
…-id' of github.com:GitHK/osparc-simcore-forked into pr-osparc-allow-user-services-to-request-dy-sidecar-run-id
@GitHK GitHK changed the title 🎨 dynamic-service can now request the run id at runtime in their env vars 🎨 expose run_id as an env var for both comp and new style dynamic services Dec 13, 2024
@GitHK GitHK marked this pull request as ready for review December 13, 2024 07:43
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

ok, but wrong computational run id

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

added some comments

@GitHK GitHK requested a review from sanderegg December 13, 2024 08:49
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.

I’m fine with this unification 👍, but are we 100% sure that the concept of a run ID is the same in all three use cases: computation, dynamic, and resource usage tracker?

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

Good for me but please check my comments about the naming, and at least use import RunID as ServiceRunID in all the computational related modules in dv-2.

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

please reassign back when unblocked. thx

@GitHK GitHK changed the title 🎨 expose run_id as an env var for both comp and new style dynamic services 🎨 expose service_run_id as an env var for both comp and new style dynamic services Dec 16, 2024
@GitHK GitHK requested review from sanderegg and pcrespov December 17, 2024 11:58
Copy link

sonarcloud bot commented Dec 17, 2024

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

thx

from .users import UserID

if TYPE_CHECKING:
from .projects import ProjectID
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why this this necessary? Is it because of cyclic dependencies?

TIP: For things like ProjectID we can always move these to common_library. I already did that with user_enums and groups_enums (check how it is imported in the Groups and Users models)

@@ -120,6 +121,7 @@ def create(cls, app: FastAPI):
("OSPARC_VARIABLE_NODE_ID", "node_id"),
("OSPARC_VARIABLE_PRODUCT_NAME", "product_name"),
("OSPARC_VARIABLE_STUDY_UUID", "project_id"),
("OSPARC_VARIABLE_SERVICE_RUN_ID", "run_id"),
Copy link
Member

Choose a reason for hiding this comment

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

ok.
TIP: did you know that now you can check the new registered osparc variable using the CLI?

$ cd services/director-v2
$ make install-dev
$ simcore-service osparc-variables 
OSPARC_VARIABLE_API_HOST
OSPARC_VARIABLE_API_KEY
OSPARC_VARIABLE_API_SECRET
OSPARC_VARIABLE_NODE_ID
OSPARC_VARIABLE_PRODUCT_NAME
OSPARC_VARIABLE_STUDY_UUID
OSPARC_VARIABLE_USER_EMAIL
OSPARC_VARIABLE_USER_ID
OSPARC_VARIABLE_USER_ROLE

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

thanks!

@@ -44,12 +54,15 @@ class RunID(str):
and old volumes for different runs.
Avoids overwriting data that left dropped on the node (due to an error)
and gives the osparc-agent an opportunity to back it up.
The resource-usage-tracker tracker uses these RunIDs to keep track of
resource usage from comp and dynamic services.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
resource usage from comp and dynamic services.
resource usage from computational and dynamic services.

@@ -68,7 +92,7 @@ def __get_pydantic_core_schema__(
return core_schema.no_info_after_validator_function(cls, handler(str))

@classmethod
def validate(cls, v: "RunID | str", _: ValidationInfo) -> "RunID":
def validate(cls, v: "ServiceRunID | str", _: ValidationInfo) -> "ServiceRunID":
Copy link
Member

Choose a reason for hiding this comment

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

Q: should this not raise a ValueError instead of TypeError?

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants