fit:修改modelarts proto
This commit is contained in:
parent
bccab965a2
commit
ba8f9500da
|
@ -0,0 +1,54 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
|
||||
"PCM/common/tool"
|
||||
"PCM/common/xerr"
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/svc"
|
||||
"PCM/adaptor/AIComputing/AICore/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListDataSetLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDataSetLogic {
|
||||
return &ListDataSetLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListDataSetLogic) ListDataSet(req *types.ListDataSetReq) (resp *types.ListDataSetResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
modelartsReq := &modelarts.DatasetReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
|
||||
listDataSetResp, err := l.svcCtx.ModelArtsRpc.GetDatasetList(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.ListDataSetResp{}
|
||||
for i := 0; i < len(listDataSetResp.Datasets); i++ {
|
||||
historyJob := types.DataSet{}
|
||||
resp.DataSet = append(resp.DataSet, historyJob)
|
||||
}
|
||||
|
||||
err = copier.CopyWithOption(&resp, &listDataSetResp, copier.Option{Converters: tool.Converters})
|
||||
/*if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range resp.DataSet {
|
||||
resp.DataSet[i]. = "modelarts"
|
||||
}*/
|
||||
|
||||
return resp, nil
|
||||
}
|
Loading…
Reference in New Issue