octopus cpu,内存接口调整

This commit is contained in:
tzwang 2023-05-04 11:37:03 +08:00
parent b178f9ecdd
commit cfbf4a2810
4 changed files with 211 additions and 88 deletions

View File

@ -1,7 +1,15 @@
package logic package logic
import ( import (
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/config"
"context" "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/internal/svc"
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus" "PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
@ -9,6 +17,12 @@ import (
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
const (
GI = "Gi"
OctopusGeneralInfo = "octopusGeneralInfo"
Comma = ","
)
type GetGeneralInfoLogic struct { type GetGeneralInfoLogic struct {
ctx context.Context ctx context.Context
svcCtx *svc.ServiceContext 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) { 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
} }

View File

@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.28.1
// protoc v3.19.4 // protoc v3.19.4
// source: octopus.proto // source: pb/octopus.proto
package octopus package octopus
@ -29,7 +29,7 @@ type ResourceReq struct {
func (x *ResourceReq) Reset() { func (x *ResourceReq) Reset() {
*x = ResourceReq{} *x = ResourceReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_octopus_proto_msgTypes[0] mi := &file_pb_octopus_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -42,7 +42,7 @@ func (x *ResourceReq) String() string {
func (*ResourceReq) ProtoMessage() {} func (*ResourceReq) ProtoMessage() {}
func (x *ResourceReq) ProtoReflect() protoreflect.Message { func (x *ResourceReq) ProtoReflect() protoreflect.Message {
mi := &file_octopus_proto_msgTypes[0] mi := &file_pb_octopus_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -55,7 +55,7 @@ func (x *ResourceReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use ResourceReq.ProtoReflect.Descriptor instead. // Deprecated: Use ResourceReq.ProtoReflect.Descriptor instead.
func (*ResourceReq) Descriptor() ([]byte, []int) { func (*ResourceReq) Descriptor() ([]byte, []int) {
return file_octopus_proto_rawDescGZIP(), []int{0} return file_pb_octopus_proto_rawDescGZIP(), []int{0}
} }
type CpResp struct { type CpResp struct {
@ -69,7 +69,7 @@ type CpResp struct {
func (x *CpResp) Reset() { func (x *CpResp) Reset() {
*x = CpResp{} *x = CpResp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_octopus_proto_msgTypes[1] mi := &file_pb_octopus_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -82,7 +82,7 @@ func (x *CpResp) String() string {
func (*CpResp) ProtoMessage() {} func (*CpResp) ProtoMessage() {}
func (x *CpResp) ProtoReflect() protoreflect.Message { func (x *CpResp) ProtoReflect() protoreflect.Message {
mi := &file_octopus_proto_msgTypes[1] mi := &file_pb_octopus_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -95,7 +95,7 @@ func (x *CpResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use CpResp.ProtoReflect.Descriptor instead. // Deprecated: Use CpResp.ProtoReflect.Descriptor instead.
func (*CpResp) Descriptor() ([]byte, []int) { 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 { func (x *CpResp) GetPOpsAtFp16() float32 {
@ -110,14 +110,14 @@ type GiResp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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"` MemoryInGib int32 `protobuf:"varint,2,opt,name=memoryInGib,proto3" json:"memoryInGib,omitempty"`
} }
func (x *GiResp) Reset() { func (x *GiResp) Reset() {
*x = GiResp{} *x = GiResp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_octopus_proto_msgTypes[2] mi := &file_pb_octopus_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -130,7 +130,7 @@ func (x *GiResp) String() string {
func (*GiResp) ProtoMessage() {} func (*GiResp) ProtoMessage() {}
func (x *GiResp) ProtoReflect() protoreflect.Message { func (x *GiResp) ProtoReflect() protoreflect.Message {
mi := &file_octopus_proto_msgTypes[2] mi := &file_pb_octopus_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -143,12 +143,12 @@ func (x *GiResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GiResp.ProtoReflect.Descriptor instead. // Deprecated: Use GiResp.ProtoReflect.Descriptor instead.
func (*GiResp) Descriptor() ([]byte, []int) { 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 { if x != nil {
return x.CpuNum return x.CpuCoreNum
} }
return 0 return 0
} }
@ -174,7 +174,7 @@ type CreateDataSetReq struct {
func (x *CreateDataSetReq) Reset() { func (x *CreateDataSetReq) Reset() {
*x = CreateDataSetReq{} *x = CreateDataSetReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_octopus_proto_msgTypes[3] mi := &file_pb_octopus_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -187,7 +187,7 @@ func (x *CreateDataSetReq) String() string {
func (*CreateDataSetReq) ProtoMessage() {} func (*CreateDataSetReq) ProtoMessage() {}
func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message { func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message {
mi := &file_octopus_proto_msgTypes[3] mi := &file_pb_octopus_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -200,7 +200,7 @@ func (x *CreateDataSetReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateDataSetReq.ProtoReflect.Descriptor instead. // Deprecated: Use CreateDataSetReq.ProtoReflect.Descriptor instead.
func (*CreateDataSetReq) Descriptor() ([]byte, []int) { 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 { func (x *CreateDataSetReq) GetApplyIds() []string {
@ -243,7 +243,7 @@ type CreateDataSetResq struct {
func (x *CreateDataSetResq) Reset() { func (x *CreateDataSetResq) Reset() {
*x = CreateDataSetResq{} *x = CreateDataSetResq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_octopus_proto_msgTypes[4] mi := &file_pb_octopus_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -256,7 +256,7 @@ func (x *CreateDataSetResq) String() string {
func (*CreateDataSetResq) ProtoMessage() {} func (*CreateDataSetResq) ProtoMessage() {}
func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message { func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message {
mi := &file_octopus_proto_msgTypes[4] mi := &file_pb_octopus_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -269,7 +269,7 @@ func (x *CreateDataSetResq) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateDataSetResq.ProtoReflect.Descriptor instead. // Deprecated: Use CreateDataSetResq.ProtoReflect.Descriptor instead.
func (*CreateDataSetResq) Descriptor() ([]byte, []int) { 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 { func (x *CreateDataSetResq) GetId() string {
@ -286,67 +286,67 @@ func (x *CreateDataSetResq) GetVersion() string {
return "" return ""
} }
var File_octopus_proto protoreflect.FileDescriptor var File_pb_octopus_proto protoreflect.FileDescriptor
var file_octopus_proto_rawDesc = []byte{ var file_pb_octopus_proto_rawDesc = []byte{
0x0a, 0x0d, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x07, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x22, 0x0d, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x22, 0x0d, 0x0a, 0x0b, 0x72,
0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x28, 0x0a, 0x06, 0x63, 0x70, 0x52, 0x65, 0x73, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x28, 0x0a, 0x06, 0x63, 0x70,
0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70, 0x31, 0x36, 0x18, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70,
0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74, 0x46, 0x70, 0x31, 0x31, 0x36, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x70, 0x4f, 0x70, 0x73, 0x41, 0x74,
0x36, 0x22, 0x42, 0x0a, 0x06, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x46, 0x70, 0x31, 0x36, 0x22, 0x4a, 0x0a, 0x06, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e,
0x70, 0x75, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x70, 0x75, 0x0a, 0x0a, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01,
0x4e, 0x75, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x20,
0x69, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, 0x69, 0x62, 0x18, 0x02, 0x20,
0x49, 0x6e, 0x47, 0x69, 0x62, 0x22, 0x6e, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x47, 0x69, 0x62,
0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x22, 0x6e, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73,
0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65,
0x79, 0x70, 0x65, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64,
0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x22, 0x3d, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x73, 0x69, 0x6f, 0x6e, 0x32, 0xc6, 0x01, 0x0a, 0x07, 0x4f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32,
0x12, 0x3a, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x69, 0x6e, 0x67, 0xc6, 0x01, 0x0a, 0x07, 0x4f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x12, 0x3a, 0x0a, 0x11, 0x47,
0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x77, 0x65, 0x72,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x63, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0e, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73,
0x47, 0x65, 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x63, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x65,
0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x6f, 0x63, 0x74, 0x6f,
0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x67, 0x70, 0x75, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a,
0x69, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x0f, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x67, 0x69, 0x52, 0x65, 0x73, 0x70,
0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61,
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, 0x71, 0x1a, 0x1a, 0x2e, 0x6f,
0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x42, 0x0a, 0x5a, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74,
0x08, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x71, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x6f, 0x63, 0x74,
0x33, 0x6f, 0x70, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
file_octopus_proto_rawDescOnce sync.Once file_pb_octopus_proto_rawDescOnce sync.Once
file_octopus_proto_rawDescData = file_octopus_proto_rawDesc file_pb_octopus_proto_rawDescData = file_pb_octopus_proto_rawDesc
) )
func file_octopus_proto_rawDescGZIP() []byte { func file_pb_octopus_proto_rawDescGZIP() []byte {
file_octopus_proto_rawDescOnce.Do(func() { file_pb_octopus_proto_rawDescOnce.Do(func() {
file_octopus_proto_rawDescData = protoimpl.X.CompressGZIP(file_octopus_proto_rawDescData) 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_pb_octopus_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_octopus_proto_goTypes = []interface{}{ var file_pb_octopus_proto_goTypes = []interface{}{
(*ResourceReq)(nil), // 0: octopus.resourceReq (*ResourceReq)(nil), // 0: octopus.resourceReq
(*CpResp)(nil), // 1: octopus.cpResp (*CpResp)(nil), // 1: octopus.cpResp
(*GiResp)(nil), // 2: octopus.giResp (*GiResp)(nil), // 2: octopus.giResp
(*CreateDataSetReq)(nil), // 3: octopus.CreateDataSetReq (*CreateDataSetReq)(nil), // 3: octopus.CreateDataSetReq
(*CreateDataSetResq)(nil), // 4: octopus.CreateDataSetResq (*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, // 0: octopus.Octopus.GetComputingPower:input_type -> octopus.resourceReq
0, // 1: octopus.Octopus.GetGeneralInfo:input_type -> octopus.resourceReq 0, // 1: octopus.Octopus.GetGeneralInfo:input_type -> octopus.resourceReq
3, // 2: octopus.Octopus.CreateDataSet:input_type -> octopus.CreateDataSetReq 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 0, // [0:0] is the sub-list for field type_name
} }
func init() { file_octopus_proto_init() } func init() { file_pb_octopus_proto_init() }
func file_octopus_proto_init() { func file_pb_octopus_proto_init() {
if File_octopus_proto != nil { if File_pb_octopus_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { 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 { switch v := v.(*ResourceReq); i {
case 0: case 0:
return &v.state return &v.state
@ -378,7 +378,7 @@ func file_octopus_proto_init() {
return nil 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 { switch v := v.(*CpResp); i {
case 0: case 0:
return &v.state return &v.state
@ -390,7 +390,7 @@ func file_octopus_proto_init() {
return nil 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 { switch v := v.(*GiResp); i {
case 0: case 0:
return &v.state return &v.state
@ -402,7 +402,7 @@ func file_octopus_proto_init() {
return nil 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 { switch v := v.(*CreateDataSetReq); i {
case 0: case 0:
return &v.state return &v.state
@ -414,7 +414,7 @@ func file_octopus_proto_init() {
return nil 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 { switch v := v.(*CreateDataSetResq); i {
case 0: case 0:
return &v.state return &v.state
@ -431,18 +431,18 @@ func file_octopus_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_octopus_proto_rawDesc, RawDescriptor: file_pb_octopus_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 5, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
GoTypes: file_octopus_proto_goTypes, GoTypes: file_pb_octopus_proto_goTypes,
DependencyIndexes: file_octopus_proto_depIdxs, DependencyIndexes: file_pb_octopus_proto_depIdxs,
MessageInfos: file_octopus_proto_msgTypes, MessageInfos: file_pb_octopus_proto_msgTypes,
}.Build() }.Build()
File_octopus_proto = out.File File_pb_octopus_proto = out.File
file_octopus_proto_rawDesc = nil file_pb_octopus_proto_rawDesc = nil
file_octopus_proto_goTypes = nil file_pb_octopus_proto_goTypes = nil
file_octopus_proto_depIdxs = nil file_pb_octopus_proto_depIdxs = nil
} }

View File

@ -2,7 +2,7 @@
// versions: // versions:
// - protoc-gen-go-grpc v1.2.0 // - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4 // - protoc v3.19.4
// source: octopus.proto // source: pb/octopus.proto
package octopus package octopus
@ -175,5 +175,5 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "octopus.proto", Metadata: "pb/octopus.proto",
} }

View File

@ -12,7 +12,7 @@ message cpResp{
} }
message giResp{ message giResp{
int32 cpuNum = 1; int32 cpuCoreNum = 1;
int32 memoryInGib = 2; int32 memoryInGib = 2;
} }