Skip to content

Commit

Permalink
fix(cli): do not freeze/unfreeze plan view model (#3599)
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Grubenmann <ralf.grubenmann@sdsc.ethz.ch>
  • Loading branch information
olevski and Panaetius committed Aug 23, 2023
1 parent f624b2b commit dab2688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions renku/domain_model/dataset.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 LocalRepositorySchema, 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

0 comments on commit dab2688

Please sign in to comment.