core端创建算法查询算法

This commit is contained in:
lee 2023-03-09 09:39:14 +08:00
parent 3afac532b5
commit bba5f60803
5 changed files with 17 additions and 28 deletions

View File

@ -341,7 +341,7 @@ type MetadataAlRp {
Id string `json:"id,optional"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
CreateTime int32 `json:"create_time,optional"`
CreateTime uint64 `json:"create_time,optional"`
WorkspaceId string `json:"workspace_id,optional"`
AiProject string `json:"ai_project,optional"`
UserName string `json:"user_name,optional"`
@ -354,7 +354,7 @@ type MetadataAlRp {
Tags []*TagsAlRp `json:"tags,optional"`
AttrList []string `json:"attr_list,optional"`
VersionNum int32 `json:"version_num,optional"`
UpdateTime int32 `json:"update_time,optional"`
UpdateTime uint64 `json:"update_time,optional"`
}
type TagsAlRp {
@ -671,14 +671,14 @@ type Cluster {
/******************ListAlgorithms start*************************/
type (
ListAlgorithmsReq {
ProjectId string `json:"project_id"`
Offset int32 `json:"offset,optional"`
Limit int32 `json:"limit,optional"`
SortBy string `json:"sort_by,optional"`
Order string `json:"order,optional"`
GroupBy string `json:"group_by,optional"`
Searches string `json:"searches,optional"`
WorkspaceId string `json:"workspace_id,optional"`
ProjectId string `json:"project_id"`
Offset int32 `json:"offset,optional"`
Limit int32 `json:"limit"`
// SortBy string `json:"sort_by,optional"`
// Order string `json:"order,optional"`
// GroupBy string `json:"group_by,optional"`
// Searches string `json:"searches,optional"`
// WorkspaceId string `json:"workspace_id,optional"`
}
ListAlgorithmsResp {
Total int32 `json:"total,optional"`

View File

@ -30,13 +30,13 @@ func NewListAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Li
func (l *ListAlgorithmsLogic) ListAlgorithms(req *types.ListAlgorithmsReq) (resp *types.ListAlgorithmsResp, err error) {
modelartsReq := &modelarts.ListAlgorithmsReq{}
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: false, DeepCopy: true, Converters: tool.Converters})
ListAlgorithmsResp, err := l.svcCtx.ModelArtsRpc.ListAlgorithms(l.ctx, modelartsReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db DataSet list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
}
resp = &types.ListAlgorithmsResp{}
err = copier.CopyWithOption(&resp, &ListAlgorithmsResp, copier.Option{Converters: tool.Converters})
err = copier.CopyWithOption(&resp, &ListAlgorithmsResp, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: tool.Converters})
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db DataSet list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
}

View File

@ -4,7 +4,7 @@ import (
"PCM/adaptor/AIComputing/modelarts/rpc/internal/common"
"PCM/common/tool"
"context"
"k8s.io/apimachinery/pkg/util/json"
"encoding/json"
"strings"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"

View File

@ -7,10 +7,9 @@ import (
"PCM/common/tool"
"context"
"github.com/bitly/go-simplejson"
"github.com/zeromicro/go-zero/core/logx"
"k8s.io/apimachinery/pkg/util/json"
"strconv"
"github.com/zeromicro/go-zero/core/logx"
)
type ListAlgorithmsLogic struct {
@ -32,12 +31,7 @@ func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*
var resp modelarts.ListAlgorithmsResp
offset := strconv.Itoa(int(in.Offset))
limit := strconv.Itoa(int(in.Limit))
sortBy := in.SortBy
order := in.Order
groupBy := in.GroupBy
searches := in.Searches
workspaceId := in.WorkspaceId
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms?" + offset + "&" + limit + "&" + sortBy + "&" + order + "&" + groupBy + "&" + searches + "&" + workspaceId
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v2/" + in.ProjectId + "/algorithms?offset=" + offset + "&" + "limit=" + limit
//reqByte, err := json.Marshal(in)
//payload := strings.NewReader(string(reqByte))
token := common.GetToken()

View File

@ -730,7 +730,7 @@ message MetadataAlRp {
string id = 1;
string name = 2;
string description = 3;
int32 create_time = 4;
uint64 create_time = 4;
string workspace_id = 5;
string ai_project = 6;
string user_name = 7;
@ -743,7 +743,7 @@ message MetadataAlRp {
repeated TagsAlRp tags = 14;
repeated string attr_list = 15;
int32 version_num = 16;
int32 update_time = 17;
uint64 update_time = 17;
}
message TagsAlRp{
map<string,string> tags =1;
@ -803,11 +803,6 @@ message ListAlgorithmsReq{
string project_id =1; // @gotags: copier:"ProjectId"
int32 offset =2; // @gotags: copier:"Offset"
int32 limit= 3; // @gotags: copier:"Limit"
string sort_by =4; // @gotags: copier:"SortBy"
string order =5; // @gotags: copier:"Order"
string group_by =6; // @gotags: copier:"GroupBy"
string searches =7; // @gotags: copier:"Searches"
string workspace_id =8; // @gotags: copier:"WorkspaceId"
}
message ListAlgorithmsResp{