From cfbf4a2810cd48561738c63de3040d895abd3906 Mon Sep 17 00:00:00 2001 From: tzwang Date: Thu, 4 May 2023 11:37:03 +0800 Subject: [PATCH] =?UTF-8?q?octopus=20cpu,=E5=86=85=E5=AD=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rpc/internal/logic/getgeneralinfologic.go | 127 +++++++++++++- .../PCM-OCTOPUS/rpc/octopus/octopus.pb.go | 162 +++++++++--------- .../rpc/octopus/octopus_grpc.pb.go | 8 +- .../PCM-AI/PCM-OCTOPUS/rpc/pb/octopus.proto | 2 +- 4 files changed, 211 insertions(+), 88 deletions(-) diff --git a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/logic/getgeneralinfologic.go b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/logic/getgeneralinfologic.go index 97031e57..1e02bc4d 100644 --- a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/logic/getgeneralinfologic.go +++ b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/logic/getgeneralinfologic.go @@ -1,7 +1,15 @@ package logic import ( + "PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common" + "PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config" "context" + "encoding/json" + "github.com/go-redis/redis" + "log" + "strconv" + "strings" + "time" "PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc" "PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus" @@ -9,6 +17,12 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) +const ( + GI = "Gi" + OctopusGeneralInfo = "octopusGeneralInfo" + Comma = "," +) + type GetGeneralInfoLogic struct { ctx context.Context svcCtx *svc.ServiceContext @@ -24,7 +38,116 @@ func NewGetGeneralInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge } func (l *GetGeneralInfoLogic) GetGeneralInfo(in *octopus.ResourceReq) (*octopus.GiResp, error) { - // todo: add your logic here and delete this line + var resp octopus.GiResp + var octopusCpuCores int32 + var octopusMemoryInGi int32 - return &octopus.GiResp{}, nil + redisClient := redis.NewClient(&redis.Options{ + Addr: l.svcCtx.Config.RedisConf.Host, + Password: l.svcCtx.Config.RedisConf.Pass, + }) + + defer redisClient.Close() + _, err := redisClient.Ping().Result() + + if err != nil { + log.Println("redis连接失败", err) + octopusCpuCores, octopusMemoryInGi = getGeneralInfoFromOctopus() + octopusGeneralInfo := strconv.FormatInt(int64(octopusCpuCores), 10) + Comma + strconv.FormatInt(int64(octopusMemoryInGi), 10) + redisClient.Set(OctopusGeneralInfo, octopusGeneralInfo, 168*time.Hour) + } else { + res, err := redisClient.Get(OctopusGeneralInfo).Result() + if err == redis.Nil { + log.Println("redis key未找到或已过期,重新请求") + octopusCpuCores, octopusMemoryInGi = getGeneralInfoFromOctopus() + octopusGeneralInfo := strconv.FormatInt(int64(octopusCpuCores), 10) + Comma + strconv.FormatInt(int64(octopusMemoryInGi), 10) + redisClient.Set(OctopusGeneralInfo, octopusGeneralInfo, 168*time.Hour) + } else { + strs := strings.Split(res, Comma) + cpu, _ := strconv.ParseInt(strs[0], 10, 32) + memory, _ := strconv.ParseInt(strs[1], 10, 32) + octopusCpuCores = int32(cpu) + octopusMemoryInGi = int32(memory) + } + } + + resp.CpuCoreNum = octopusCpuCores + resp.MemoryInGib = octopusMemoryInGi + return &resp, nil +} + +func getGeneralInfoFromOctopus() (int32, int32) { + octopusConfig := config.Cfg + + urlMap := map[string]string{ + common.Hanwuji: octopusConfig.OctopusConfig.HanwujiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec, + common.Suiyuan: octopusConfig.OctopusConfig.SuiyuanUrl + octopusConfig.OctopusConfig.OctopusResouceSpec, + common.Sailingsi: octopusConfig.OctopusConfig.SailingsiUrl + octopusConfig.OctopusConfig.OctopusResouceSpec, + } + + var cpuCoreNum int32 + var memoryInGib int32 + for k, v := range urlMap { + token := common.GetToken(k) + body, err := common.OctopusHttpClient("GET", v, nil, token) + if err != nil { + continue + } + //获取训练资源算力 + switch k { + case common.Hanwuji: + resourceSpec := common.HanwujiResp{} + err := json.Unmarshal(body, &resourceSpec) + if err != nil { + log.Println("Hanwuji json转换失败 : ", err) + continue + } + if !resourceSpec.Success { + log.Println("Hanwuji 获取训练资源失败 : ", resourceSpec.Error) + continue + } + for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs { + cpuInfo, err := strconv.ParseInt(spec.ResourceQuantity.Cpu, 10, 32) + if err != nil { + continue + } + cpuCoreNum += int32(cpuInfo) + + memoryStr := strings.Replace(spec.ResourceQuantity.Memory, GI, "", -1) + memoryInfo, err := strconv.ParseInt(memoryStr, 10, 32) + if err != nil { + continue + } + memoryInGib += int32(memoryInfo) + } + case common.Suiyuan: + resourceSpec := common.SuiyuanResp{} + err := json.Unmarshal(body, &resourceSpec) + if err != nil { + log.Println("Suiyuan json转换失败 : ", err) + continue + } + if !resourceSpec.Success { + log.Println("Suiyuan 获取训练资源失败 : ", resourceSpec.Error) + continue + } + for _, spec := range resourceSpec.Payload.MapResourceSpecIdList.Train.ResourceSpecs { + cpuInfo, err := strconv.ParseInt(spec.ResourceQuantity.Cpu, 10, 32) + if err != nil { + continue + } + cpuCoreNum += int32(cpuInfo) + + memoryStr := strings.Replace(spec.ResourceQuantity.Memory, GI, "", -1) + memoryInfo, err := strconv.ParseInt(memoryStr, 10, 32) + if err != nil { + continue + } + memoryInGib += int32(memoryInfo) + } + } + + } + + return cpuCoreNum, memoryInGib } diff --git a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus.pb.go b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus.pb.go index 1f3c0918..61fffb7c 100644 --- a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus.pb.go +++ b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.28.1 // protoc v3.19.4 -// source: octopus.proto +// source: pb/octopus.proto package octopus @@ -29,7 +29,7 @@ type ResourceReq struct { func (x *ResourceReq) Reset() { *x = ResourceReq{} if protoimpl.UnsafeEnabled { - mi := &file_octopus_proto_msgTypes[0] + mi := &file_pb_octopus_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -42,7 +42,7 @@ func (x *ResourceReq) String() string { func (*ResourceReq) ProtoMessage() {} func (x *ResourceReq) ProtoReflect() protoreflect.Message { - mi := &file_octopus_proto_msgTypes[0] + mi := &file_pb_octopus_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -55,7 +55,7 @@ func (x *ResourceReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ResourceReq.ProtoReflect.Descriptor instead. func (*ResourceReq) Descriptor() ([]byte, []int) { - return file_octopus_proto_rawDescGZIP(), []int{0} + return file_pb_octopus_proto_rawDescGZIP(), []int{0} } type CpResp struct { @@ -69,7 +69,7 @@ type CpResp struct { func (x *CpResp) Reset() { *x = CpResp{} if protoimpl.UnsafeEnabled { - mi := &file_octopus_proto_msgTypes[1] + mi := &file_pb_octopus_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82,7 +82,7 @@ func (x *CpResp) String() string { func (*CpResp) ProtoMessage() {} func (x *CpResp) ProtoReflect() protoreflect.Message { - mi := &file_octopus_proto_msgTypes[1] + mi := &file_pb_octopus_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95,7 +95,7 @@ func (x *CpResp) ProtoReflect() protoreflect.Message { // Deprecated: Use CpResp.ProtoReflect.Descriptor instead. func (*CpResp) Descriptor() ([]byte, []int) { - return file_octopus_proto_rawDescGZIP(), []int{1} + return file_pb_octopus_proto_rawDescGZIP(), []int{1} } func (x *CpResp) GetPOpsAtFp16() float32 { @@ -110,14 +110,14 @@ type GiResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CpuNum int32 `protobuf:"varint,1,opt,name=cpuNum,proto3" json:"cpuNum,omitempty"` + CpuCoreNum int32 `protobuf:"varint,1,opt,name=cpuCoreNum,proto3" json:"cpuCoreNum,omitempty"` MemoryInGib int32 `protobuf:"varint,2,opt,name=memoryInGib,proto3" json:"memoryInGib,omitempty"` } func (x *GiResp) Reset() { *x = GiResp{} if protoimpl.UnsafeEnabled { - mi := &file_octopus_proto_msgTypes[2] + mi := &file_pb_octopus_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -130,7 +130,7 @@ func (x *GiResp) String() string { func (*GiResp) ProtoMessage() {} func (x *GiResp) ProtoReflect() protoreflect.Message { - mi := &file_octopus_proto_msgTypes[2] + mi := &file_pb_octopus_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -143,12 +143,12 @@ func (x *GiResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GiResp.ProtoReflect.Descriptor instead. func (*GiResp) Descriptor() ([]byte, []int) { - return file_octopus_proto_rawDescGZIP(), []int{2} + return file_pb_octopus_proto_rawDescGZIP(), []int{2} } -func (x *GiResp) GetCpuNum() int32 { +func (x *GiResp) GetCpuCoreNum() int32 { if x != nil { - return x.CpuNum + return x.CpuCoreNum } return 0 } @@ -174,7 +174,7 @@ type CreateDataSetReq struct { func (x *CreateDataSetReq) Reset() { *x = CreateDataSetReq{} if protoimpl.UnsafeEnabled { - mi := &file_octopus_proto_msgTypes[3] + mi := &file_pb_octopus_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -187,7 +187,7 @@ func (x *CreateDataSetReq) String() string { func (*CreateDataSetReq) ProtoMessage() {} func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message { - mi := &file_octopus_proto_msgTypes[3] + mi := &file_pb_octopus_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -200,7 +200,7 @@ func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateDataSetReq.ProtoReflect.Descriptor instead. func (*CreateDataSetReq) Descriptor() ([]byte, []int) { - return file_octopus_proto_rawDescGZIP(), []int{3} + return file_pb_octopus_proto_rawDescGZIP(), []int{3} } func (x *CreateDataSetReq) GetApplyIds() []string { @@ -243,7 +243,7 @@ type CreateDataSetResq struct { func (x *CreateDataSetResq) Reset() { *x = CreateDataSetResq{} if protoimpl.UnsafeEnabled { - mi := &file_octopus_proto_msgTypes[4] + mi := &file_pb_octopus_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -256,7 +256,7 @@ func (x *CreateDataSetResq) String() string { func (*CreateDataSetResq) ProtoMessage() {} func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message { - mi := &file_octopus_proto_msgTypes[4] + mi := &file_pb_octopus_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -269,7 +269,7 @@ func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateDataSetResq.ProtoReflect.Descriptor instead. func (*CreateDataSetResq) Descriptor() ([]byte, []int) { - return file_octopus_proto_rawDescGZIP(), []int{4} + return file_pb_octopus_proto_rawDescGZIP(), []int{4} } func (x *CreateDataSetResq) GetId() string { @@ -286,67 +286,67 @@ func (x *CreateDataSetResq) GetVersion() string { return "" } -var File_octopus_proto protoreflect.FileDescriptor +var File_pb_octopus_proto protoreflect.FileDescriptor -var file_octopus_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x07, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x22, 0x0d, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x28, 0x0a, 0x06, 0x63, 0x70, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70, 0x31, 0x36, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70, 0x31, - 0x36, 0x22, 0x42, 0x0a, 0x06, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x63, - 0x70, 0x75, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x70, 0x75, - 0x4e, 0x75, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, - 0x69, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x49, 0x6e, 0x47, 0x69, 0x62, 0x22, 0x6e, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, - 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, - 0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, - 0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, - 0x79, 0x70, 0x65, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, - 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xc6, 0x01, 0x0a, 0x07, 0x4f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, - 0x12, 0x3a, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x69, 0x6e, 0x67, - 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, - 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x63, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, - 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x67, - 0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, - 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x1a, 0x1a, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x42, 0x0a, 0x5a, - 0x08, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +var file_pb_octopus_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x07, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x22, 0x0d, 0x0a, 0x0b, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x28, 0x0a, 0x06, 0x63, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70, + 0x31, 0x36, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, + 0x46, 0x70, 0x31, 0x36, 0x22, 0x4a, 0x0a, 0x06, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, + 0x0a, 0x0a, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x20, + 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, 0x69, 0x62, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, 0x69, 0x62, + 0x22, 0x6e, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x64, 0x65, 0x73, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65, + 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, + 0x22, 0x3d, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, + 0xc6, 0x01, 0x0a, 0x07, 0x4f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, + 0x2e, 0x63, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f, + 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, + 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, + 0x74, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6f, + 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, + 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x6f, 0x63, 0x74, + 0x6f, 0x70, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_octopus_proto_rawDescOnce sync.Once - file_octopus_proto_rawDescData = file_octopus_proto_rawDesc + file_pb_octopus_proto_rawDescOnce sync.Once + file_pb_octopus_proto_rawDescData = file_pb_octopus_proto_rawDesc ) -func file_octopus_proto_rawDescGZIP() []byte { - file_octopus_proto_rawDescOnce.Do(func() { - file_octopus_proto_rawDescData = protoimpl.X.CompressGZIP(file_octopus_proto_rawDescData) +func file_pb_octopus_proto_rawDescGZIP() []byte { + file_pb_octopus_proto_rawDescOnce.Do(func() { + file_pb_octopus_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_octopus_proto_rawDescData) }) - return file_octopus_proto_rawDescData + return file_pb_octopus_proto_rawDescData } -var file_octopus_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_octopus_proto_goTypes = []interface{}{ +var file_pb_octopus_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_pb_octopus_proto_goTypes = []interface{}{ (*ResourceReq)(nil), // 0: octopus.resourceReq (*CpResp)(nil), // 1: octopus.cpResp (*GiResp)(nil), // 2: octopus.giResp (*CreateDataSetReq)(nil), // 3: octopus.CreateDataSetReq (*CreateDataSetResq)(nil), // 4: octopus.CreateDataSetResq } -var file_octopus_proto_depIdxs = []int32{ +var file_pb_octopus_proto_depIdxs = []int32{ 0, // 0: octopus.Octopus.GetComputingPower:input_type -> octopus.resourceReq 0, // 1: octopus.Octopus.GetGeneralInfo:input_type -> octopus.resourceReq 3, // 2: octopus.Octopus.CreateDataSet:input_type -> octopus.CreateDataSetReq @@ -360,13 +360,13 @@ var file_octopus_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_octopus_proto_init() } -func file_octopus_proto_init() { - if File_octopus_proto != nil { +func init() { file_pb_octopus_proto_init() } +func file_pb_octopus_proto_init() { + if File_pb_octopus_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_octopus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_pb_octopus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResourceReq); i { case 0: return &v.state @@ -378,7 +378,7 @@ func file_octopus_proto_init() { return nil } } - file_octopus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_pb_octopus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CpResp); i { case 0: return &v.state @@ -390,7 +390,7 @@ func file_octopus_proto_init() { return nil } } - file_octopus_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_pb_octopus_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GiResp); i { case 0: return &v.state @@ -402,7 +402,7 @@ func file_octopus_proto_init() { return nil } } - file_octopus_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_pb_octopus_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateDataSetReq); i { case 0: return &v.state @@ -414,7 +414,7 @@ func file_octopus_proto_init() { return nil } } - file_octopus_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_pb_octopus_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateDataSetResq); i { case 0: return &v.state @@ -431,18 +431,18 @@ func file_octopus_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_octopus_proto_rawDesc, + RawDescriptor: file_pb_octopus_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_octopus_proto_goTypes, - DependencyIndexes: file_octopus_proto_depIdxs, - MessageInfos: file_octopus_proto_msgTypes, + GoTypes: file_pb_octopus_proto_goTypes, + DependencyIndexes: file_pb_octopus_proto_depIdxs, + MessageInfos: file_pb_octopus_proto_msgTypes, }.Build() - File_octopus_proto = out.File - file_octopus_proto_rawDesc = nil - file_octopus_proto_goTypes = nil - file_octopus_proto_depIdxs = nil + File_pb_octopus_proto = out.File + file_pb_octopus_proto_rawDesc = nil + file_pb_octopus_proto_goTypes = nil + file_pb_octopus_proto_depIdxs = nil } diff --git a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus_grpc.pb.go b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus_grpc.pb.go index dddaaf32..691aa4f0 100644 --- a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus_grpc.pb.go +++ b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus/octopus_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc v3.19.4 -// source: octopus.proto +// source: pb/octopus.proto package octopus @@ -24,7 +24,7 @@ const _ = grpc.SupportPackageIsVersion7 type OctopusClient interface { GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error) GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error) - //get modelarts Token + // get modelarts Token CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) } @@ -69,7 +69,7 @@ func (c *octopusClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq, type OctopusServer interface { GetComputingPower(context.Context, *ResourceReq) (*CpResp, error) GetGeneralInfo(context.Context, *ResourceReq) (*GiResp, error) - //get modelarts Token + // get modelarts Token CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error) mustEmbedUnimplementedOctopusServer() } @@ -175,5 +175,5 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "octopus.proto", + Metadata: "pb/octopus.proto", } diff --git a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/pb/octopus.proto b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/pb/octopus.proto index 843a9d27..30fca4c5 100644 --- a/adaptor/PCM-AI/PCM-OCTOPUS/rpc/pb/octopus.proto +++ b/adaptor/PCM-AI/PCM-OCTOPUS/rpc/pb/octopus.proto @@ -12,7 +12,7 @@ message cpResp{ } message giResp{ - int32 cpuNum = 1; + int32 cpuCoreNum = 1; int32 memoryInGib = 2; }