core端创建算法查询算法
This commit is contained in:
parent
2a5bc5e146
commit
e06942e860
|
@ -0,0 +1,44 @@
|
|||
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 CreateAlgorithmLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAlgorithmLogic {
|
||||
return &CreateAlgorithmLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateAlgorithmLogic) CreateAlgorithm(req *types.CreateAlgorithmReq) (resp *types.CreateAlgorithmResp, err error) {
|
||||
modelartsReq := &modelarts.CreateAlgorithmReq{}
|
||||
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
|
||||
ListAlgorithmsResp, err := l.svcCtx.ModelArtsRpc.CreateAlgorithm(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.CreateAlgorithmResp{}
|
||||
err = copier.CopyWithOption(&resp, &ListAlgorithmsResp, copier.Option{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)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
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 ListAlgorithmsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListAlgorithmsLogic {
|
||||
return &ListAlgorithmsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
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})
|
||||
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})
|
||||
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)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
Loading…
Reference in New Issue