api删除算法更新

This commit is contained in:
Diva123456 2023-03-08 16:51:45 +08:00
parent d9289791aa
commit f30dbfd11b
2 changed files with 60 additions and 3 deletions

View File

@ -657,7 +657,7 @@ type Cluster {
}
/******************List Clusters end*************************/
/******************CreateTrainingJob start*************************/
/******************ListAlgorithms start*************************/
type (
ListAlgorithmsReq {
ProjectId string `json:"project_id"`
@ -681,6 +681,18 @@ type (
/******************ListAlgorithms end*************************/
/******************DeleteAlgorithm start*************************/
type (
DeleteAlgorithmReq {
ProjectId string `json:"project_id" copier:"ProjectId"`
AlgorithmId string `json:"algorithm_id" copier:"AlgorithmId"`
}
DeleteAlgorithmResp {
}
)
/******************DeleteAlgorithm end*************************/
/******************CreateAlgorithm start*************************/
type MetadataAlRq {
Id string `json:"id,optional"`
@ -837,6 +849,9 @@ service AICore-api {
// ListAlgorithms 查询创建算法列表
@handler ListAlgorithms
get /ListAlgorithms (ListAlgorithmsReq) returns (ListAlgorithmsResp)
// DeleteAlgorithm 删除算法
@handler DeleteAlgorithm
delete /DeleteAlgorithm (DeleteAlgorithmReq) returns (DeleteAlgorithmResp)
// // CreateTrainingJob 创建训练作业
// @handler CreateTrainingJobHandler
// post /CreateTrainingJob (CreateTrainingJobReq) returns (CreateTrainingJobResp)
@ -847,7 +862,7 @@ service AICore-api {
// create service 创建服务
@handler CreateServiceHandler
get /CreateService (CreateServiceReq) returns (CreateServiceResp)
post /CreateService (CreateServiceReq) returns (CreateServiceResp)
// list services 展示服务
@handler ListServicesHandler
get /ListServices (ListServicesReq) returns (ListServicesResp)
@ -856,7 +871,7 @@ service AICore-api {
get /ShowService (ShowServiceReq) returns (ShowServiceResp)
// Delete service 删除服务
@handler DeleteServiceHandler
get /DeleteService (DeleteServiceReq) returns (DeleteServiceResp)
delete /DeleteService (DeleteServiceReq) returns (DeleteServiceResp)
// ListClusters查询专属资源池列表
@handler ListClustersHandler
get /ListClusters (ListClustersReq) returns (ListClustersResp)

View File

@ -0,0 +1,42 @@
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 DeleteAlgorithmLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteAlgorithmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAlgorithmLogic {
return &DeleteAlgorithmLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DeleteAlgorithmLogic) DeleteAlgorithm(req *types.DeleteAlgorithmReq) (resp *types.DeleteAlgorithmResp, err error) {
// todo: add your logic here and delete this line
modelartsReq := &modelarts.DeleteAlgorithmsReq{}
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
DeleteAlgorithmResp, err := l.svcCtx.ModelArtsRpc.DeleteAlgorithms(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.DeleteAlgorithmResp{}
err = copier.CopyWithOption(&resp, &DeleteAlgorithmResp, copier.Option{Converters: tool.Converters})
return resp, nil
}