-
Notifications
You must be signed in to change notification settings - Fork 32
✨⚗️: Add service_meta_data column to identify legacy (non dy-sidecar) dynamic services #7542
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
Changes from all commits
93d810a
fe8526b
0dcca0c
7f26d3b
31c5082
f3896b1
5b19042
50a72a0
30e2cd9
97b267a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,22 @@ class ServiceMetaDataPublished(ServiceKeyVersion, ServiceBaseDisplay): | |
| alias="progress_regexp", | ||
| description="regexp pattern for detecting computational service's progress", | ||
| ) | ||
| strip_path: str | None = Field( | ||
| None, | ||
| description="??? Mystery Pokemon Missingo", | ||
| ) | ||
| inputs_path: str | None = Field( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a |
||
| None, | ||
| description="if this is present, the service is a modern style dv2 dynamic service", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If so, I am surprised that was not already here ... |
||
| ) | ||
| outputs_path: str | None = Field( | ||
| None, | ||
| description="if this is present, the service is a modern style dv2 dynamic service", | ||
| ) | ||
| state_paths: list[str] = Field( | ||
| None, | ||
| description="if this is present, the service is a modern style dv2 dynamic service", | ||
| ) | ||
|
|
||
| # SEE https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys | ||
| image_digest: str | None = Field( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """Introduce legacy service identification column | ||
| Revision ID: 354b5d921312 | ||
| Revises: cf8f743fd0b7 | ||
| Create Date: 2025-04-15 13:53:44.404695+00:00 | ||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "354b5d921312" | ||
| down_revision = "cf8f743fd0b7" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.add_column( | ||
| "services_meta_data", | ||
| sa.Column( | ||
| "is_classic_dynamic_service", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of copying certain labels from the image registry into columns in the
A flag like But now we face a couple of challenges to solve:
|
||
| sa.Boolean(), | ||
| server_default=sa.text("false"), | ||
| nullable=False, | ||
| ), | ||
| ) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_column("services_meta_data", "is_classic_dynamic_service") | ||
| # ### end Alembic commands ### | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,9 +89,16 @@ def _by_version(t: tuple[ServiceKey, ServiceVersion]) -> Version: | |
| ) | ||
|
|
||
| # set the service in the DB | ||
| _is_classic_dynamic_service: bool = ( | ||
| service_metadata.inputs_path is None | ||
| and service_metadata.outputs_path is None | ||
| and service_metadata.state_paths is None | ||
| ) | ||
| await services_repo.create_or_update_service( | ||
| ServiceMetaDataDBCreate( | ||
| **service_metadata.model_dump(exclude_unset=True), owner=owner_gid | ||
| **service_metadata.model_dump(exclude_unset=True, exclude={""}), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this |
||
| owner=owner_gid, | ||
| _is_classic_dynamic_service=_is_classic_dynamic_service, | ||
| ), | ||
| service_access_rights, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -410,12 +410,23 @@ async def get_image_details( | |
| if not labels: | ||
| return image_details | ||
| for key in labels: | ||
| if not key.startswith("io.simcore."): | ||
| if not key.startswith("io.simcore.") and not key.startswith( | ||
| "simcore.service." | ||
| ): # Keeping "simcore.service." adds additonally input_paths, output_paths, state_paths | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add some tests on these conditions. |
||
| continue | ||
| try: | ||
| label_data = json.loads(labels[key]) | ||
| for label_key in label_data: | ||
| if ( | ||
| isinstance(label_key, dict) | ||
| or isinstance(label_data, list) | ||
| or isinstance(label_data, str) | ||
| ): # Dicts from "simcore.service." docker image labels are omitted. | ||
| continue | ||
| image_details[label_key] = label_data[label_key] | ||
| except json.JSONDecodeError: | ||
| label_data = [] # Set to empty list if the value is not JSON | ||
| pass | ||
| except json.decoder.JSONDecodeError: | ||
| logging.exception( | ||
| "Error while decoding json formatted data from %s:%s", | ||
|
|
||
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.
what is this?