🐛 fix modelarts

Signed-off-by: devad <cossjie@foxmail.com>

Former-commit-id: 7b4aa9ed34cdf1eb808b727f57be5985a09f3990
This commit is contained in:
devad 2023-10-30 14:52:36 +08:00
parent 61d1870d58
commit a38cb5d4b5
2 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils"
"gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts" "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts"
"strconv"
"strings" "strings"
) )
@ -43,8 +44,8 @@ func (o *ModelArtsLink) DeleteImage(imageId string) (interface{}, error) {
func (o *ModelArtsLink) QueryImageList() (interface{}, error) { func (o *ModelArtsLink) QueryImageList() (interface{}, error) {
// modelArts获取镜像列表 // modelArts获取镜像列表
req := &modelarts.ListRepoReq{ req := &modelarts.ListRepoReq{
Offset: string(o.pageIndex), Offset: "0",
Limit: string(o.pageSize), Limit: strconv.Itoa(int(o.pageSize)),
} }
resp, err := o.svcCtx.ModelArtsImgRpc.ListReposDetails(o.ctx, req) resp, err := o.svcCtx.ModelArtsImgRpc.ListReposDetails(o.ctx, req)
if err != nil { if err != nil {
@ -114,7 +115,7 @@ func (o *ModelArtsLink) QueryTask(taskId string) (interface{}, error) {
} }
//转换成统一返回类型 //转换成统一返回类型
taskResp, err := ConvertType[modelarts.JobResponse](resp, nil) taskResp, err := ConvertType[modelarts.JobResponse](resp, o.participant)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -191,7 +191,7 @@ func ConvertType[T any](in *T, participant *models.StorelinkCenter) (interface{}
resp.Success = false resp.Success = false
return resp, nil return resp, nil
} }
resp.Success = true
resp.TaskId = inresp.Metadata.Id resp.TaskId = inresp.Metadata.Id
return resp, nil return resp, nil
@ -231,7 +231,8 @@ func ConvertType[T any](in *T, participant *models.StorelinkCenter) (interface{}
resp.Success = false resp.Success = false
return resp, nil return resp, nil
} }
resp.Success = true
resp.Task = &types.TaskSl{}
resp.Task.TaskId = inresp.Metadata.Id resp.Task.TaskId = inresp.Metadata.Id
resp.Task.TaskName = inresp.Metadata.Name resp.Task.TaskName = inresp.Metadata.Name
resp.Task.StartedAt = int64(inresp.Status.StartTime) resp.Task.StartedAt = int64(inresp.Status.StartTime)
@ -274,6 +275,7 @@ func ConvertType[T any](in *T, participant *models.StorelinkCenter) (interface{}
resp.Success = false resp.Success = false
return resp, nil return resp, nil
} }
resp.Success = true
return resp, nil return resp, nil
case *hpcAC.DeleteTaskAiResp: case *hpcAC.DeleteTaskAiResp:
var resp types.DeleteLinkTaskResp var resp types.DeleteLinkTaskResp