From 4ddef36b5e39986765809e08e09a0852f8193294 Mon Sep 17 00:00:00 2001 From: Jialei Date: Mon, 4 Dec 2023 16:17:32 +0800 Subject: [PATCH] chore(controller): make shared boolean (#3055) --- client/starwhale/base/client/models/models.py | 12 ++++++------ .../mlops/api/protocol/dataset/DatasetInfoVo.java | 2 +- .../api/protocol/dataset/DatasetVersionViewVo.java | 2 +- .../mlops/api/protocol/model/ModelInfoVo.java | 2 +- .../mlops/api/protocol/model/ModelVersionViewVo.java | 2 +- .../mlops/api/protocol/runtime/RuntimeInfoVo.java | 2 +- .../api/protocol/runtime/RuntimeVersionViewVo.java | 2 +- .../mlops/domain/dataset/DatasetService.java | 6 ++---- .../starwhale/mlops/domain/model/ModelService.java | 6 ++---- .../mlops/domain/runtime/RuntimeService.java | 6 ++---- 10 files changed, 18 insertions(+), 24 deletions(-) diff --git a/client/starwhale/base/client/models/models.py b/client/starwhale/base/client/models/models.py index 0a382cb0fa..e33bb3bbef 100644 --- a/client/starwhale/base/client/models/models.py +++ b/client/starwhale/base/client/models/models.py @@ -633,7 +633,7 @@ class RuntimeInfoVo(SwBaseModel): version_tag: Optional[str] = Field(None, alias='versionTag') version_meta: Optional[str] = Field(None, alias='versionMeta') manifest: str - shared: int + shared: bool created_time: int = Field(..., alias='createdTime') files: Optional[List[FlattenFileVo]] = None @@ -682,7 +682,7 @@ class RuntimeVersionViewVo(SwBaseModel): version_name: str = Field(..., alias='versionName') alias: str latest: bool - shared: int + shared: bool created_time: int = Field(..., alias='createdTime') @@ -784,7 +784,7 @@ class DatasetVersionViewVo(SwBaseModel): version_name: str = Field(..., alias='versionName') alias: Optional[str] = None latest: bool - shared: int + shared: bool created_time: int = Field(..., alias='createdTime') @@ -989,7 +989,7 @@ class DatasetInfoVo(SwBaseModel): version_name: str = Field(..., alias='versionName') version_alias: Optional[str] = Field(None, alias='versionAlias') version_tag: Optional[str] = Field(None, alias='versionTag') - shared: int + shared: bool created_time: int = Field(..., alias='createdTime') files: Optional[List[FlattenFileVo]] = None version_meta: str = Field(..., alias='versionMeta') @@ -1559,7 +1559,7 @@ class ModelInfoVo(SwBaseModel): version_name: str = Field(..., alias='versionName') version_tag: Optional[str] = Field(None, alias='versionTag') created_time: int = Field(..., alias='createdTime') - shared: int + shared: bool class ResponseMessageModelInfoVo(SwBaseModel): @@ -1709,7 +1709,7 @@ class ModelVersionViewVo(SwBaseModel): alias: str latest: bool tags: Optional[List[str]] = None - shared: int + shared: bool draft: Optional[bool] = None step_specs: List[StepSpec] = Field(..., alias='stepSpecs') built_in_runtime: Optional[str] = Field(None, alias='builtInRuntime') diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetInfoVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetInfoVo.java index 07c9f18d73..38083f1ef6 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetInfoVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetInfoVo.java @@ -62,7 +62,7 @@ public class DatasetInfoVo implements Serializable { @NotNull @JsonProperty("shared") - private Integer shared; + private Boolean shared; @NotNull @JsonProperty("createdTime") diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetVersionViewVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetVersionViewVo.java index f4c620c045..d4a56b8508 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetVersionViewVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/dataset/DatasetVersionViewVo.java @@ -40,7 +40,7 @@ public class DatasetVersionViewVo { private Boolean latest; @NotNull - private Integer shared; + private Boolean shared; @NotNull private Long createdTime; diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelInfoVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelInfoVo.java index 3a78097bcd..7f0b05c01b 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelInfoVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelInfoVo.java @@ -59,7 +59,7 @@ public class ModelInfoVo implements Serializable { @NotNull @JsonProperty("shared") - private Integer shared; + private Boolean shared; @NotNull private ModelVersionVo versionInfo; diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelVersionViewVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelVersionViewVo.java index 0f9b695ffb..35dda19ff3 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelVersionViewVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/model/ModelVersionViewVo.java @@ -45,7 +45,7 @@ public class ModelVersionViewVo { private List tags; @NotNull - private Integer shared; + private Boolean shared; private Boolean draft; diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeInfoVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeInfoVo.java index ad85906570..980701c6cb 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeInfoVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeInfoVo.java @@ -65,7 +65,7 @@ public class RuntimeInfoVo implements Serializable { @NotNull @JsonProperty("shared") - private Integer shared; + private Boolean shared; @NotNull @JsonProperty("createdTime") diff --git a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeVersionViewVo.java b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeVersionViewVo.java index 21a147bb72..67300defc1 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeVersionViewVo.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/api/protocol/runtime/RuntimeVersionViewVo.java @@ -42,7 +42,7 @@ public class RuntimeVersionViewVo { private Boolean latest; @NotNull - private Integer shared; + private Boolean shared; @NotNull private Long createdTime; diff --git a/server/controller/src/main/java/ai/starwhale/mlops/domain/dataset/DatasetService.java b/server/controller/src/main/java/ai/starwhale/mlops/domain/dataset/DatasetService.java index 35e3ba34ec..fa08055d3f 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/domain/dataset/DatasetService.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/domain/dataset/DatasetService.java @@ -16,8 +16,6 @@ package ai.starwhale.mlops.domain.dataset; -import static cn.hutool.core.util.BooleanUtil.toInt; - import ai.starwhale.mlops.api.protocol.dataset.DatasetInfoVo; import ai.starwhale.mlops.api.protocol.dataset.DatasetVersionViewVo; import ai.starwhale.mlops.api.protocol.dataset.DatasetVersionVo; @@ -253,7 +251,7 @@ private List viewEntityToVo(List list, .alias(versionAliasConvertor.convert(entity.getVersionOrder())) .latest(entity.getId() != null && entity.getId().equals(latest.getId())) .createdTime(entity.getCreatedTime().getTime()) - .shared(toInt(entity.getShared())) + .shared(entity.getShared()) .build()); } return new ArrayList<>(map.values()); @@ -323,7 +321,7 @@ private DatasetInfoVo toDatasetInfoVo(DatasetEntity ds, DatasetVersionEntity ver .versionMeta(versionEntity.getVersionMeta()) .createdTime(versionEntity.getCreatedTime().getTime()) .indexTable(versionEntity.getIndexTable()) - .shared(toInt(versionEntity.getShared())) + .shared(versionEntity.getShared()) .versionInfo(versionConvertor.convert( versionEntity, versionEntity, diff --git a/server/controller/src/main/java/ai/starwhale/mlops/domain/model/ModelService.java b/server/controller/src/main/java/ai/starwhale/mlops/domain/model/ModelService.java index a03d0b3035..2cc5352d82 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/domain/model/ModelService.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/domain/model/ModelService.java @@ -16,8 +16,6 @@ package ai.starwhale.mlops.domain.model; -import static cn.hutool.core.util.BooleanUtil.toInt; - import ai.starwhale.mlops.api.protocol.model.CreateModelVersionRequest; import ai.starwhale.mlops.api.protocol.model.CreateModelVersionRequest.ModelSourceType; import ai.starwhale.mlops.api.protocol.model.InitUploadBlobRequest; @@ -328,7 +326,7 @@ private ModelInfoVo toModelInfoVo(ModelEntity model, ModelVersionEntity version) .versionName(version.getVersionName()) .versionTag(version.getVersionTag()) .createdTime(version.getCreatedTime().getTime()) - .shared(toInt(version.getShared())) + .shared(version.getShared()) .versionInfo(versionConvertor.convert(version, version, tags.get(version.getId()))) .build(); } @@ -460,7 +458,7 @@ private List viewEntityToVo(List list, Proj .tags(versionTags) .latest(entity.getId() != null && entity.getId().equals(latest)) .createdTime(entity.getCreatedTime().getTime()) - .shared(toInt(entity.getShared())) + .shared(entity.getShared()) .draft(entity.getDraft()) .builtInRuntime(entity.getBuiltInRuntime()) .stepSpecs(jobSpecParser.parseAndFlattenStepFromYaml(entity.getJobs())) diff --git a/server/controller/src/main/java/ai/starwhale/mlops/domain/runtime/RuntimeService.java b/server/controller/src/main/java/ai/starwhale/mlops/domain/runtime/RuntimeService.java index 05e25844b8..849135127e 100644 --- a/server/controller/src/main/java/ai/starwhale/mlops/domain/runtime/RuntimeService.java +++ b/server/controller/src/main/java/ai/starwhale/mlops/domain/runtime/RuntimeService.java @@ -16,8 +16,6 @@ package ai.starwhale.mlops.domain.runtime; -import static cn.hutool.core.util.BooleanUtil.toInt; - import ai.starwhale.mlops.api.protocol.runtime.BuildImageResult; import ai.starwhale.mlops.api.protocol.runtime.ClientRuntimeRequest; import ai.starwhale.mlops.api.protocol.runtime.RuntimeInfoVo; @@ -260,7 +258,7 @@ private List viewEntityToVo(List list, .alias(versionAliasConvertor.convert(entity.getVersionOrder())) .latest(entity.getId() != null && entity.getId().equals(latest.getId())) .createdTime(entity.getCreatedTime().getTime()) - .shared(toInt(entity.getShared())) + .shared(entity.getShared()) .build()); } return new ArrayList<>(map.values()); @@ -339,7 +337,7 @@ private RuntimeInfoVo toRuntimeInfoVo(RuntimeEntity rt, RuntimeVersionEntity ver .versionName(versionEntity.getVersionName()) .versionTag(versionEntity.getVersionTag()) .versionMeta(versionEntity.getVersionMeta()) - .shared(toInt(versionEntity.getShared())) + .shared(versionEntity.getShared()) .createdTime(versionEntity.getCreatedTime().getTime()) .versionInfo(versionConvertor.convert( versionEntity,