Skip to content

Commit

Permalink
chore(controller): make shared boolean (#3055)
Browse files Browse the repository at this point in the history
  • Loading branch information
jialeicui authored Dec 4, 2023
1 parent b6fc2d5 commit 4ddef36
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 24 deletions.
12 changes: 6 additions & 6 deletions client/starwhale/base/client/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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')


Expand Down Expand Up @@ -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')


Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class DatasetInfoVo implements Serializable {

@NotNull
@JsonProperty("shared")
private Integer shared;
private Boolean shared;

@NotNull
@JsonProperty("createdTime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class DatasetVersionViewVo {
private Boolean latest;

@NotNull
private Integer shared;
private Boolean shared;

@NotNull
private Long createdTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ModelInfoVo implements Serializable {

@NotNull
@JsonProperty("shared")
private Integer shared;
private Boolean shared;

@NotNull
private ModelVersionVo versionInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ModelVersionViewVo {
private List<String> tags;

@NotNull
private Integer shared;
private Boolean shared;

private Boolean draft;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class RuntimeInfoVo implements Serializable {

@NotNull
@JsonProperty("shared")
private Integer shared;
private Boolean shared;

@NotNull
@JsonProperty("createdTime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class RuntimeVersionViewVo {
private Boolean latest;

@NotNull
private Integer shared;
private Boolean shared;

@NotNull
private Long createdTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -253,7 +251,7 @@ private List<DatasetViewVo> viewEntityToVo(List<DatasetVersionViewEntity> 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());
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -460,7 +458,7 @@ private List<ModelViewVo> viewEntityToVo(List<ModelVersionViewEntity> 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()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -260,7 +258,7 @@ private List<RuntimeViewVo> viewEntityToVo(List<RuntimeVersionViewEntity> 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());
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4ddef36

Please sign in to comment.