删除服务、查询服务详情合并分支

This commit is contained in:
Diva123456 2023-03-01 15:06:01 +08:00
parent 5f3d52f505
commit b489458159
3 changed files with 172 additions and 4 deletions

View File

@ -0,0 +1,44 @@
package logic
/*
desc: "AI core微服务"
author: "xie"
*/
import (
"PCM/adaptor/AIComputing/modelarts/rpc/internal/common"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
"PCM/common/tool"
"context"
"k8s.io/apimachinery/pkg/util/json"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteServiceLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteServiceLogic {
return &DeleteServiceLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteServiceLogic) DeleteService(in *modelarts.DeleteServiceReq) (*modelarts.DeleteServiceResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.DeleteServiceResp
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services/" + in.ServiceId
token := common.GetToken()
body, err := tool.HttpClient(tool.DELETE, url, nil, token)
if err != nil {
return nil, err
}
json.Unmarshal(body, &resp)
return &resp, nil
}

View File

@ -0,0 +1,44 @@
package logic
/*
desc: "AI core微服务"
author: "xie"
*/
import (
"PCM/adaptor/AIComputing/modelarts/rpc/internal/common"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
"PCM/common/tool"
"context"
"k8s.io/apimachinery/pkg/util/json"
"github.com/zeromicro/go-zero/core/logx"
)
type ShowServiceLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewShowServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowServiceLogic {
return &ShowServiceLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ShowServiceLogic) ShowService(in *modelarts.ShowServiceReq) (*modelarts.ShowServiceResp, error) {
// todo: add your logic here and delete this line
var resp modelarts.ShowServiceResp
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/services/" + in.ServiceId
token := common.GetToken()
body, err := tool.HttpClient(tool.GET, url, nil, token)
if err != nil {
return nil, err
}
json.Unmarshal(body, &resp)
return &resp, nil
}

View File

@ -729,7 +729,7 @@ message ExportTaskStatus {
/******************Get Export Tasks Of Dataset End*************************/
/******************Create Service Start*************************/
message CreatServiceReq{
message CreateServiceReq{
string workspace_id = 1;
Scheduler schedule = 2;
string cluster_id = 3;
@ -744,7 +744,7 @@ message CreatServiceReq{
}
message CreatServiceResp{
message CreateServiceResp{
uint32 code = 1; // @gotags: copier:"Code"
string service_id = 2;
repeated string resource_ids = 3;
@ -782,6 +782,85 @@ message CustomSpec{
/******************Create Service End*************************/
/******************Delete Service Start*************************/
message DeleteServiceReq{
string project_id = 1;
string service_id = 2;
}
message DeleteServiceResp{
}
/******************Delete Service End*************************/
/******************Show Service Start*************************/
message ShowServiceReq{
string project_id = 1;
string service_id = 2;
}
message ShowServiceResp{
uint32 failed_times = 1;
string owner = 2;
int32 due_time = 3;
int32 finished_time = 4;
string infer_type = 5;
string service_name = 6;
string description = 7;
string project = 8;
uint32 invocation_times = 9;
uint32 publish_at = 10;
string workspace_id = 11;
repeated Scheduler scheduler = 12;
int32 start_time = 13;
string operation_time = 14;
bool is_shared = 15;
string service_id = 16;
int32 progress = 17;
int32 shared_count = 18;
string tenant = 19;
string status = 20;
string is_opened_sample_collection = 21;
int32 transition_at = 22;
bool is_free = 23;
map<string,string> additional_properties = 24;
string cluster_id = 25;
string vpc_id = 26;
string subnet_network_id = 27;
string security_group_id = 28;
string error_msg = 29;
repeated QueryServiceConfig config = 30;
string access_address = 31;
string bind_access_address = 32;
string update_time = 33;
string debug_url = 34;
}
message QueryServiceConfig{
string model_version = 1;
string finished_time = 2;
CustomSpec CustomSpec = 3;
map<string,string> envs = 4;
string specification = 5;
int32 weight = 6;
string model_id = 7;
string src_path = 8;
string req_uri = 9;
string mapping_type = 10;
string start_time = 11;
string cluster_id = 12;
repeated string nodes = 13;
string mapping_rule = 14;
string model_name = 15;
string src_type = 16;
string dest_path = 17;
int32 instance_count = 18;
string status = 19;
bool scaling = 20;
bool support_debug = 21;
map<string,string> additional_properties = 22;
}
/******************Show Service End*************************/
/******************List Services Start*************************/
message ListServicesReq{
string service_id = 1;
@ -1216,7 +1295,8 @@ service ModelArts {
rpc ShowModels(ShowModelReq) returns (ShowModelResp);
//service management
rpc CreateService(CreatServiceReq) returns (CreatServiceResp);
rpc CreateService(CreateServiceReq) returns (CreateServiceResp);
rpc ListServices(ListServicesReq) returns (ListServicesResp);
rpc ShowService(ShowServiceReq) returns (ShowServiceResp);
rpc DeleteService(DeleteServiceReq) returns (DeleteServiceResp);
}