查询专属资源池列表合并分支
This commit is contained in:
parent
fdd6fb6943
commit
4058da5c65
|
@ -0,0 +1,46 @@
|
|||
package logic
|
||||
|
||||
/*
|
||||
desc: "AI core微服务"
|
||||
author: "xie"
|
||||
*/
|
||||
|
||||
import (
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
|
||||
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListClustersLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewListClustersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListClustersLogic {
|
||||
return &ListClustersLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListClustersLogic) ListClusters(in *modelarts.ListClustersReq) (*modelarts.ListClustersResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ListClustersResp
|
||||
url := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/" + in.ProjectId + "/clusters"
|
||||
token := common.GetToken()
|
||||
body, err := tool.HttpClient(tool.GET, url, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// var resp Pppp
|
||||
json.Unmarshal(body, &resp)
|
||||
return &resp, nil
|
||||
}
|
|
@ -48,6 +48,32 @@ message TokenResp{
|
|||
}
|
||||
/******************auth end*************************/
|
||||
|
||||
/******************find datasetList start*************************/
|
||||
message datasetReq{
|
||||
string project_id = 1;
|
||||
}
|
||||
|
||||
message datasetResp{
|
||||
string total_number = 1;
|
||||
datasets datasets =2;
|
||||
}
|
||||
|
||||
message datasets{
|
||||
string dataset_id =1;
|
||||
string data_format =2;
|
||||
DataSources data_sources =3;
|
||||
int32 dataset_format =4;
|
||||
string dataset_name =5;
|
||||
int32 dataset_type =6;
|
||||
bool import_data =7;
|
||||
}
|
||||
|
||||
message DataSources{
|
||||
string data_path =1;
|
||||
int32 data_type =2;
|
||||
}
|
||||
|
||||
/******************find datasetList end*************************/
|
||||
|
||||
/******************ImportTask start*************************/
|
||||
//数据集导入创建
|
||||
|
@ -933,218 +959,6 @@ message GetExportTaskStatusOfDatasetResp{
|
|||
}
|
||||
/******************Get Export Tasks Of Dataset End*************************/
|
||||
|
||||
/******************Create Service Start*************************/
|
||||
message CreateServiceReq{
|
||||
string workspace_id = 1;
|
||||
Scheduler schedule = 2;
|
||||
string cluster_id = 3;
|
||||
string infer_type = 4;
|
||||
string vpc_id = 5;
|
||||
string service_name = 6;
|
||||
string description = 7;
|
||||
string security_group_id = 8;
|
||||
string subnet_network_id = 9;
|
||||
repeated ServiceConfig config = 10;
|
||||
string project_id = 11;
|
||||
|
||||
}
|
||||
|
||||
message CreateServiceResp{
|
||||
uint32 code = 1; // @gotags: copier:"Code"
|
||||
string service_id = 2;
|
||||
repeated string resource_ids = 3;
|
||||
}
|
||||
|
||||
message Scheduler{
|
||||
int32 duration = 1;
|
||||
string time_unit = 2;
|
||||
string type = 3;
|
||||
}
|
||||
|
||||
message ServiceConfig{
|
||||
CustomSpec custom_spec = 1;
|
||||
map<string,string> envs = 2;
|
||||
string specification = 3;
|
||||
int32 weight = 4;
|
||||
string model_id = 5;
|
||||
string src_path = 6;
|
||||
string req_uri = 7;
|
||||
string mapping_type = 8;
|
||||
string cluster_id = 9;
|
||||
repeated string nodes = 10;
|
||||
string src_type = 11;
|
||||
string dest_path = 12;
|
||||
int32 instance_count = 13;
|
||||
|
||||
}
|
||||
|
||||
message CustomSpec{
|
||||
float gpu_p4 = 1;
|
||||
int64 memory = 2;
|
||||
float cpu = 3;
|
||||
int64 ascend_a310 = 4;
|
||||
}
|
||||
|
||||
/******************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;
|
||||
string service_name = 2;
|
||||
string model_id = 3;
|
||||
string workspace_id = 4;
|
||||
string infer_type = 5;
|
||||
string status = 6;
|
||||
int32 offset = 7;
|
||||
int32 limit = 8;
|
||||
string sort_by = 9;
|
||||
string order = 10;
|
||||
string project_id = 11;
|
||||
}
|
||||
|
||||
message ListServicesResp{
|
||||
int32 code = 1; // @gotags: copier:"Code"
|
||||
int32 total_count = 2;
|
||||
int32 count = 3;
|
||||
repeated ListServices services = 4;
|
||||
}
|
||||
|
||||
message ListServices{
|
||||
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;
|
||||
|
||||
}
|
||||
/******************List Services End*************************/
|
||||
|
||||
/******************find datasetList start*************************/
|
||||
message datasetReq{
|
||||
string project_id = 1;
|
||||
}
|
||||
|
||||
message datasetResp{
|
||||
string total_number = 1;
|
||||
datasets datasets =2;
|
||||
}
|
||||
|
||||
message datasets{
|
||||
string dataset_id =1;
|
||||
string data_format =2;
|
||||
DataSources data_sources =3;
|
||||
int32 dataset_format =4;
|
||||
string dataset_name =5;
|
||||
int32 dataset_type =6;
|
||||
bool import_data =7;
|
||||
}
|
||||
|
||||
message DataSources{
|
||||
string data_path =1;
|
||||
int32 data_type =2;
|
||||
}
|
||||
|
||||
|
||||
/******************find datasetList end*************************/
|
||||
|
||||
/******************Create Processor Task Start*************************/
|
||||
message CreateProcessorTaskReq{
|
||||
string project_id = 1;
|
||||
|
@ -1195,9 +1009,6 @@ message OperatorParam {
|
|||
string name = 3;
|
||||
string params = 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************Create Processor Task End*************************/
|
||||
|
||||
/******************Describe Processor Task Start*************************/
|
||||
|
@ -1456,6 +1267,229 @@ message ModelParamsInfo{
|
|||
}
|
||||
/******************Show Model End*************************/
|
||||
|
||||
/******************Create Service Start*************************/
|
||||
message CreateServiceReq{
|
||||
string workspace_id = 1;
|
||||
Scheduler schedule = 2;
|
||||
string cluster_id = 3;
|
||||
string infer_type = 4;
|
||||
string vpc_id = 5;
|
||||
string service_name = 6;
|
||||
string description = 7;
|
||||
string security_group_id = 8;
|
||||
string subnet_network_id = 9;
|
||||
repeated ServiceConfig config = 10;
|
||||
string project_id = 11;
|
||||
|
||||
}
|
||||
|
||||
message CreateServiceResp{
|
||||
uint32 code = 1; // @gotags: copier:"Code"
|
||||
string service_id = 2;
|
||||
repeated string resource_ids = 3;
|
||||
}
|
||||
|
||||
message Scheduler{
|
||||
int32 duration = 1;
|
||||
string time_unit = 2;
|
||||
string type = 3;
|
||||
}
|
||||
|
||||
message ServiceConfig{
|
||||
CustomSpec custom_spec = 1;
|
||||
map<string,string> envs = 2;
|
||||
string specification = 3;
|
||||
int32 weight = 4;
|
||||
string model_id = 5;
|
||||
string src_path = 6;
|
||||
string req_uri = 7;
|
||||
string mapping_type = 8;
|
||||
string cluster_id = 9;
|
||||
repeated string nodes = 10;
|
||||
string src_type = 11;
|
||||
string dest_path = 12;
|
||||
int32 instance_count = 13;
|
||||
|
||||
}
|
||||
|
||||
message CustomSpec{
|
||||
float gpu_p4 = 1;
|
||||
int64 memory = 2;
|
||||
float cpu = 3;
|
||||
int64 ascend_a310 = 4;
|
||||
}
|
||||
|
||||
/******************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;
|
||||
string service_name = 2;
|
||||
string model_id = 3;
|
||||
string workspace_id = 4;
|
||||
string infer_type = 5;
|
||||
string status = 6;
|
||||
int32 offset = 7;
|
||||
int32 limit = 8;
|
||||
string sort_by = 9;
|
||||
string order = 10;
|
||||
string project_id = 11;
|
||||
}
|
||||
|
||||
message ListServicesResp{
|
||||
int32 code = 1; // @gotags: copier:"Code"
|
||||
int32 total_count = 2;
|
||||
int32 count = 3;
|
||||
repeated ListServices services = 4;
|
||||
}
|
||||
|
||||
message ListServices{
|
||||
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;
|
||||
}
|
||||
/******************List Services End*************************/
|
||||
|
||||
/******************List Clusters Start*************************/
|
||||
message ListClustersReq{
|
||||
string project_id = 1;
|
||||
string Cluster_name = 2;
|
||||
int64 offset = 3;
|
||||
int64 limit = 4;
|
||||
string sort_by = 5;
|
||||
string order = 6;
|
||||
}
|
||||
|
||||
message ListClustersResp{
|
||||
int32 code = 1; // @gotags: copier:"Code"
|
||||
int32 count = 2;
|
||||
repeated Cluster clusters= 3;
|
||||
}
|
||||
|
||||
message Cluster{
|
||||
string owner = 1;
|
||||
string cluster_name = 2;
|
||||
int32 period_num = 3;
|
||||
int32 created_at = 4;
|
||||
string description = 5;
|
||||
string project = 6;
|
||||
int64 allocatable_memory = 7;
|
||||
string cluster_id = 8;
|
||||
ClusterNode nodes = 9;
|
||||
float allocatable_cpu_cores = 10;
|
||||
string order_id = 11;
|
||||
string period_type = 12;
|
||||
string tenant = 13;
|
||||
string status = 14;
|
||||
}
|
||||
|
||||
message ClusterNode{
|
||||
int32 available_count = 1;
|
||||
int32 count = 2;
|
||||
string specification = 3;
|
||||
}
|
||||
/******************List Clusters End*************************/
|
||||
|
||||
// Slurm Services for Shuguang Branch
|
||||
service ModelArts {
|
||||
|
||||
|
@ -1484,7 +1518,6 @@ service ModelArts {
|
|||
rpc CreateAlgorithm(CreateAlgorithmReq) returns (CreateAlgorithmResp);
|
||||
|
||||
|
||||
|
||||
//export task
|
||||
rpc ExportTask(ExportTaskReq) returns (ExportTaskResp);
|
||||
rpc GetExportTasksOfDataset(GetExportTasksOfDatasetReq) returns (GetExportTasksOfDatasetResp);
|
||||
|
@ -1504,4 +1537,5 @@ service ModelArts {
|
|||
rpc ListServices(ListServicesReq) returns (ListServicesResp);
|
||||
rpc ShowService(ShowServiceReq) returns (ShowServiceResp);
|
||||
rpc DeleteService(DeleteServiceReq) returns (DeleteServiceResp);
|
||||
rpc ListClusters(ListClustersReq) returns (ListClustersResp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue