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

fix(cli): do not freeze/unfreeze plan view model #3599

Merged
merged 5 commits into from Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions renku/domain_model/dataset.py
Expand Up @@ -180,7 +180,7 @@ class ImageObject(Slots):

id: str
content_url: str
position: str
position: int

def __init__(self, *, content_url: str, id: str, position: int):
id = get_path(id)
Expand Down Expand Up @@ -656,8 +656,9 @@ def update_metadata_from(self, other: "Dataset", exclude=None):
# and not match the SHACL definition for Renku. This cannot be addressed in the dataset
# providers because the dataset providers do not have access to the dataset ID which is needed
# for setting the dataset image ID.
for image_ind in range(len(self.images)):
self.images[image_ind].id = ImageObject.generate_id(self.id, self.images[image_ind].position)
if isinstance(self.images, list):
for image_ind in range(len(self.images)):
self.images[image_ind].id = ImageObject.generate_id(self.id, self.images[image_ind].position)

def update_metadata(self, **kwargs):
"""Updates metadata."""
Expand Down
9 changes: 7 additions & 2 deletions renku/ui/service/serializers/workflows.py
Expand Up @@ -21,6 +21,7 @@
from marshmallow_oneofschema import OneOfSchema

from renku.domain_model.dataset import DatasetCreatorsJson
from renku.infrastructure.persistent import Persistent
from renku.ui.cli.utils.plugins import get_supported_formats
from renku.ui.service.serializers.common import RemoteRepositorySchema
from renku.ui.service.serializers.rpc import JsonRPCResponse
Expand Down Expand Up @@ -48,9 +49,13 @@ def fix_ids(self, objs, many, **kwargs):
"""Renku up to 2.4.1 had a bug that created wrong ids for workflow file entities, this fixes those on export."""

def _replace_id(obj):
obj.unfreeze()
if isinstance(obj, Persistent):
obj.unfreeze()

obj.id = obj.id.replace("//plans/", "/")
obj.freeze()

if isinstance(obj, Persistent):
obj.freeze()

if many:
for obj in objs:
Expand Down