fix:PCM-CORE代码修改

Former-commit-id: 15b62d03fd37cd6b419c4c04202ee51b419df7da
This commit is contained in:
qiwang 2023-06-08 17:10:45 +08:00
parent 5d7741498c
commit 960f5159ea
23 changed files with 1300 additions and 29 deletions

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: nacos.jcce.dev
- IpAddr: 10.101.15.7
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -10,4 +10,6 @@ type ModelArtsConfig struct {
XDomainId string `json:"X-Domain-Id"`
HaweiModelArtsType string `json:"HaweiModelArtsType"`
NanjingModelArtsType string `json:"NanjingModelArtsType"`
HuaweiProjectId string `json:"Huawei-Project-Id"`
NanjingProjectId string `json:"Nanjing-Project-Id"`
}

View File

@ -41,9 +41,9 @@ func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*
} else {
limit = "10"
}
//根据智算类型判断走华为智算还是南京智算
modelArtsType := in.ModelArtsType
//projectId := in.ProjectId
//根据智算类型判断走华为智算还是南京智算
if modelArtsType == l.svcCtx.Config.HaweiModelArtsType {
modelArtsUrl := l.svcCtx.Config.ModelArtsUrl
url := modelArtsUrl + "v2/" + in.ProjectId + "/algorithms?offset=" + offset + "&" + "limit=" + limit
@ -67,7 +67,7 @@ func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*
SK := l.svcCtx.Config.SK
NanjingModelArtsUrl := l.svcCtx.Config.NanjingModelArtsUrl
XProjectId := l.svcCtx.Config.XProjectId
XDomainId := l.svcCtx.Config.XDomainId
//XDomainId := l.svcCtx.Config.XDomainId
s := core.Signer{
Key: AK,
Secret: SK,
@ -80,7 +80,7 @@ func (l *ListAlgorithmsLogic) ListAlgorithms(in *modelarts.ListAlgorithmsReq) (*
}
r.Header.Add("content-type", "application/json;charset=UTF-8")
r.Header.Add("X-Project-Id", XProjectId)
r.Header.Add("X-Domain-Id", XDomainId)
//r.Header.Add("X-Domain-Id", XDomainId)
r.Header.Add("x-stage", "RELEASE")
s.Sign(r)
client := http.DefaultClient

View File

@ -0,0 +1,53 @@
// Code generated by goctl. DO NOT EDIT.
// Source: pcm-ms.proto
package agentservice
import (
"context"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
ClusterReRegisterMessageProto = ms.ClusterReRegisterMessageProto
ClusterRegisterAckMessageProto = ms.ClusterRegisterAckMessageProto
ClusterStateChangeMessageProto = ms.ClusterStateChangeMessageProto
MessageProducerProto = ms.MessageProducerProto
MessageResponseProto = ms.MessageResponseProto
StringStringMapProto = ms.StringStringMapProto
AgentService interface {
RequireReRegister(ctx context.Context, in *ClusterReRegisterMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
RegisterAck(ctx context.Context, in *ClusterRegisterAckMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
ChangeClusterState(ctx context.Context, in *ClusterStateChangeMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
}
defaultAgentService struct {
cli zrpc.Client
}
)
func NewAgentService(cli zrpc.Client) AgentService {
return &defaultAgentService{
cli: cli,
}
}
func (m *defaultAgentService) RequireReRegister(ctx context.Context, in *ClusterReRegisterMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
client := ms.NewAgentServiceClient(m.cli.Conn())
return client.RequireReRegister(ctx, in, opts...)
}
func (m *defaultAgentService) RegisterAck(ctx context.Context, in *ClusterRegisterAckMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
client := ms.NewAgentServiceClient(m.cli.Conn())
return client.RegisterAck(ctx, in, opts...)
}
func (m *defaultAgentService) ChangeClusterState(ctx context.Context, in *ClusterStateChangeMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
client := ms.NewAgentServiceClient(m.cli.Conn())
return client.ChangeClusterState(ctx, in, opts...)
}

View File

@ -0,0 +1,6 @@
Name: pcmms.rpc
ListenOn: 0.0.0.0:8080
Etcd:
Hosts:
- 127.0.0.1:2379
Key: pcmms.rpc

View File

@ -0,0 +1,7 @@
package config
import "github.com/zeromicro/go-zero/zrpc"
type Config struct {
zrpc.RpcServerConf
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
"github.com/zeromicro/go-zero/core/logx"
)
type ChangeClusterStateLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewChangeClusterStateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeClusterStateLogic {
return &ChangeClusterStateLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ChangeClusterStateLogic) ChangeClusterState(in *ms.ClusterStateChangeMessageProto) (*ms.MessageResponseProto, error) {
// todo: add your logic here and delete this line
return &ms.MessageResponseProto{}, nil
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
"github.com/zeromicro/go-zero/core/logx"
)
type RegisterAckLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewRegisterAckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisterAckLogic {
return &RegisterAckLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *RegisterAckLogic) RegisterAck(in *ms.ClusterRegisterAckMessageProto) (*ms.MessageResponseProto, error) {
// todo: add your logic here and delete this line
return &ms.MessageResponseProto{}, nil
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
"github.com/zeromicro/go-zero/core/logx"
)
type RequireReRegisterLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewRequireReRegisterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RequireReRegisterLogic {
return &RequireReRegisterLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *RequireReRegisterLogic) RequireReRegister(in *ms.ClusterReRegisterMessageProto) (*ms.MessageResponseProto, error) {
// todo: add your logic here and delete this line
return &ms.MessageResponseProto{}, nil
}

View File

@ -0,0 +1,38 @@
// Code generated by goctl. DO NOT EDIT.
// Source: pcm-ms.proto
package server
import (
"context"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/logic"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
)
type AgentServiceServer struct {
svcCtx *svc.ServiceContext
ms.UnimplementedAgentServiceServer
}
func NewAgentServiceServer(svcCtx *svc.ServiceContext) *AgentServiceServer {
return &AgentServiceServer{
svcCtx: svcCtx,
}
}
func (s *AgentServiceServer) RequireReRegister(ctx context.Context, in *ms.ClusterReRegisterMessageProto) (*ms.MessageResponseProto, error) {
l := logic.NewRequireReRegisterLogic(ctx, s.svcCtx)
return l.RequireReRegister(in)
}
func (s *AgentServiceServer) RegisterAck(ctx context.Context, in *ms.ClusterRegisterAckMessageProto) (*ms.MessageResponseProto, error) {
l := logic.NewRegisterAckLogic(ctx, s.svcCtx)
return l.RegisterAck(in)
}
func (s *AgentServiceServer) ChangeClusterState(ctx context.Context, in *ms.ClusterStateChangeMessageProto) (*ms.MessageResponseProto, error) {
l := logic.NewChangeClusterStateLogic(ctx, s.svcCtx)
return l.ChangeClusterState(in)
}

View File

@ -0,0 +1,13 @@
package svc
import "PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/config"
type ServiceContext struct {
Config config.Config
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
}
}

View File

@ -0,0 +1,613 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.19.4
// source: pcm-ms.proto
package ms
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MessageStatus int32
const (
MessageStatus_FAIL MessageStatus = 0
MessageStatus_SUCCESS MessageStatus = 1
MessageStatus_UNKNOWN MessageStatus = 2
)
// Enum value maps for MessageStatus.
var (
MessageStatus_name = map[int32]string{
0: "FAIL",
1: "SUCCESS",
2: "UNKNOWN",
}
MessageStatus_value = map[string]int32{
"FAIL": 0,
"SUCCESS": 1,
"UNKNOWN": 2,
}
)
func (x MessageStatus) Enum() *MessageStatus {
p := new(MessageStatus)
*p = x
return p
}
func (x MessageStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MessageStatus) Descriptor() protoreflect.EnumDescriptor {
return file_pcm_ms_proto_enumTypes[0].Descriptor()
}
func (MessageStatus) Type() protoreflect.EnumType {
return &file_pcm_ms_proto_enumTypes[0]
}
func (x MessageStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use MessageStatus.Descriptor instead.
func (MessageStatus) EnumDescriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{0}
}
type ClusterReRegisterMessageProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MsgProducer *MessageProducerProto `protobuf:"bytes,1,opt,name=msg_producer,json=msgProducer,proto3" json:"msg_producer,omitempty"`
}
func (x *ClusterReRegisterMessageProto) Reset() {
*x = ClusterReRegisterMessageProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClusterReRegisterMessageProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClusterReRegisterMessageProto) ProtoMessage() {}
func (x *ClusterReRegisterMessageProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ClusterReRegisterMessageProto.ProtoReflect.Descriptor instead.
func (*ClusterReRegisterMessageProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{0}
}
func (x *ClusterReRegisterMessageProto) GetMsgProducer() *MessageProducerProto {
if x != nil {
return x.MsgProducer
}
return nil
}
type MessageProducerProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MsNetId string `protobuf:"bytes,1,opt,name=ms_net_id,json=msNetId,proto3" json:"ms_net_id,omitempty"`
ClusterId string `protobuf:"bytes,2,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"`
AgentServiceHost string `protobuf:"bytes,3,opt,name=agent_service_host,json=agentServiceHost,proto3" json:"agent_service_host,omitempty"`
AgentServicePort int32 `protobuf:"varint,4,opt,name=agent_service_port,json=agentServicePort,proto3" json:"agent_service_port,omitempty"`
}
func (x *MessageProducerProto) Reset() {
*x = MessageProducerProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MessageProducerProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MessageProducerProto) ProtoMessage() {}
func (x *MessageProducerProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MessageProducerProto.ProtoReflect.Descriptor instead.
func (*MessageProducerProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{1}
}
func (x *MessageProducerProto) GetMsNetId() string {
if x != nil {
return x.MsNetId
}
return ""
}
func (x *MessageProducerProto) GetClusterId() string {
if x != nil {
return x.ClusterId
}
return ""
}
func (x *MessageProducerProto) GetAgentServiceHost() string {
if x != nil {
return x.AgentServiceHost
}
return ""
}
func (x *MessageProducerProto) GetAgentServicePort() int32 {
if x != nil {
return x.AgentServicePort
}
return 0
}
type ClusterRegisterAckMessageProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MsgProducer *MessageProducerProto `protobuf:"bytes,1,opt,name=msg_producer,json=msgProducer,proto3" json:"msg_producer,omitempty"`
Configs []*StringStringMapProto `protobuf:"bytes,3,rep,name=configs,proto3" json:"configs,omitempty"`
}
func (x *ClusterRegisterAckMessageProto) Reset() {
*x = ClusterRegisterAckMessageProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClusterRegisterAckMessageProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClusterRegisterAckMessageProto) ProtoMessage() {}
func (x *ClusterRegisterAckMessageProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ClusterRegisterAckMessageProto.ProtoReflect.Descriptor instead.
func (*ClusterRegisterAckMessageProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{2}
}
func (x *ClusterRegisterAckMessageProto) GetMsgProducer() *MessageProducerProto {
if x != nil {
return x.MsgProducer
}
return nil
}
func (x *ClusterRegisterAckMessageProto) GetConfigs() []*StringStringMapProto {
if x != nil {
return x.Configs
}
return nil
}
type StringStringMapProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (x *StringStringMapProto) Reset() {
*x = StringStringMapProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StringStringMapProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StringStringMapProto) ProtoMessage() {}
func (x *StringStringMapProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StringStringMapProto.ProtoReflect.Descriptor instead.
func (*StringStringMapProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{3}
}
func (x *StringStringMapProto) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *StringStringMapProto) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
type ClusterStateChangeMessageProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MsgProducer *MessageProducerProto `protobuf:"bytes,1,opt,name=msg_producer,json=msgProducer,proto3" json:"msg_producer,omitempty"`
ClusterState int32 `protobuf:"varint,2,opt,name=cluster_state,json=clusterState,proto3" json:"cluster_state,omitempty"`
}
func (x *ClusterStateChangeMessageProto) Reset() {
*x = ClusterStateChangeMessageProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClusterStateChangeMessageProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClusterStateChangeMessageProto) ProtoMessage() {}
func (x *ClusterStateChangeMessageProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ClusterStateChangeMessageProto.ProtoReflect.Descriptor instead.
func (*ClusterStateChangeMessageProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{4}
}
func (x *ClusterStateChangeMessageProto) GetMsgProducer() *MessageProducerProto {
if x != nil {
return x.MsgProducer
}
return nil
}
func (x *ClusterStateChangeMessageProto) GetClusterState() int32 {
if x != nil {
return x.ClusterState
}
return 0
}
type MessageResponseProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MessageStatus MessageStatus `protobuf:"varint,1,opt,name=message_status,json=messageStatus,proto3,enum=ms.MessageStatus" json:"message_status,omitempty"`
}
func (x *MessageResponseProto) Reset() {
*x = MessageResponseProto{}
if protoimpl.UnsafeEnabled {
mi := &file_pcm_ms_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MessageResponseProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MessageResponseProto) ProtoMessage() {}
func (x *MessageResponseProto) ProtoReflect() protoreflect.Message {
mi := &file_pcm_ms_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MessageResponseProto.ProtoReflect.Descriptor instead.
func (*MessageResponseProto) Descriptor() ([]byte, []int) {
return file_pcm_ms_proto_rawDescGZIP(), []int{5}
}
func (x *MessageResponseProto) GetMessageStatus() MessageStatus {
if x != nil {
return x.MessageStatus
}
return MessageStatus_FAIL
}
var File_pcm_ms_proto protoreflect.FileDescriptor
var file_pcm_ms_proto_rawDesc = []byte{
0x0a, 0x0c, 0x70, 0x63, 0x6d, 0x2d, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02,
0x6d, 0x73, 0x22, 0x5c, 0x0a, 0x1d, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x52,
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x3b, 0x0a, 0x0c, 0x6d, 0x73, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x2e, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72,
0x22, 0xad, 0x01, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x0a, 0x09, 0x6d, 0x73, 0x5f,
0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x73,
0x4e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74,
0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x10, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x6f,
0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10,
0x61, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74,
0x22, 0x91, 0x01, 0x0a, 0x1e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x67, 0x69,
0x73, 0x74, 0x65, 0x72, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x3b, 0x0a, 0x0c, 0x6d, 0x73, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x2e, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72,
0x12, 0x32, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72,
0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x07, 0x63, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x73, 0x22, 0x3e, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74,
0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x1e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x3b, 0x0a, 0x0c, 0x6d, 0x73, 0x67, 0x5f, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x6d, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f,
0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6c, 0x75,
0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x50, 0x0a, 0x14, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x38, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x2e, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x33, 0x0a, 0x0d, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x08, 0x0a, 0x04,
0x46, 0x41, 0x49, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53,
0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02,
0x32, 0x87, 0x02, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x52, 0x0a, 0x11, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x52, 0x65, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6d, 0x73, 0x2e, 0x43, 0x6c, 0x75, 0x73,
0x74, 0x65, 0x72, 0x52, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x2e, 0x6d, 0x73, 0x2e, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x41, 0x63, 0x6b, 0x12, 0x22, 0x2e, 0x6d, 0x73, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x2e, 0x6d, 0x73, 0x2e, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6d, 0x73, 0x2e,
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18,
0x2e, 0x6d, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x00, 0x42, 0x05, 0x5a, 0x03, 0x2f, 0x6d,
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pcm_ms_proto_rawDescOnce sync.Once
file_pcm_ms_proto_rawDescData = file_pcm_ms_proto_rawDesc
)
func file_pcm_ms_proto_rawDescGZIP() []byte {
file_pcm_ms_proto_rawDescOnce.Do(func() {
file_pcm_ms_proto_rawDescData = protoimpl.X.CompressGZIP(file_pcm_ms_proto_rawDescData)
})
return file_pcm_ms_proto_rawDescData
}
var file_pcm_ms_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pcm_ms_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_pcm_ms_proto_goTypes = []interface{}{
(MessageStatus)(0), // 0: ms.MessageStatus
(*ClusterReRegisterMessageProto)(nil), // 1: ms.ClusterReRegisterMessageProto
(*MessageProducerProto)(nil), // 2: ms.MessageProducerProto
(*ClusterRegisterAckMessageProto)(nil), // 3: ms.ClusterRegisterAckMessageProto
(*StringStringMapProto)(nil), // 4: ms.StringStringMapProto
(*ClusterStateChangeMessageProto)(nil), // 5: ms.ClusterStateChangeMessageProto
(*MessageResponseProto)(nil), // 6: ms.MessageResponseProto
}
var file_pcm_ms_proto_depIdxs = []int32{
2, // 0: ms.ClusterReRegisterMessageProto.msg_producer:type_name -> ms.MessageProducerProto
2, // 1: ms.ClusterRegisterAckMessageProto.msg_producer:type_name -> ms.MessageProducerProto
4, // 2: ms.ClusterRegisterAckMessageProto.configs:type_name -> ms.StringStringMapProto
2, // 3: ms.ClusterStateChangeMessageProto.msg_producer:type_name -> ms.MessageProducerProto
0, // 4: ms.MessageResponseProto.message_status:type_name -> ms.MessageStatus
1, // 5: ms.AgentService.requireReRegister:input_type -> ms.ClusterReRegisterMessageProto
3, // 6: ms.AgentService.registerAck:input_type -> ms.ClusterRegisterAckMessageProto
5, // 7: ms.AgentService.changeClusterState:input_type -> ms.ClusterStateChangeMessageProto
6, // 8: ms.AgentService.requireReRegister:output_type -> ms.MessageResponseProto
6, // 9: ms.AgentService.registerAck:output_type -> ms.MessageResponseProto
6, // 10: ms.AgentService.changeClusterState:output_type -> ms.MessageResponseProto
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_pcm_ms_proto_init() }
func file_pcm_ms_proto_init() {
if File_pcm_ms_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pcm_ms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClusterReRegisterMessageProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcm_ms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MessageProducerProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcm_ms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClusterRegisterAckMessageProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcm_ms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StringStringMapProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcm_ms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClusterStateChangeMessageProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pcm_ms_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MessageResponseProto); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pcm_ms_proto_rawDesc,
NumEnums: 1,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_pcm_ms_proto_goTypes,
DependencyIndexes: file_pcm_ms_proto_depIdxs,
EnumInfos: file_pcm_ms_proto_enumTypes,
MessageInfos: file_pcm_ms_proto_msgTypes,
}.Build()
File_pcm_ms_proto = out.File
file_pcm_ms_proto_rawDesc = nil
file_pcm_ms_proto_goTypes = nil
file_pcm_ms_proto_depIdxs = nil
}

View File

@ -0,0 +1,177 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: pcm-ms.proto
package ms
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// AgentServiceClient is the client API for AgentService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AgentServiceClient interface {
RequireReRegister(ctx context.Context, in *ClusterReRegisterMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
RegisterAck(ctx context.Context, in *ClusterRegisterAckMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
ChangeClusterState(ctx context.Context, in *ClusterStateChangeMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error)
}
type agentServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient {
return &agentServiceClient{cc}
}
func (c *agentServiceClient) RequireReRegister(ctx context.Context, in *ClusterReRegisterMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
out := new(MessageResponseProto)
err := c.cc.Invoke(ctx, "/ms.AgentService/requireReRegister", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) RegisterAck(ctx context.Context, in *ClusterRegisterAckMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
out := new(MessageResponseProto)
err := c.cc.Invoke(ctx, "/ms.AgentService/registerAck", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) ChangeClusterState(ctx context.Context, in *ClusterStateChangeMessageProto, opts ...grpc.CallOption) (*MessageResponseProto, error) {
out := new(MessageResponseProto)
err := c.cc.Invoke(ctx, "/ms.AgentService/changeClusterState", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentServiceServer is the server API for AgentService service.
// All implementations must embed UnimplementedAgentServiceServer
// for forward compatibility
type AgentServiceServer interface {
RequireReRegister(context.Context, *ClusterReRegisterMessageProto) (*MessageResponseProto, error)
RegisterAck(context.Context, *ClusterRegisterAckMessageProto) (*MessageResponseProto, error)
ChangeClusterState(context.Context, *ClusterStateChangeMessageProto) (*MessageResponseProto, error)
mustEmbedUnimplementedAgentServiceServer()
}
// UnimplementedAgentServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAgentServiceServer struct {
}
func (UnimplementedAgentServiceServer) RequireReRegister(context.Context, *ClusterReRegisterMessageProto) (*MessageResponseProto, error) {
return nil, status.Errorf(codes.Unimplemented, "method RequireReRegister not implemented")
}
func (UnimplementedAgentServiceServer) RegisterAck(context.Context, *ClusterRegisterAckMessageProto) (*MessageResponseProto, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterAck not implemented")
}
func (UnimplementedAgentServiceServer) ChangeClusterState(context.Context, *ClusterStateChangeMessageProto) (*MessageResponseProto, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeClusterState not implemented")
}
func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {}
// UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AgentServiceServer will
// result in compilation errors.
type UnsafeAgentServiceServer interface {
mustEmbedUnimplementedAgentServiceServer()
}
func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) {
s.RegisterService(&AgentService_ServiceDesc, srv)
}
func _AgentService_RequireReRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClusterReRegisterMessageProto)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).RequireReRegister(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ms.AgentService/requireReRegister",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).RequireReRegister(ctx, req.(*ClusterReRegisterMessageProto))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_RegisterAck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClusterRegisterAckMessageProto)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).RegisterAck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ms.AgentService/registerAck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).RegisterAck(ctx, req.(*ClusterRegisterAckMessageProto))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_ChangeClusterState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClusterStateChangeMessageProto)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).ChangeClusterState(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ms.AgentService/changeClusterState",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).ChangeClusterState(ctx, req.(*ClusterStateChangeMessageProto))
}
return interceptor(ctx, in, info, handler)
}
// AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ms.AgentService",
HandlerType: (*AgentServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "requireReRegister",
Handler: _AgentService_RequireReRegister_Handler,
},
{
MethodName: "registerAck",
Handler: _AgentService_RegisterAck_Handler,
},
{
MethodName: "changeClusterState",
Handler: _AgentService_ChangeClusterState_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pcm-ms.proto",
}

View File

@ -0,0 +1,47 @@
syntax = "proto3";
package ms;
option go_package = "/ms";
message ClusterReRegisterMessageProto {
MessageProducerProto msg_producer = 1;
}
message MessageProducerProto {
string ms_net_id = 1;
string cluster_id = 2;
string agent_service_host = 3;
int32 agent_service_port = 4;
}
message ClusterRegisterAckMessageProto {
MessageProducerProto msg_producer = 1;
repeated StringStringMapProto configs = 3;
}
message StringStringMapProto {
string key = 1;
string value = 2;
}
message ClusterStateChangeMessageProto {
MessageProducerProto msg_producer = 1;
int32 cluster_state = 2;
}
enum MessageStatus {
FAIL = 0;
SUCCESS = 1;
UNKNOWN = 2;
}
message MessageResponseProto {
MessageStatus message_status = 1;
}
service AgentService {
rpc requireReRegister (ClusterReRegisterMessageProto) returns (MessageResponseProto) {};
rpc registerAck (ClusterRegisterAckMessageProto) returns (MessageResponseProto) {};
rpc changeClusterState (ClusterStateChangeMessageProto) returns (MessageResponseProto) {};
}

View File

@ -0,0 +1,39 @@
package main
import (
"flag"
"fmt"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/config"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/server"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MS/rpc/ms"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
var configFile = flag.String("f", "etc/pcmms.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
ms.RegisterAgentServiceServer(grpcServer, server.NewAgentServiceServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
defer s.Stop()
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
s.Start()
}

View File

@ -525,12 +525,18 @@ type JobAlgorithmResponse{
LocalCodeDir string `json:"localCodeDir"`
WorkingDir string `json:"workingDir"`
Environments []map[string]string `json:"environments"`
}
}
type (
ListTrainingJobsreq {
ProjectId string `path:"projectId"`
Limit int32 `form:"limit,optional"`
Offset int32 `form:"offSet,optional"`
/****************parmas from octpus
platform string `json:"platform,optional"`
pageIndex int32 `json:"pageIndex,optional"`
pageSize int32 `json:"pageSize,optional"`********************/
/****************智算类型 ModelartsType parmas ********************/
//ModelartsType string `json:"modelartsType,optional"`
}
ListTrainingJobsresp {
Total int32 `json:"total"`
@ -546,7 +552,42 @@ type (
Code int32 `json:"code,omitempty,omitempty"`
Msg string `json:"msg,omitempty,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
/****************parmas from octpus
success bool `json:"success"`
payload PayloadGetTrainJobList `json:"payload"`
error Error `json:"error"`********************/
}
/****************parmas from octpus
PayloadGetTrainJobList {
totalSize int32 `json:"totalSize"`
trainJobs []*TrainJob `json:"trainJobs,optional,omitempty"`
}
TrainJob {
algorithmId string `json:"algorithmId,optional" copier:"algorithmId"`
algorithmName string `json:"algorithmId,optional" copier:"algorithmId"`
algorithmVersion string `json:"algorithmVersion,optional" copier:"algorithmVersion"`
completedAt int64 `json:"completedAt,optional" copier:"completedAt"`
config []*Config `json:"config,optional" copier:"config"`
createdAt int64 `json:"createdAt,optional" copier:"createdAt"`
dataSetId string `json:"dataSetId,optional" copier:"dataSetId"`
dataSetName string `json:"dataSetName,optional" copier:"dataSetName"`
dataSetVersion string `json:"dataSetVersion,optional" copier:"dataSetVersion"`
desc string `json:"desc,optional" copier:"desc"`
id string `json:"id,optional" copier:"id"`
imageId string `json:"imageId,optional" copier:"imageId"`
imageName string `json:"imageName,optional" copier:"imageName"`
imageUrl string `json:"imageUrl,optional" copier:"imageUrl"`
imageVersion string `json:"imageVersion,optional" copier:"imageVersion"`
isDistributed string `json:"isDistributed,optional" copier:"isDistributed"`
name string `json:"name,optional" copier:"name"`
resourcePool int64 `json:"resourcePool,optional" copier:"resourcePool"`
runSec int64 `json:"runSec,optional" copier:"runSec"`
startedAt int64 `json:"startedAt,optional" copier:"startedAt"`
status string `json:"status,optional" copier:"status"`
updatedAt int64 `json:"updatedAt,optional" copier:"updatedAt"`
userId string `json:"userId,optional" copier:"userId"`
workspaceId string `json:"workspaceId,optional" copier:"workspaceId"`
}********************/
)
/******************ListTrainingJobs end*************************/
@ -555,12 +596,26 @@ type (
DeleteTrainingJobReq {
Project_id string `path:"projectId"`
Training_job_id string `path:"trainingJobId"`
/****************parmas from octpus
platform string `path:"platform"`
jobIds []*string `path:"jobIds"`
********************/
}
DeleteTrainingJobResp {
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
/****************parmas from octpus
success bool `json:"success,optional"`
payload PayloadDeleteTrainJob `json:"payload,optional"`
error Error `json:"error,optional"`
********************/
}
/****************parmas from octpus
PayloadDeleteTrainJob {
deletedAt int64 `json:"deletedAt,optional"`
}********************/
)
/******************DeleteTrainingJob end*************************/
@ -929,25 +984,34 @@ type SearchParams {
type (
ListAlgorithmsReq {
ProjectId string `path:"projectId"`
//ProjectId string `path:"projectId"`
ProjectId string `form:"projectId,optional"`
Offset int32 `form:"offset,optional"`
Limit int32 `form:"limit,optional"`
/****************parmas from modelArtsType ********************/
modelArtsType string `form:"modelArtsType,optional"`
// SortBy string `json:"sort_by,optional"`
// Order string `json:"order,optional"`
// GroupBy string `json:"group_by,optional"`
// Searches string `json:"searches,optional"`
// WorkspaceId string `json:"workspace_id,optional"`
/****************parmas from octpus
platform string `path:"platform"`
pageIndex int32 `form:"pageIndex,optional"`
pageSize int32 `form:"pageSize,optional"`
********************/
}
ListAlgorithmsResp {
Total int32 `json:"total,omitempty"`
Count int32 `json:"count,omitempty"`
Limit int32 `json:"limit,omitempty"`
SortBy string `json:"sortBy,omitempty"`
Order string `json:"order,omitempty"`
Items []*AlgorithmResponse `json:"items,omitempty"`
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
ListAlgorithmsResp {
Total int32 `json:"total,omitempty"`
Count int32 `json:"count,omitempty"`
Limit int32 `json:"limit,omitempty"`
SortBy string `json:"sortBy,omitempty"`
Order string `json:"order,omitempty"`
Items []*AlgorithmResponse `json:"items,omitempty"`
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
/****************parmas from octpus********************/
}
)
@ -1190,7 +1254,7 @@ type (
}
UserNotebookDomain{
Id string `json:"id,omitempty" copier:"Id"` // *
Id string `json:"id,omitempty" copier:"Id"` // *
Name string `json:"name,omitempty" copier:"Name"` // *
}
@ -1290,8 +1354,23 @@ type (
PreStart Config `json:"pre_start" copier:"PreStart"`
}
Config {
/****************parmas from modelarts********************/
Script string `json:"script" copier:"Script"`
TypeConfig string `json:"type" copier:"TypeConfig"`
/****************parmas from octopus
command string `json:"command" copier:"command"`
envs Envs `json:"envs" copier:"envs"`
isMainRole bool `json:"isMainRole" copier:"isMainRole"`
minFailedTaskCount int32 `json:"minFailedTaskCount" copier:"minFailedTaskCount"`
minSucceededTaskCount int32 `json:"minSucceededTaskCount" copier:"minSucceededTaskCount"`
name string `json:"name" copier:"name"`
parameters Parameters `json:"parameters" copier:"parameters"`
replicaStates ReplicaStates `json:"replicaStates" copier:"replicaStates"`
resourceSpecId string `json:"resourceSpecId" copier:"resourceSpecId"`
resourceSpecPrice int32 `json:"resourceSpecPrice" copier:"resourceSpecPrice"`
subTaskState string `json:"subTaskState" copier:"subTaskState"`
taskNumber int32 `json:"taskNumber" copier:"taskNumber"`
********************/
}
LeaseReq {
Duration int64 `json:"duration,omitempty" copier:"Duration"`
@ -1371,11 +1450,16 @@ type (
type (
CreateTrainingJobReq { //创建训练任务入参
/****************parmas from modelarts********************/
Kind string `json:"kind,optional"`
Metadatas MetadataS `json:"metadata,optional"`
AlgorithmsCtRq AlgorithmsCtRq `json:"algorithm,optional"`
SpecsCtRq SpecsCtRq `json:"spec,optional"`
ProjectId string `path:"projectId""`
/****************parmas from octpus
platform string `json:"platform,optional"`
params CreateTrainJobParam `json:"params,optional"`
********************/
}
CreateTrainingJobResp { //创建训练任务出参
@ -1387,6 +1471,11 @@ type (
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"ErrorMsg,omitempty"`
/****************parmas from octpus
success bool `json:"success,omitempty"`
error Error `json:"error,omitempty"`
payload PayloadCreateTrainJob `json:"error,omitempty"`
********************/
}
MetadataS {
Id string `json:"id,optional"`
@ -1461,7 +1550,60 @@ type (
NfsServerPath string `json:"nfsServer_path,optional"`
LocalPath string `json:"localPath,optional"`
ReadOnly bool `json:"readOnly,optional"`
/****************parmas from octpus
path string `json:"path,optional"`
server string `json:"server,optional"`
********************/
}
/****************parmas from octpus
CreateTrainJobParam {
algorithmId string `json:"algorithmId,optional"`
algorithmVersion string `json:"algorithmVersion,optional"`
config Config `json:"config,optional"`
dataSetId string `json:"dataSetId,optional"`
dataSetVersion string `json:"dataSetVersion,optional"`
desc string `json:"desc,optional"`
imageId string `json:"imageId,optional"`
imageUrl string `json:"imageUrl,optional"`
isDistributed bool `json:"isDistributed,optional"`
mounts Mounts `json:"mounts,optional"`
name string `json:"name,optional"`
resourcePool string `json:"resourcePool,optional"`
}
Envs{
additionalProp1 string `json:"algorithmId,optional"`
additionalProp2 string `json:"algorithmId,optional"`
additionalProp3 string `json:"algorithmId,optional"`
}
ReplicaStates{
key string `json:"key,optional"`
state string `json:"state,optional"`
}
Mounts{
containerPath string `json:"containerPath,optional"`
nfs Nfs `json:"nfs,optional"`
octopus TrainJobOctopus `json:"octopus,optional"`
readOnly bool `json:"readOnly,optional"`
}
TrainJobOctopus{
bucket string `json:"bucket,optional"`
object string `json:"object,optional"`
}
Error{
code int32 `json:"code,optional"`
subcode int32 `json:"subcode,optional"`
message string `json:"message,optional"`
subMessage string `json:"subMessage,optional"`
}
PayloadCreateTrainJob{
jobId string `json:"jobId,optional"`
}
********************/
)
/******************create TrainIngJob end*************************/

View File

@ -102,7 +102,8 @@ service pcm {
post /ai/CreateAlgorithm/:projectId (CreateAlgorithmReq) returns (CreateAlgorithmResp)
// ListAlgorithms 查询创建算法列表
@handler ListAlgorithms
get /ai/ListAlgorithms/:projectId (ListAlgorithmsReq) returns (ListAlgorithmsResp)
get /ai/ListAlgorithms (ListAlgorithmsReq) returns (ListAlgorithmsResp)
//get /ai/ListAlgorithms/:projectId (ListAlgorithmsReq) returns (ListAlgorithmsResp)
// DeleteAlgorithm 删除算法
@handler DeleteAlgorithm
delete /ai/DeleteAlgorithm/:projectId/:algorithmId (DeleteAlgorithmReq) returns (DeleteAlgorithmResp)

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: nacos.jcce.dev
- IpAddr: 10.101.15.7
Port: 8848
ClientConfig:
NamespaceId: test

View File

@ -141,7 +141,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodGet,
Path: "/ai/ListAlgorithms/:projectId",
Path: "/ai/ListAlgorithms",
Handler: ai.ListAlgorithmsHandler(serverCtx),
},
{
@ -292,7 +292,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: image.CheckHandler(serverCtx),
},
},
rest.WithMaxBytes(111111111),
rest.WithPrefix("/pcm/v1"),
)
}

View File

@ -30,6 +30,7 @@ func NewCreateTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext)
func (l *CreateTrainingJobLogic) CreateTrainingJob(req *types.CreateTrainingJobReq) (resp *types.CreateTrainingJobResp, err error) {
// todo: add your logic here and delete this line
//modelartsType := req.ModelartsType
modelartsReq := &modelarts.CreateTrainingJobReq{}
err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: tool.Converters})
CreateTrainingJobResp, err := l.svcCtx.ModelArtsRpc.CreateTrainingJob(l.ctx, modelartsReq)

View File

@ -2,6 +2,8 @@ package ai
import (
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"PCM/common/result"
"PCM/common/tool"
"PCM/common/xerr"
@ -10,9 +12,6 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/json"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
@ -43,5 +42,48 @@ func (l *GetListTrainingJobsLogic) GetListTrainingJobs(req *types.ListTrainingJo
}
json.Unmarshal(marshal, &resp)
err = copier.CopyWithOption(&resp, &listDataSetResp, copier.Option{Converters: tool.Converters})
/* modelartsType := req.ModelartsType
switch modelartsType {
case "octops":
octopusReq := &octopus.GetTrainJobListReq{}
err = copier.CopyWithOption(octopusReq, req, copier.Option{Converters: tool.Converters})
listTrainJobResp, err := l.svcCtx.OctopusRpc.GetTrainJobList(l.ctx, octopusReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db TrainJobs list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
}
marshal, err := json.Marshal(&listTrainJobResp)
if err != nil {
return nil, result.NewDefaultError(err.Error())
}
json.Unmarshal(marshal, &resp)
err = copier.CopyWithOption(&resp, &listTrainJobResp, copier.Option{Converters: tool.Converters})
case "cn-north-4.myhuawei":
modelartsReq := &modelarts.ListTrainingJobsreq{}
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
listDataSetResp, err := l.svcCtx.ModelArtsRpc.GetListTrainingJobs(l.ctx, modelartsReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db TrainJobs list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
}
marshal, err := json.Marshal(&listDataSetResp)
if err != nil {
return nil, result.NewDefaultError(err.Error())
}
json.Unmarshal(marshal, &resp)
err = copier.CopyWithOption(&resp, &listDataSetResp, copier.Option{Converters: tool.Converters})
case "cn-east-293.njaci":
modelartsReq := &modelarts.ListTrainingJobsreq{}
err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
listDataSetResp, err := l.svcCtx.ModelArtsRpc.GetListTrainingJobs(l.ctx, modelartsReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db TrainJobs list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
}
marshal, err := json.Marshal(&listDataSetResp)
if err != nil {
return nil, result.NewDefaultError(err.Error())
}
json.Unmarshal(marshal, &resp)
err = copier.CopyWithOption(&resp, &listDataSetResp, copier.Option{Converters: tool.Converters})
}*/
return resp, nil
}

View File

@ -1264,9 +1264,10 @@ type SearchParams struct {
}
type ListAlgorithmsReq struct {
ProjectId string `path:"projectId"`
Offset int32 `form:"offset,optional"`
Limit int32 `form:"limit,optional"`
ProjectId string `form:"projectId,optional"`
Offset int32 `form:"offset,optional"`
Limit int32 `form:"limit,optional"`
ModelArtsType string `form:"modelArtsType,optional"`
}
type ListAlgorithmsResp struct {

View File

@ -4,7 +4,7 @@ NacosConfig:
ServerConfigs:
# - IpAddr: 127.0.0.1
# Port: 8848
- IpAddr: nacos.jcce.dev
- IpAddr: 10.101.15.7
Port: 8848
ClientConfig:
NamespaceId: test