diff --git a/api/profile/profile.pb.go b/api/profile/profile.pb.go index 43ddc8c7f3ad76831192e4a0264cef64031e8bfd..f449d9ccc1e47604ea5d375739cb4852d6f33d35 100644 --- a/api/profile/profile.pb.go +++ b/api/profile/profile.pb.go @@ -1,33 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: profile.proto -/* -Package profile is a generated protocol buffer package. - -It is generated from these files: - profile.proto - -It has these top-level messages: - ListMessage - ProfileInfo - AnalysisMessage - Ack - AckCheck - ProfileLog - CollectFlag - TrainMessage - DefineMessage - ScheduleMessage -*/ package profile -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -39,18 +22,41 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ListMessage struct { - WorkloadType string `protobuf:"bytes,1,opt,name=WorkloadType" json:"WorkloadType,omitempty"` - ProfileNames string `protobuf:"bytes,2,opt,name=ProfileNames" json:"ProfileNames,omitempty"` - Active string `protobuf:"bytes,3,opt,name=Active" json:"Active,omitempty"` + WorkloadType string `protobuf:"bytes,1,opt,name=WorkloadType,proto3" json:"WorkloadType,omitempty"` + ProfileNames string `protobuf:"bytes,2,opt,name=ProfileNames,proto3" json:"ProfileNames,omitempty"` + Active string `protobuf:"bytes,3,opt,name=Active,proto3" json:"Active,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListMessage) Reset() { *m = ListMessage{} } +func (m *ListMessage) String() string { return proto.CompactTextString(m) } +func (*ListMessage) ProtoMessage() {} +func (*ListMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{0} +} + +func (m *ListMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListMessage.Unmarshal(m, b) +} +func (m *ListMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListMessage.Marshal(b, m, deterministic) +} +func (m *ListMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListMessage.Merge(m, src) +} +func (m *ListMessage) XXX_Size() int { + return xxx_messageInfo_ListMessage.Size(m) +} +func (m *ListMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ListMessage.DiscardUnknown(m) } -func (m *ListMessage) Reset() { *m = ListMessage{} } -func (m *ListMessage) String() string { return proto.CompactTextString(m) } -func (*ListMessage) ProtoMessage() {} -func (*ListMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_ListMessage proto.InternalMessageInfo func (m *ListMessage) GetWorkloadType() string { if m != nil { @@ -74,14 +80,37 @@ func (m *ListMessage) GetActive() string { } type ProfileInfo struct { - Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"` - Content []byte `protobuf:"bytes,2,opt,name=Content,proto3" json:"Content,omitempty"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Content []byte `protobuf:"bytes,2,opt,name=Content,proto3" json:"Content,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProfileInfo) Reset() { *m = ProfileInfo{} } +func (m *ProfileInfo) String() string { return proto.CompactTextString(m) } +func (*ProfileInfo) ProtoMessage() {} +func (*ProfileInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{1} +} + +func (m *ProfileInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProfileInfo.Unmarshal(m, b) +} +func (m *ProfileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProfileInfo.Marshal(b, m, deterministic) +} +func (m *ProfileInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProfileInfo.Merge(m, src) +} +func (m *ProfileInfo) XXX_Size() int { + return xxx_messageInfo_ProfileInfo.Size(m) +} +func (m *ProfileInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ProfileInfo.DiscardUnknown(m) } -func (m *ProfileInfo) Reset() { *m = ProfileInfo{} } -func (m *ProfileInfo) String() string { return proto.CompactTextString(m) } -func (*ProfileInfo) ProtoMessage() {} -func (*ProfileInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_ProfileInfo proto.InternalMessageInfo func (m *ProfileInfo) GetName() string { if m != nil { @@ -98,14 +127,37 @@ func (m *ProfileInfo) GetContent() []byte { } type AnalysisMessage struct { - Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"` - Model string `protobuf:"bytes,2,opt,name=Model" json:"Model,omitempty"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Model string `protobuf:"bytes,2,opt,name=Model,proto3" json:"Model,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AnalysisMessage) Reset() { *m = AnalysisMessage{} } +func (m *AnalysisMessage) String() string { return proto.CompactTextString(m) } +func (*AnalysisMessage) ProtoMessage() {} +func (*AnalysisMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{2} +} + +func (m *AnalysisMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AnalysisMessage.Unmarshal(m, b) +} +func (m *AnalysisMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AnalysisMessage.Marshal(b, m, deterministic) +} +func (m *AnalysisMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_AnalysisMessage.Merge(m, src) +} +func (m *AnalysisMessage) XXX_Size() int { + return xxx_messageInfo_AnalysisMessage.Size(m) +} +func (m *AnalysisMessage) XXX_DiscardUnknown() { + xxx_messageInfo_AnalysisMessage.DiscardUnknown(m) } -func (m *AnalysisMessage) Reset() { *m = AnalysisMessage{} } -func (m *AnalysisMessage) String() string { return proto.CompactTextString(m) } -func (*AnalysisMessage) ProtoMessage() {} -func (*AnalysisMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +var xxx_messageInfo_AnalysisMessage proto.InternalMessageInfo func (m *AnalysisMessage) GetName() string { if m != nil { @@ -122,13 +174,36 @@ func (m *AnalysisMessage) GetModel() string { } type Ack struct { - Status string `protobuf:"bytes,1,opt,name=Status" json:"Status,omitempty"` + Status string `protobuf:"bytes,1,opt,name=Status,proto3" json:"Status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Ack) Reset() { *m = Ack{} } +func (m *Ack) String() string { return proto.CompactTextString(m) } +func (*Ack) ProtoMessage() {} +func (*Ack) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{3} } -func (m *Ack) Reset() { *m = Ack{} } -func (m *Ack) String() string { return proto.CompactTextString(m) } -func (*Ack) ProtoMessage() {} -func (*Ack) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *Ack) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Ack.Unmarshal(m, b) +} +func (m *Ack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Ack.Marshal(b, m, deterministic) +} +func (m *Ack) XXX_Merge(src proto.Message) { + xxx_messageInfo_Ack.Merge(m, src) +} +func (m *Ack) XXX_Size() int { + return xxx_messageInfo_Ack.Size(m) +} +func (m *Ack) XXX_DiscardUnknown() { + xxx_messageInfo_Ack.DiscardUnknown(m) +} + +var xxx_messageInfo_Ack proto.InternalMessageInfo func (m *Ack) GetStatus() string { if m != nil { @@ -138,15 +213,38 @@ func (m *Ack) GetStatus() string { } type AckCheck struct { - Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"` - Status string `protobuf:"bytes,2,opt,name=Status" json:"Status,omitempty"` - Description string `protobuf:"bytes,3,opt,name=Description" json:"Description,omitempty"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Status string `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` + Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AckCheck) Reset() { *m = AckCheck{} } +func (m *AckCheck) String() string { return proto.CompactTextString(m) } +func (*AckCheck) ProtoMessage() {} +func (*AckCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{4} +} + +func (m *AckCheck) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AckCheck.Unmarshal(m, b) +} +func (m *AckCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AckCheck.Marshal(b, m, deterministic) +} +func (m *AckCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_AckCheck.Merge(m, src) +} +func (m *AckCheck) XXX_Size() int { + return xxx_messageInfo_AckCheck.Size(m) +} +func (m *AckCheck) XXX_DiscardUnknown() { + xxx_messageInfo_AckCheck.DiscardUnknown(m) } -func (m *AckCheck) Reset() { *m = AckCheck{} } -func (m *AckCheck) String() string { return proto.CompactTextString(m) } -func (*AckCheck) ProtoMessage() {} -func (*AckCheck) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +var xxx_messageInfo_AckCheck proto.InternalMessageInfo func (m *AckCheck) GetName() string { if m != nil { @@ -170,15 +268,38 @@ func (m *AckCheck) GetDescription() string { } type ProfileLog struct { - Id int64 `protobuf:"varint,1,opt,name=Id" json:"Id,omitempty"` - ProfileId string `protobuf:"bytes,2,opt,name=ProfileId" json:"ProfileId,omitempty"` - Timestamp string `protobuf:"bytes,3,opt,name=Timestamp" json:"Timestamp,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` + ProfileId string `protobuf:"bytes,2,opt,name=ProfileId,proto3" json:"ProfileId,omitempty"` + Timestamp string `protobuf:"bytes,3,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProfileLog) Reset() { *m = ProfileLog{} } +func (m *ProfileLog) String() string { return proto.CompactTextString(m) } +func (*ProfileLog) ProtoMessage() {} +func (*ProfileLog) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{5} } -func (m *ProfileLog) Reset() { *m = ProfileLog{} } -func (m *ProfileLog) String() string { return proto.CompactTextString(m) } -func (*ProfileLog) ProtoMessage() {} -func (*ProfileLog) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *ProfileLog) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProfileLog.Unmarshal(m, b) +} +func (m *ProfileLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProfileLog.Marshal(b, m, deterministic) +} +func (m *ProfileLog) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProfileLog.Merge(m, src) +} +func (m *ProfileLog) XXX_Size() int { + return xxx_messageInfo_ProfileLog.Size(m) +} +func (m *ProfileLog) XXX_DiscardUnknown() { + xxx_messageInfo_ProfileLog.DiscardUnknown(m) +} + +var xxx_messageInfo_ProfileLog proto.InternalMessageInfo func (m *ProfileLog) GetId() int64 { if m != nil { @@ -202,19 +323,42 @@ func (m *ProfileLog) GetTimestamp() string { } type CollectFlag struct { - Interval int64 `protobuf:"varint,1,opt,name=Interval" json:"Interval,omitempty"` - Duration int64 `protobuf:"varint,2,opt,name=Duration" json:"Duration,omitempty"` - Workload string `protobuf:"bytes,3,opt,name=Workload" json:"Workload,omitempty"` - OutputPath string `protobuf:"bytes,4,opt,name=OutputPath" json:"OutputPath,omitempty"` - Block string `protobuf:"bytes,5,opt,name=Block" json:"Block,omitempty"` - Network string `protobuf:"bytes,6,opt,name=Network" json:"Network,omitempty"` - Type string `protobuf:"bytes,7,opt,name=Type" json:"Type,omitempty"` + Interval int64 `protobuf:"varint,1,opt,name=Interval,proto3" json:"Interval,omitempty"` + Duration int64 `protobuf:"varint,2,opt,name=Duration,proto3" json:"Duration,omitempty"` + Workload string `protobuf:"bytes,3,opt,name=Workload,proto3" json:"Workload,omitempty"` + OutputPath string `protobuf:"bytes,4,opt,name=OutputPath,proto3" json:"OutputPath,omitempty"` + Block string `protobuf:"bytes,5,opt,name=Block,proto3" json:"Block,omitempty"` + Network string `protobuf:"bytes,6,opt,name=Network,proto3" json:"Network,omitempty"` + Type string `protobuf:"bytes,7,opt,name=Type,proto3" json:"Type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollectFlag) Reset() { *m = CollectFlag{} } +func (m *CollectFlag) String() string { return proto.CompactTextString(m) } +func (*CollectFlag) ProtoMessage() {} +func (*CollectFlag) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{6} } -func (m *CollectFlag) Reset() { *m = CollectFlag{} } -func (m *CollectFlag) String() string { return proto.CompactTextString(m) } -func (*CollectFlag) ProtoMessage() {} -func (*CollectFlag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (m *CollectFlag) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollectFlag.Unmarshal(m, b) +} +func (m *CollectFlag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollectFlag.Marshal(b, m, deterministic) +} +func (m *CollectFlag) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollectFlag.Merge(m, src) +} +func (m *CollectFlag) XXX_Size() int { + return xxx_messageInfo_CollectFlag.Size(m) +} +func (m *CollectFlag) XXX_DiscardUnknown() { + xxx_messageInfo_CollectFlag.DiscardUnknown(m) +} + +var xxx_messageInfo_CollectFlag proto.InternalMessageInfo func (m *CollectFlag) GetInterval() int64 { if m != nil { @@ -266,14 +410,37 @@ func (m *CollectFlag) GetType() string { } type TrainMessage struct { - DataPath string `protobuf:"bytes,1,opt,name=DataPath" json:"DataPath,omitempty"` - OutputPath string `protobuf:"bytes,2,opt,name=OutputPath" json:"OutputPath,omitempty"` + DataPath string `protobuf:"bytes,1,opt,name=DataPath,proto3" json:"DataPath,omitempty"` + OutputPath string `protobuf:"bytes,2,opt,name=OutputPath,proto3" json:"OutputPath,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TrainMessage) Reset() { *m = TrainMessage{} } -func (m *TrainMessage) String() string { return proto.CompactTextString(m) } -func (*TrainMessage) ProtoMessage() {} -func (*TrainMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (m *TrainMessage) Reset() { *m = TrainMessage{} } +func (m *TrainMessage) String() string { return proto.CompactTextString(m) } +func (*TrainMessage) ProtoMessage() {} +func (*TrainMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{7} +} + +func (m *TrainMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TrainMessage.Unmarshal(m, b) +} +func (m *TrainMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TrainMessage.Marshal(b, m, deterministic) +} +func (m *TrainMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_TrainMessage.Merge(m, src) +} +func (m *TrainMessage) XXX_Size() int { + return xxx_messageInfo_TrainMessage.Size(m) +} +func (m *TrainMessage) XXX_DiscardUnknown() { + xxx_messageInfo_TrainMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_TrainMessage proto.InternalMessageInfo func (m *TrainMessage) GetDataPath() string { if m != nil { @@ -290,15 +457,38 @@ func (m *TrainMessage) GetOutputPath() string { } type DefineMessage struct { - WorkloadType string `protobuf:"bytes,1,opt,name=WorkloadType" json:"WorkloadType,omitempty"` - ProfileName string `protobuf:"bytes,2,opt,name=ProfileName" json:"ProfileName,omitempty"` - Content []byte `protobuf:"bytes,3,opt,name=Content,proto3" json:"Content,omitempty"` + WorkloadType string `protobuf:"bytes,1,opt,name=WorkloadType,proto3" json:"WorkloadType,omitempty"` + ProfileName string `protobuf:"bytes,2,opt,name=ProfileName,proto3" json:"ProfileName,omitempty"` + Content []byte `protobuf:"bytes,3,opt,name=Content,proto3" json:"Content,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefineMessage) Reset() { *m = DefineMessage{} } +func (m *DefineMessage) String() string { return proto.CompactTextString(m) } +func (*DefineMessage) ProtoMessage() {} +func (*DefineMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{8} +} + +func (m *DefineMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DefineMessage.Unmarshal(m, b) +} +func (m *DefineMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DefineMessage.Marshal(b, m, deterministic) +} +func (m *DefineMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefineMessage.Merge(m, src) +} +func (m *DefineMessage) XXX_Size() int { + return xxx_messageInfo_DefineMessage.Size(m) +} +func (m *DefineMessage) XXX_DiscardUnknown() { + xxx_messageInfo_DefineMessage.DiscardUnknown(m) } -func (m *DefineMessage) Reset() { *m = DefineMessage{} } -func (m *DefineMessage) String() string { return proto.CompactTextString(m) } -func (*DefineMessage) ProtoMessage() {} -func (*DefineMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +var xxx_messageInfo_DefineMessage proto.InternalMessageInfo func (m *DefineMessage) GetWorkloadType() string { if m != nil { @@ -322,15 +512,38 @@ func (m *DefineMessage) GetContent() []byte { } type ScheduleMessage struct { - App string `protobuf:"bytes,1,opt,name=App" json:"App,omitempty"` - Type string `protobuf:"bytes,2,opt,name=Type" json:"Type,omitempty"` - Strategy string `protobuf:"bytes,3,opt,name=Strategy" json:"Strategy,omitempty"` + App string `protobuf:"bytes,1,opt,name=App,proto3" json:"App,omitempty"` + Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` + Strategy string `protobuf:"bytes,3,opt,name=Strategy,proto3" json:"Strategy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ScheduleMessage) Reset() { *m = ScheduleMessage{} } -func (m *ScheduleMessage) String() string { return proto.CompactTextString(m) } -func (*ScheduleMessage) ProtoMessage() {} -func (*ScheduleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (m *ScheduleMessage) Reset() { *m = ScheduleMessage{} } +func (m *ScheduleMessage) String() string { return proto.CompactTextString(m) } +func (*ScheduleMessage) ProtoMessage() {} +func (*ScheduleMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_744bf7a47b381504, []int{9} +} + +func (m *ScheduleMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ScheduleMessage.Unmarshal(m, b) +} +func (m *ScheduleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ScheduleMessage.Marshal(b, m, deterministic) +} +func (m *ScheduleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ScheduleMessage.Merge(m, src) +} +func (m *ScheduleMessage) XXX_Size() int { + return xxx_messageInfo_ScheduleMessage.Size(m) +} +func (m *ScheduleMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ScheduleMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ScheduleMessage proto.InternalMessageInfo func (m *ScheduleMessage) GetApp() string { if m != nil { @@ -366,6 +579,54 @@ func init() { proto.RegisterType((*ScheduleMessage)(nil), "profile.ScheduleMessage") } +func init() { proto.RegisterFile("profile.proto", fileDescriptor_744bf7a47b381504) } + +var fileDescriptor_744bf7a47b381504 = []byte{ + // 663 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x5b, 0x4f, 0xdb, 0x4c, + 0x10, 0x25, 0x0e, 0x24, 0x61, 0x12, 0x2e, 0xdf, 0x8a, 0x0f, 0x59, 0xa8, 0xad, 0x90, 0x9f, 0x78, + 0x42, 0xa8, 0x95, 0x7a, 0x51, 0x04, 0x55, 0x1a, 0x54, 0x29, 0x15, 0x50, 0x94, 0x04, 0x95, 0xd7, + 0xc5, 0x5e, 0x1c, 0xcb, 0x1b, 0xaf, 0xb5, 0xde, 0x50, 0xd1, 0xdf, 0xd7, 0xfe, 0xaf, 0x6a, 0x6f, + 0xce, 0x06, 0x25, 0x95, 0x9c, 0x37, 0x9f, 0x99, 0x39, 0x73, 0xd9, 0x9d, 0xb3, 0x86, 0x9d, 0x9c, + 0xb3, 0xc7, 0x84, 0x92, 0xd3, 0x9c, 0x33, 0xc1, 0x50, 0xd3, 0xc0, 0x60, 0x0a, 0xed, 0xab, 0xa4, + 0x10, 0xd7, 0xa4, 0x28, 0x70, 0x4c, 0x50, 0x00, 0x9d, 0x1f, 0x8c, 0xa7, 0x94, 0xe1, 0x68, 0xfc, + 0x9c, 0x13, 0xbf, 0x76, 0x5c, 0x3b, 0xd9, 0x1e, 0x2e, 0xd8, 0x64, 0xcc, 0xad, 0x66, 0xdf, 0xe0, + 0x29, 0x29, 0x7c, 0x4f, 0xc7, 0xb8, 0x36, 0x74, 0x08, 0x8d, 0x5e, 0x28, 0x92, 0x27, 0xe2,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0x59, 0x5c, 0xa1, 0xe6, 0x49, + 0xed, 0xac, 0x86, 0x2e, 0xa0, 0x23, 0xdf, 0xa4, 0x72, 0x07, 0x97, 0xd3, 0xe7, 0x56, 0xe7, 0x01, + 0x53, 0x85, 0xcf, 0x61, 0xf7, 0x2e, 0x8f, 0x39, 0x8e, 0xc8, 0x5a, 0x43, 0x9f, 0x43, 0x5b, 0xba, + 0xff, 0xcd, 0x5d, 0x6a, 0x55, 0xf4, 0x1e, 0x20, 0x95, 0x4b, 0xbf, 0x78, 0x6b, 0x75, 0x70, 0x01, + 0x7b, 0x26, 0x6a, 0xc8, 0x28, 0x7d, 0xc0, 0x61, 0x5a, 0x99, 0xdf, 0x9f, 0x60, 0xb9, 0x4b, 0x3c, + 0xf9, 0xa5, 0x35, 0x5e, 0x89, 0xff, 0x09, 0xc0, 0xbc, 0x2b, 0x8b, 0x54, 0xe7, 0xb1, 0x59, 0x45, + 0xfd, 0x08, 0x2d, 0xa5, 0x65, 0x79, 0xed, 0xff, 0x97, 0x21, 0xae, 0xbc, 0x57, 0x31, 0xcf, 0xa0, + 0xa1, 0x95, 0x8b, 0x0e, 0xcb, 0x80, 0x05, 0x29, 0x1f, 0x75, 0x5c, 0x62, 0xb0, 0xa1, 0x19, 0x94, + 0x88, 0x4a, 0x8c, 0xbb, 0x3c, 0xc2, 0x15, 0x18, 0x5d, 0x68, 0x59, 0x79, 0x3b, 0x0a, 0x78, 0xa1, + 0xf8, 0x15, 0x23, 0x3d, 0x34, 0xd4, 0xcf, 0xf6, 0xdd, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, + 0x31, 0xec, 0xbd, 0x7d, 0x07, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -374,13 +635,14 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for ProfileMgr service - +// ProfileMgrClient is the client API for ProfileMgr service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ProfileMgrClient interface { Profile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_ProfileClient, error) CheckInitProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_CheckInitProfileClient, error) Analysis(ctx context.Context, in *AnalysisMessage, opts ...grpc.CallOption) (ProfileMgr_AnalysisClient, error) - Tuning(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_TuningClient, error) + Tuning(ctx context.Context, opts ...grpc.CallOption) (ProfileMgr_TuningClient, error) ListWorkload(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_ListWorkloadClient, error) UpgradeProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_UpgradeProfileClient, error) InfoProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_InfoProfileClient, error) @@ -404,7 +666,7 @@ func NewProfileMgrClient(cc *grpc.ClientConn) ProfileMgrClient { } func (c *profileMgrClient) Profile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_ProfileClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[0], c.cc, "/profile.ProfileMgr/Profile", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[0], "/profile.ProfileMgr/Profile", opts...) if err != nil { return nil, err } @@ -436,7 +698,7 @@ func (x *profileMgrProfileClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) CheckInitProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_CheckInitProfileClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[1], c.cc, "/profile.ProfileMgr/CheckInitProfile", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[1], "/profile.ProfileMgr/CheckInitProfile", opts...) if err != nil { return nil, err } @@ -468,7 +730,7 @@ func (x *profileMgrCheckInitProfileClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) Analysis(ctx context.Context, in *AnalysisMessage, opts ...grpc.CallOption) (ProfileMgr_AnalysisClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[2], c.cc, "/profile.ProfileMgr/Analysis", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[2], "/profile.ProfileMgr/Analysis", opts...) if err != nil { return nil, err } @@ -499,22 +761,17 @@ func (x *profileMgrAnalysisClient) Recv() (*AckCheck, error) { return m, nil } -func (c *profileMgrClient) Tuning(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_TuningClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[3], c.cc, "/profile.ProfileMgr/Tuning", opts...) +func (c *profileMgrClient) Tuning(ctx context.Context, opts ...grpc.CallOption) (ProfileMgr_TuningClient, error) { + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[3], "/profile.ProfileMgr/Tuning", opts...) if err != nil { return nil, err } x := &profileMgrTuningClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } return x, nil } type ProfileMgr_TuningClient interface { + Send(*ProfileInfo) error Recv() (*AckCheck, error) grpc.ClientStream } @@ -523,6 +780,10 @@ type profileMgrTuningClient struct { grpc.ClientStream } +func (x *profileMgrTuningClient) Send(m *ProfileInfo) error { + return x.ClientStream.SendMsg(m) +} + func (x *profileMgrTuningClient) Recv() (*AckCheck, error) { m := new(AckCheck) if err := x.ClientStream.RecvMsg(m); err != nil { @@ -532,7 +793,7 @@ func (x *profileMgrTuningClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) ListWorkload(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_ListWorkloadClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[4], c.cc, "/profile.ProfileMgr/ListWorkload", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[4], "/profile.ProfileMgr/ListWorkload", opts...) if err != nil { return nil, err } @@ -564,7 +825,7 @@ func (x *profileMgrListWorkloadClient) Recv() (*ListMessage, error) { } func (c *profileMgrClient) UpgradeProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_UpgradeProfileClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[5], c.cc, "/profile.ProfileMgr/UpgradeProfile", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[5], "/profile.ProfileMgr/UpgradeProfile", opts...) if err != nil { return nil, err } @@ -596,7 +857,7 @@ func (x *profileMgrUpgradeProfileClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) InfoProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_InfoProfileClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[6], c.cc, "/profile.ProfileMgr/InfoProfile", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[6], "/profile.ProfileMgr/InfoProfile", opts...) if err != nil { return nil, err } @@ -628,7 +889,7 @@ func (x *profileMgrInfoProfileClient) Recv() (*ProfileInfo, error) { } func (c *profileMgrClient) CheckActiveProfile(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_CheckActiveProfileClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[7], c.cc, "/profile.ProfileMgr/CheckActiveProfile", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[7], "/profile.ProfileMgr/CheckActiveProfile", opts...) if err != nil { return nil, err } @@ -660,7 +921,7 @@ func (x *profileMgrCheckActiveProfileClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) ProfileRollback(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_ProfileRollbackClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[8], c.cc, "/profile.ProfileMgr/ProfileRollback", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[8], "/profile.ProfileMgr/ProfileRollback", opts...) if err != nil { return nil, err } @@ -692,7 +953,7 @@ func (x *profileMgrProfileRollbackClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) Charaterization(ctx context.Context, in *ProfileInfo, opts ...grpc.CallOption) (ProfileMgr_CharaterizationClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[9], c.cc, "/profile.ProfileMgr/Charaterization", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[9], "/profile.ProfileMgr/Charaterization", opts...) if err != nil { return nil, err } @@ -724,7 +985,7 @@ func (x *profileMgrCharaterizationClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) Collection(ctx context.Context, in *CollectFlag, opts ...grpc.CallOption) (ProfileMgr_CollectionClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[10], c.cc, "/profile.ProfileMgr/Collection", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[10], "/profile.ProfileMgr/Collection", opts...) if err != nil { return nil, err } @@ -756,7 +1017,7 @@ func (x *profileMgrCollectionClient) Recv() (*AckCheck, error) { } func (c *profileMgrClient) Training(ctx context.Context, in *TrainMessage, opts ...grpc.CallOption) (ProfileMgr_TrainingClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[11], c.cc, "/profile.ProfileMgr/Training", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[11], "/profile.ProfileMgr/Training", opts...) if err != nil { return nil, err } @@ -789,7 +1050,7 @@ func (x *profileMgrTrainingClient) Recv() (*AckCheck, error) { func (c *profileMgrClient) Define(ctx context.Context, in *DefineMessage, opts ...grpc.CallOption) (*Ack, error) { out := new(Ack) - err := grpc.Invoke(ctx, "/profile.ProfileMgr/Define", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/profile.ProfileMgr/Define", in, out, opts...) if err != nil { return nil, err } @@ -798,7 +1059,7 @@ func (c *profileMgrClient) Define(ctx context.Context, in *DefineMessage, opts . func (c *profileMgrClient) Delete(ctx context.Context, in *DefineMessage, opts ...grpc.CallOption) (*Ack, error) { out := new(Ack) - err := grpc.Invoke(ctx, "/profile.ProfileMgr/Delete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/profile.ProfileMgr/Delete", in, out, opts...) if err != nil { return nil, err } @@ -807,7 +1068,7 @@ func (c *profileMgrClient) Delete(ctx context.Context, in *DefineMessage, opts . func (c *profileMgrClient) Update(ctx context.Context, in *DefineMessage, opts ...grpc.CallOption) (*Ack, error) { out := new(Ack) - err := grpc.Invoke(ctx, "/profile.ProfileMgr/Update", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/profile.ProfileMgr/Update", in, out, opts...) if err != nil { return nil, err } @@ -815,7 +1076,7 @@ func (c *profileMgrClient) Update(ctx context.Context, in *DefineMessage, opts . } func (c *profileMgrClient) Schedule(ctx context.Context, in *ScheduleMessage, opts ...grpc.CallOption) (ProfileMgr_ScheduleClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ProfileMgr_serviceDesc.Streams[12], c.cc, "/profile.ProfileMgr/Schedule", opts...) + stream, err := c.cc.NewStream(ctx, &_ProfileMgr_serviceDesc.Streams[12], "/profile.ProfileMgr/Schedule", opts...) if err != nil { return nil, err } @@ -846,13 +1107,12 @@ func (x *profileMgrScheduleClient) Recv() (*AckCheck, error) { return m, nil } -// Server API for ProfileMgr service - +// ProfileMgrServer is the server API for ProfileMgr service. type ProfileMgrServer interface { Profile(*ProfileInfo, ProfileMgr_ProfileServer) error CheckInitProfile(*ProfileInfo, ProfileMgr_CheckInitProfileServer) error Analysis(*AnalysisMessage, ProfileMgr_AnalysisServer) error - Tuning(*ProfileInfo, ProfileMgr_TuningServer) error + Tuning(ProfileMgr_TuningServer) error ListWorkload(*ProfileInfo, ProfileMgr_ListWorkloadServer) error UpgradeProfile(*ProfileInfo, ProfileMgr_UpgradeProfileServer) error InfoProfile(*ProfileInfo, ProfileMgr_InfoProfileServer) error @@ -867,6 +1127,59 @@ type ProfileMgrServer interface { Schedule(*ScheduleMessage, ProfileMgr_ScheduleServer) error } +// UnimplementedProfileMgrServer can be embedded to have forward compatible implementations. +type UnimplementedProfileMgrServer struct { +} + +func (*UnimplementedProfileMgrServer) Profile(req *ProfileInfo, srv ProfileMgr_ProfileServer) error { + return status.Errorf(codes.Unimplemented, "method Profile not implemented") +} +func (*UnimplementedProfileMgrServer) CheckInitProfile(req *ProfileInfo, srv ProfileMgr_CheckInitProfileServer) error { + return status.Errorf(codes.Unimplemented, "method CheckInitProfile not implemented") +} +func (*UnimplementedProfileMgrServer) Analysis(req *AnalysisMessage, srv ProfileMgr_AnalysisServer) error { + return status.Errorf(codes.Unimplemented, "method Analysis not implemented") +} +func (*UnimplementedProfileMgrServer) Tuning(srv ProfileMgr_TuningServer) error { + return status.Errorf(codes.Unimplemented, "method Tuning not implemented") +} +func (*UnimplementedProfileMgrServer) ListWorkload(req *ProfileInfo, srv ProfileMgr_ListWorkloadServer) error { + return status.Errorf(codes.Unimplemented, "method ListWorkload not implemented") +} +func (*UnimplementedProfileMgrServer) UpgradeProfile(req *ProfileInfo, srv ProfileMgr_UpgradeProfileServer) error { + return status.Errorf(codes.Unimplemented, "method UpgradeProfile not implemented") +} +func (*UnimplementedProfileMgrServer) InfoProfile(req *ProfileInfo, srv ProfileMgr_InfoProfileServer) error { + return status.Errorf(codes.Unimplemented, "method InfoProfile not implemented") +} +func (*UnimplementedProfileMgrServer) CheckActiveProfile(req *ProfileInfo, srv ProfileMgr_CheckActiveProfileServer) error { + return status.Errorf(codes.Unimplemented, "method CheckActiveProfile not implemented") +} +func (*UnimplementedProfileMgrServer) ProfileRollback(req *ProfileInfo, srv ProfileMgr_ProfileRollbackServer) error { + return status.Errorf(codes.Unimplemented, "method ProfileRollback not implemented") +} +func (*UnimplementedProfileMgrServer) Charaterization(req *ProfileInfo, srv ProfileMgr_CharaterizationServer) error { + return status.Errorf(codes.Unimplemented, "method Charaterization not implemented") +} +func (*UnimplementedProfileMgrServer) Collection(req *CollectFlag, srv ProfileMgr_CollectionServer) error { + return status.Errorf(codes.Unimplemented, "method Collection not implemented") +} +func (*UnimplementedProfileMgrServer) Training(req *TrainMessage, srv ProfileMgr_TrainingServer) error { + return status.Errorf(codes.Unimplemented, "method Training not implemented") +} +func (*UnimplementedProfileMgrServer) Define(ctx context.Context, req *DefineMessage) (*Ack, error) { + return nil, status.Errorf(codes.Unimplemented, "method Define not implemented") +} +func (*UnimplementedProfileMgrServer) Delete(ctx context.Context, req *DefineMessage) (*Ack, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedProfileMgrServer) Update(ctx context.Context, req *DefineMessage) (*Ack, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (*UnimplementedProfileMgrServer) Schedule(req *ScheduleMessage, srv ProfileMgr_ScheduleServer) error { + return status.Errorf(codes.Unimplemented, "method Schedule not implemented") +} + func RegisterProfileMgrServer(s *grpc.Server, srv ProfileMgrServer) { s.RegisterService(&_ProfileMgr_serviceDesc, srv) } @@ -935,15 +1248,12 @@ func (x *profileMgrAnalysisServer) Send(m *AckCheck) error { } func _ProfileMgr_Tuning_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ProfileInfo) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProfileMgrServer).Tuning(m, &profileMgrTuningServer{stream}) + return srv.(ProfileMgrServer).Tuning(&profileMgrTuningServer{stream}) } type ProfileMgr_TuningServer interface { Send(*AckCheck) error + Recv() (*ProfileInfo, error) grpc.ServerStream } @@ -955,6 +1265,14 @@ func (x *profileMgrTuningServer) Send(m *AckCheck) error { return x.ServerStream.SendMsg(m) } +func (x *profileMgrTuningServer) Recv() (*ProfileInfo, error) { + m := new(ProfileInfo) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func _ProfileMgr_ListWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(ProfileInfo) if err := stream.RecvMsg(m); err != nil { @@ -1235,6 +1553,7 @@ var _ProfileMgr_serviceDesc = grpc.ServiceDesc{ StreamName: "Tuning", Handler: _ProfileMgr_Tuning_Handler, ServerStreams: true, + ClientStreams: true, }, { StreamName: "ListWorkload", @@ -1285,49 +1604,3 @@ var _ProfileMgr_serviceDesc = grpc.ServiceDesc{ Metadata: "profile.proto", } -func init() { proto.RegisterFile("profile.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 656 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x5b, 0x4b, 0x1b, 0x41, - 0x14, 0x36, 0x1b, 0x4d, 0xe2, 0x49, 0xbc, 0x74, 0xb0, 0xb2, 0x48, 0x5b, 0x64, 0x9f, 0xfa, 0x24, - 0xd2, 0xd2, 0xd2, 0x12, 0xb4, 0xa4, 0x91, 0x42, 0x8a, 0x5a, 0x49, 0x22, 0xf5, 0x75, 0xdc, 0x1d, - 0x37, 0xcb, 0x4e, 0x76, 0x96, 0xd9, 0x89, 0xc5, 0xfe, 0xbc, 0x42, 0xff, 0x57, 0x99, 0xdb, 0x66, - 0x22, 0x49, 0x61, 0xf3, 0xb6, 0xdf, 0x39, 0xe7, 0x3b, 0xf7, 0x33, 0x0b, 0x3b, 0x39, 0x67, 0x0f, - 0x09, 0x25, 0x27, 0x39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0xf6, 0xff, 0xd9, 0xbd, 0xaf, 0x28, 0xe9, 0xbe, 0xa1, 0x7e, - 0xb5, 0xef, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x76, 0xaf, 0x46, 0x7b, 0x07, 0x00, 0x00, -} diff --git a/api/profile/profile.proto b/api/profile/profile.proto index 2fed7aa565af1f81de91682ceab719b4f3ce5a33..8d9ea2bf1f6f0864b1a70d7e075fb5716027236f 100755 --- a/api/profile/profile.proto +++ b/api/profile/profile.proto @@ -20,7 +20,7 @@ service ProfileMgr { rpc Profile(ProfileInfo) returns (stream AckCheck) {} rpc CheckInitProfile(ProfileInfo) returns (stream AckCheck) {} rpc Analysis(AnalysisMessage) returns (stream AckCheck) {} - rpc Tuning(ProfileInfo) returns (stream AckCheck) {} + rpc Tuning(stream ProfileInfo) returns (stream AckCheck) {} rpc ListWorkload(ProfileInfo) returns (stream ListMessage) {} rpc UpgradeProfile(ProfileInfo) returns (stream AckCheck) {} rpc InfoProfile(ProfileInfo) returns (stream ProfileInfo) {} diff --git a/common/project/projet.go b/common/project/projet.go index 344ebde7fef3c516613956cadba082dfc5489b75..a1c297b62c829491f87994f3e3abd10943e8fc53 100644 --- a/common/project/projet.go +++ b/common/project/projet.go @@ -15,14 +15,10 @@ package project import ( "atune/common/log" - "atune/common/utils" "fmt" - "io/ioutil" "os/exec" "strconv" "strings" - - yaml "gopkg.in/yaml.v2" ) // Evaluate :store the evaluate object @@ -78,59 +74,30 @@ type YamlPrjObj struct { Info YamlObj `yaml:"info"` } -// LoadProject method load the tuning yaml -func LoadProject(path string) (*YamlPrjSvr, error) { - exist, err := utils.PathExist(path) - if err != nil { - return nil, err - } - - if !exist { - return nil, fmt.Errorf("the path %s doesn't exist", path) - } - - return newProject(path) -} - -func newProject(path string) (*YamlPrjSvr, error) { - info, err := ioutil.ReadFile(path) - if err != nil { - return nil, err - } - - prj := new(YamlPrjSvr) - if err := yaml.Unmarshal(info, prj); err != nil { - return nil, fmt.Errorf("parse %s failed : %s", path, err) - } - - return prj, nil -} - // BenchMark method call the benchmark script func (y *YamlPrjCli) BenchMark() (string, error) { benchStr := make([]string, 0) - cmd := exec.Command("sh", "-c", y.Benchmark) - benchOutByte, err := cmd.CombinedOutput() - + benchOutByte, err := ExecCommand(y.Benchmark) if err != nil { return "", fmt.Errorf("failed to run benchmark, err: %v", err) } + for _, evaluation := range y.Evaluations { newScript := strings.Replace(evaluation.Info.Get, "$out", string(benchOutByte), -1) - cmd := exec.Command("sh", "-c", newScript) - bout, err := cmd.Output() + bout, err := ExecCommand(newScript) if err != nil { - log.Error(err) + err = fmt.Errorf("faild to exec %s, err: %v", newScript, err) return strings.Join(benchStr, ","), err } - floatout, err := strconv.ParseFloat(strings.Replace(string(bout), "\n", "", -1), 64) + + floatOut, err := strconv.ParseFloat(strings.Replace(string(bout), "\n", "", -1), 64) if err != nil { - log.Error(err) + err = fmt.Errorf("faild to parse float, err: %v", err) return strings.Join(benchStr, ","), err } - out := strconv.FormatFloat((floatout * float64(evaluation.Info.Weight) / 100), 'f', -1, 64) + out := strconv.FormatFloat(floatOut*float64(evaluation.Info.Weight)/100, 'f', -1, 64) if evaluation.Info.Type == "negative" { out = "-" + out } @@ -208,3 +175,4 @@ func ExecCommand(script string) ([]byte, error) { out, err := cmd.CombinedOutput() return out, err } + diff --git a/common/tuning/optimizer.go b/common/tuning/optimizer.go index ba7a814b44e500121259797dfc059dba65e24c5b..177271b0b60c33dbec4d2fe6a650efdbe75a9257 100644 --- a/common/tuning/optimizer.go +++ b/common/tuning/optimizer.go @@ -25,6 +25,7 @@ import ( "io/ioutil" "os" "path" + "path/filepath" "strconv" "strings" "time" @@ -32,43 +33,39 @@ import ( // Optimizer : the type implement the bayes serch service type Optimizer struct { - Prj *project.YamlPrjSvr + Prj *project.YamlPrjSvr + Content []byte + Iter int + MaxIter int + OptimizerPutURL string + FinalEval string + MinEvalSum float64 + RespPutIns *models.RespPutBody + StartIterTime string } -//BenchMark : the benchmark data -type BenchMark struct { - Content []byte -} +// InitTuned method for init tuning +func (o *Optimizer) InitTuned(ch chan *PB.AckCheck) error { + clientIter, err := strconv.Atoi(string(o.Content)) + if err != nil { + return err + } -var optimizerPutURL string -var optimization *Optimizer -var finalEval string -var minEvalSum float64 -var respPutIns *models.RespPutBody -var iter int -var maxIter int -var startIterTime string + log.Infof("begin to dynamic optimizer search, client ask iterations:%d", clientIter) + ch <- &PB.AckCheck{Name: fmt.Sprintf("begin to dynamic optimizer search")} -// InitTuned method for init tuning -func (o *Optimizer) InitTuned(ch chan *PB.AckCheck, askIter int) error { //dynamic profle setting - maxIter = askIter - if maxIter > o.Prj.Maxiterations { - maxIter = o.Prj.Maxiterations + o.MaxIter = clientIter + if o.MaxIter > o.Prj.Maxiterations { + o.MaxIter = o.Prj.Maxiterations log.Infof("project:%s max iterations:%d", o.Prj.Project, o.Prj.Maxiterations) ch <- &PB.AckCheck{Name: fmt.Sprintf("server project %s max iterations %d\n", o.Prj.Project, o.Prj.Maxiterations)} } - exist, err := utils.PathExist(config.DefaultTempPath) - if err != nil { + if err := utils.CreateDir(config.DefaultTempPath, 0750); err != nil { return err } - if !exist { - if err = os.MkdirAll(config.DefaultTempPath, 0750); err != nil { - return err - } - } projectName := fmt.Sprintf("project %s\n", o.Prj.Project) err = utils.WriteFile(config.TuningFile, projectName, config.FilePerm, @@ -78,12 +75,10 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck, askIter int) error { return err } - initConfigure := "" + initConfigure := make([]string, 0) optimizerBody := new(models.OptimizerPostBody) - optimizerBody.MaxEval = maxIter - + optimizerBody.MaxEval = o.MaxIter optimizerBody.Knobs = make([]models.Knob, 0) - for _, item := range o.Prj.Object { knob := new(models.Knob) knob.Dtype = item.Info.Dtype @@ -100,11 +95,11 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck, askIter int) error { if err != nil { return fmt.Errorf("faild to exec %s, err: %v", item.Info.GetScript, err) } - initConfigure += strings.TrimSpace(knob.Name+"="+string(out)) + "," + initConfigure = append(initConfigure, strings.TrimSpace(knob.Name+"="+string(out))) } err = utils.WriteFile(path.Join(config.DefaultTempPath, - o.Prj.Project+config.TuningRestoreConfig), initConfigure, + o.Prj.Project+config.TuningRestoreConfig), strings.Join(initConfigure, ","), config.FilePerm, os.O_WRONLY|os.O_CREATE|os.O_TRUNC) if err != nil { log.Error(err) @@ -116,21 +111,17 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck, askIter int) error { return err } if respPostIns.Status != "OK" { - log.Errorf(respPostIns.Status) - return fmt.Errorf("create task failed: %s", respPostIns.Status) + err := fmt.Errorf("create task failed: %s", respPostIns.Status) + log.Errorf(err.Error()) + return err } - log.Infof("create task id is %s", respPostIns.TaskID) url := config.GetURL(config.OptimizerURI) - optimizerPutURL = fmt.Sprintf("%s/%s", url, respPostIns.TaskID) - - log.Infof("optimizer put url is: %s", optimizerPutURL) + o.OptimizerPutURL = fmt.Sprintf("%s/%s", url, respPostIns.TaskID) + log.Infof("optimizer put url is: %s", o.OptimizerPutURL) - optimization = o - iter = 0 - - benchmark := BenchMark{Content: nil} - if _, err := benchmark.DynamicTuned(ch); err != nil { + o.Content = nil + if err := o.DynamicTuned(ch); err != nil { return err } @@ -140,70 +131,72 @@ func (o *Optimizer) InitTuned(ch chan *PB.AckCheck, askIter int) error { /* DynamicTuned method using bayes algorithm to search the best performance parameters */ -func (bench *BenchMark) DynamicTuned(ch chan *PB.AckCheck) (bool, error) { +func (o *Optimizer) DynamicTuned(ch chan *PB.AckCheck) error { var evalValue string var err error - if bench.Content != nil { - evalValue, err = bench.evalParsing(ch) + if o.Content != nil { + evalValue, err = o.evalParsing(ch) if err != nil { - return true, err + return err } } - os.Setenv("ITERATION", strconv.Itoa(iter)) + os.Setenv("ITERATION", strconv.Itoa(o.Iter)) optPutBody := new(models.OptimizerPutBody) - optPutBody.Iterations = iter + optPutBody.Iterations = o.Iter optPutBody.Value = evalValue - respPutIns, err = optPutBody.Put(optimizerPutURL) + o.RespPutIns, err = optPutBody.Put(o.OptimizerPutURL) if err != nil { log.Errorf("get setting parameter error: %v", err) - return true, err + return err } - log.Infof("setting params is: %s", respPutIns.Param) - if err := optimization.Prj.RunSet(respPutIns.Param); err != nil { + log.Infof("setting params is: %s", o.RespPutIns.Param) + if err := o.Prj.RunSet(o.RespPutIns.Param); err != nil { log.Error(err) - return true, err + return err } - log.Info("set the parameter success") - if err := optimization.Prj.RestartProject(); err != nil { + + if err := o.Prj.RestartProject(); err != nil { log.Error(err) - return true, err + return err } log.Info("restart project success") - startIterTime = time.Now().Format(config.DefaultTimeFormat) + o.StartIterTime = time.Now().Format(config.DefaultTimeFormat) - if iter == maxIter { - finalEval := strings.Replace(finalEval, "=-", "=", -1) + if o.Iter == o.MaxIter { + finalEval := strings.Replace(o.FinalEval, "=-", "=", -1) optimizationTerm := fmt.Sprintf("\n The final optimization result is: %s\n"+ - " The final evaluation value is: %s", respPutIns.Param, finalEval) + " The final evaluation value is: %s", o.RespPutIns.Param, finalEval) log.Info(optimizationTerm) - ch <- &PB.AckCheck{Name: optimizationTerm, Status: utils.SUCCESS} + ch <- &PB.AckCheck{Name: optimizationTerm} - if err = deleteTask(optimizerPutURL); err != nil { + if err = deleteTask(o.OptimizerPutURL); err != nil { log.Error(err) } - return true, nil } - iter++ - return false, nil + o.Iter++ + ch <- &PB.AckCheck{Status: utils.SUCCESS} + + return nil } //restore tuning config -func (o *Optimizer) RestoreConfigTuned() error { +func (o *Optimizer) RestoreConfigTuned(ch chan *PB.AckCheck) error { tuningRestoreConf := path.Join(config.DefaultTempPath, o.Prj.Project+config.TuningRestoreConfig) exist, err := utils.PathExist(tuningRestoreConf) if err != nil { return err } if !exist { - log.Errorf("%s project has not been executed the dynamic optimizer search", o.Prj.Project) - return fmt.Errorf("%s project has not been executed the dynamic optimizer search", - o.Prj.Project) + err := fmt.Errorf("%s project has not been executed "+ + "the dynamic optimizer search", o.Prj.Project) + log.Errorf(err.Error()) + return err } content, err := ioutil.ReadFile(tuningRestoreConf) @@ -218,27 +211,25 @@ func (o *Optimizer) RestoreConfigTuned() error { return err } - log.Infof("restore %s project params success", o.Prj.Project) + result := fmt.Sprintf("restore %s project params success", o.Prj.Project) + ch <- &PB.AckCheck{Name: result, Status: utils.SUCCESS} + log.Infof(result) return nil } -func (bench *BenchMark) evalParsing(ch chan *PB.AckCheck) (string, error) { - eval := string(bench.Content) +func (o *Optimizer) evalParsing(ch chan *PB.AckCheck) (string, error) { + eval := string(o.Content) positiveEval := strings.Replace(eval, "=-", "=", -1) optimizationTerm := fmt.Sprintf("The %dth optimization result is: %s\n"+ - " The %dth evaluation value is: %s", iter, respPutIns.Param, iter, positiveEval) + " The %dth evaluation value is: %s", o.Iter, o.RespPutIns.Param, o.Iter, positiveEval) ch <- &PB.AckCheck{Name: optimizationTerm} log.Info(optimizationTerm) endIterTime := time.Now().Format(config.DefaultTimeFormat) iterInfo := make([]string, 0) - iterInfo = append(iterInfo, strconv.Itoa(iter)) - iterInfo = append(iterInfo, startIterTime) - iterInfo = append(iterInfo, endIterTime) - iterInfo = append(iterInfo, positiveEval) - iterInfo = append(iterInfo, respPutIns.Param) + iterInfo = append(iterInfo, strconv.Itoa(o.Iter), o.StartIterTime, endIterTime, + positiveEval, o.RespPutIns.Param) output := strings.Join(iterInfo, "|") - err := utils.WriteFile(config.TuningFile, output+"\n", config.FilePerm, os.O_APPEND|os.O_WRONLY) if err != nil { @@ -264,9 +255,9 @@ func (bench *BenchMark) evalParsing(ch chan *PB.AckCheck) (string, error) { evalValue = append(evalValue, kvs[1]) } - if iter == 1 || evalSum < minEvalSum { - minEvalSum = evalSum - finalEval = eval + if o.Iter == 1 || evalSum < o.MinEvalSum { + o.MinEvalSum = evalSum + o.FinalEval = eval } return strings.Join(evalValue, ","), nil } @@ -280,3 +271,34 @@ func deleteTask(url string) error { defer resp.Body.Close() return nil } + +//check server prj +func CheckServerPrj(data string, optimizer *Optimizer) error { + var prjs []*project.YamlPrjSvr + err := filepath.Walk(config.DefaultTuningPath, func(path string, info os.FileInfo, err error) error { + if !info.IsDir() { + prj := new(project.YamlPrjSvr) + if err := utils.ParseFile(path, "yaml", &prj); err != nil { + return fmt.Errorf("load %s faild, err: %v", path, err) + } + log.Infof("project:%s load %s success", prj.Project, path) + prjs = append(prjs, prj) + } + return nil + }) + + if err != nil { + return err + } + + for _, prj := range prjs { + if data == prj.Project { + log.Infof("find Project:%s", prj.Project) + optimizer.Prj = prj + return nil + } + } + + return fmt.Errorf("project:%s not found", data) +} + diff --git a/common/utils/utils.go b/common/utils/utils.go index d00c0dee234063d1900d2c4c3ffed736ffb2f5f4..b86790ee95ac5f797ab0e2f53f57af742babc7c8 100644 --- a/common/utils/utils.go +++ b/common/utils/utils.go @@ -16,8 +16,11 @@ package utils import ( PB "atune/api/profile" "bufio" + "encoding/xml" "fmt" + "gopkg.in/yaml.v2" "io" + "io/ioutil" "math/rand" "net" "os" @@ -306,3 +309,49 @@ func WriteFile(filename string, data string, perm os.FileMode, wrapper int) erro return err } +//parse yaml or xml file +func ParseFile(filePath string, fileFormat string, out interface{}) error { + exist, err := PathExist(filePath) + if err != nil { + return err + } + + if !exist { + return fmt.Errorf("%s is not exist", filePath) + } + + data, err := ioutil.ReadFile(filePath) + if err != nil { + return err + } + + switch fileFormat { + case "yaml": + if err := yaml.Unmarshal(data, out); err != nil { + return err + } + case "xml": + if err := xml.Unmarshal(data, out); err != nil { + return err + } + default: + return fmt.Errorf("this conversion mode of %s is not supported", fileFormat) + } + + return nil +} + +//create dir if the dir is not exist +func CreateDir(dir string, perm os.FileMode) error { + exist, err := PathExist(dir) + if err != nil { + return err + } + if !exist { + if err = os.MkdirAll(dir, perm); err != nil { + return err + } + } + return nil +} + diff --git a/modules/client/profile/profile_tuning.go b/modules/client/profile/profile_tuning.go index 20402b51bb3139142856b763a6a373dd169cde34..0040f2950ef69746ee85ec1b1cdf9bcc39f461fe 100644 --- a/modules/client/profile/profile_tuning.go +++ b/modules/client/profile/profile_tuning.go @@ -21,13 +21,11 @@ import ( "atune/common/utils" "fmt" "io" - "io/ioutil" "strconv" "strings" "github.com/urfave/cli" CTX "golang.org/x/net/context" - yaml "gopkg.in/yaml.v2" ) var profileTunningCommand = cli.Command{ @@ -82,99 +80,92 @@ func profileTunning(ctx *cli.Context) error { } yamlPath := ctx.Args().Get(0) - exist, err := utils.PathExist(yamlPath) - if err != nil { - return err - } - - if !exist { - return fmt.Errorf("project file %s is not exist", yamlPath) - } - if !strings.HasSuffix(yamlPath, ".yaml") && !strings.HasSuffix(yamlPath, ".yml") { - return fmt.Errorf("project file is not ends with yaml or yml") + return fmt.Errorf("error: %s is not ends with yaml or yml", yamlPath) } - data, err := ioutil.ReadFile(yamlPath) - if err != nil { - return err - } prj := project.YamlPrjCli{} - if err := yaml.Unmarshal(data, &prj); err != nil { + if err := utils.ParseFile(yamlPath, "yaml", &prj); err != nil { return err } - - if len(prj.Project) < 1 || len(prj.Project) > 128 { - return fmt.Errorf("project name must be no less than 1 and no greater than 128 in yaml or yml") - } - - if len(prj.Benchmark) < 1 { - return fmt.Errorf("benchmark must be specified in yaml or yml") - } - - if len(prj.Evaluations) > 10 { - return fmt.Errorf("evaluations must be no greater than 10 in project %s", prj.Project) - } - - _, err = runTuningRPC(ctx, &PB.ProfileInfo{Name: prj.Project, Content: []byte(strconv.Itoa(prj.Iterations))}) - if err != nil { + if err := checkTuningPrjYaml(prj); err != nil { return err } - iter := 0 - for iter < prj.Iterations { - benchmarkByte, err := prj.BenchMark() - if err != nil { - return err + err := runTuningRPC(ctx, func(stream PB.ProfileMgr_TuningClient) error { + content := &PB.ProfileInfo{Name: prj.Project, Content: []byte(strconv.Itoa(prj.Iterations))} + if err := stream.Send(content); err != nil { + return fmt.Errorf("client sends failure, error: %v", err) } - var status string - status, err = runTuningRPC(ctx, &PB.ProfileInfo{Content: []byte(benchmarkByte)}) - if err != nil { - return err + iter := 0 + for { + reply, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + if reply.Status != utils.SUCCESS { + utils.Print(reply) + continue + } + if iter >= prj.Iterations { + break + } + + benchmarkByte, err := prj.BenchMark() + if err != nil { + return err + } + if err := stream.Send(&PB.ProfileInfo{Content: []byte(benchmarkByte)}); err != nil { + return fmt.Errorf("client sends failure, error: %v", err) + } + iter++ } + return nil + }) - if status == utils.SUCCESS { - break - } - - iter++ + if err != nil { + return err } return nil } -func runTuningRPC(ctx *cli.Context, info *PB.ProfileInfo) (string, error) { - c, err := client.NewClientFromContext(ctx) - if err != nil { - return "", err - } - - defer c.Close() - svc := PB.NewProfileMgrClient(c.Connection()) - stream, err := svc.Tuning(CTX.Background(), info) - if err != nil { - return "", err +func checkRestoreConfig(ctx *cli.Context) error { + if err := checkTuningCtx(ctx); err != nil { + return err } - for { - reply, err := stream.Recv() - - if err == io.EOF { - break + err := runTuningRPC(ctx, func(stream PB.ProfileMgr_TuningClient) error { + content := &PB.ProfileInfo{Name: ctx.String("project")} + if err := stream.Send(content); err != nil { + return fmt.Errorf("client sends failure, error: %v", err) } - if err != nil { - return "", err + for { + reply, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + utils.Print(reply) + + if reply.Status == utils.SUCCESS { + break + } } + return nil + }) - utils.Print(reply) - - if reply.Status == utils.SUCCESS { - return reply.Status, nil - } + if err != nil { + return err } - return "", nil + return nil } func checkTuningCtx(ctx *cli.Context) error { @@ -190,15 +181,49 @@ func checkTuningCtx(ctx *cli.Context) error { return nil } -func checkRestoreConfig(ctx *cli.Context) error { - err := checkTuningCtx(ctx) +func checkTuningPrjYaml(prj project.YamlPrjCli) error { + if len(prj.Project) < 1 || len(prj.Project) > 128 { + return fmt.Errorf("error: project name must be no less than 1 " + + "and no greater than 128 in yaml or yml") + } + + if len(prj.Benchmark) < 1 { + return fmt.Errorf("error: benchmark must be specified in yaml or yml") + } + + if len(prj.Evaluations) > 10 { + return fmt.Errorf("error: evaluations must be no greater than 10 "+ + "in project %s", prj.Project) + } + + if prj.Iterations < 11 { + return fmt.Errorf("error: iterations must be greater than 10 "+ + "in project %s", prj.Project) + } + return nil +} + +func runTuningRPC(ctx *cli.Context, sendTask func(stream PB.ProfileMgr_TuningClient) error) error { + c, err := client.NewClientFromContext(ctx) if err != nil { return err } - _, err = runTuningRPC(ctx, &PB.ProfileInfo{Name: ctx.String("project")}) + + defer c.Close() + svc := PB.NewProfileMgrClient(c.Connection()) + stream, err := svc.Tuning(CTX.Background()) if err != nil { return err } + + if err := sendTask(stream); err != nil { + return err + } + + if err := stream.CloseSend(); err != nil { + return fmt.Errorf("failed to close stream, error: %v", err) + } + return nil } diff --git a/modules/server/profile/profile.go b/modules/server/profile/profile.go index 332ec4cc7d1b4da2297fa8175e3e7fc6bfbda442..1900163502a7a28ba5bebc36d15eb164d6fa8829 100644 --- a/modules/server/profile/profile.go +++ b/modules/server/profile/profile.go @@ -21,7 +21,6 @@ import ( "atune/common/log" "atune/common/models" "atune/common/profile" - "atune/common/project" "atune/common/registry" "atune/common/schedule" SVC "atune/common/service" @@ -32,11 +31,11 @@ import ( "context" "encoding/json" "fmt" + "io" "io/ioutil" "os" "os/exec" "path" - "path/filepath" "regexp" "sort" "strconv" @@ -450,92 +449,59 @@ func (s *ProfileServer) Analysis(message *PB.AnalysisMessage, stream PB.ProfileM } // Tuning method calling the bayes search method to tuned parameters -func (s *ProfileServer) Tuning(profileInfo *PB.ProfileInfo, stream PB.ProfileMgr_TuningServer) error { - //dynamic profle setting - data := profileInfo.GetName() - content := profileInfo.GetContent() +func (s *ProfileServer) Tuning(stream PB.ProfileMgr_TuningServer) error { + if !s.TryLock() { + return fmt.Errorf("dynamic optimizer search or analysis has been in running") + } + defer s.Unlock() ch := make(chan *PB.AckCheck) + defer close(ch) go func() { for value := range ch { _ = stream.Send(value) } }() - // data == "" means in tuning process - if data == "" { - benchmark := tuning.BenchMark{Content: content} - isEnd, err := benchmark.DynamicTuned(ch) - if isEnd { - s.Unlock() + var optimizer = tuning.Optimizer{} + for { + reply, err := stream.Recv() + if err == io.EOF { + break } if err != nil { return err } - return nil - } - prjfound := false - var prjs []*project.YamlPrjSvr - err := filepath.Walk(config.DefaultTuningPath, func(path string, info os.FileInfo, err error) error { - if !info.IsDir() { - prj, ret := project.LoadProject(path) - if ret != nil { - log.Errorf("load %s faild(%s)", path, ret) - return ret + data := reply.Name + content := reply.Content + + // data == "" means in tuning process + if data == "" { + optimizer.Content = content + err := optimizer.DynamicTuned(ch) + if err != nil { + return err } - log.Infof("project:%s load %s success", prj.Project, path) - prjs = append(prjs, prj) + continue } - return nil - }) - if err != nil { - return err - } - - var prj *project.YamlPrjSvr - for _, prj = range prjs { - if data == prj.Project { - log.Infof("found Project:%v", prj.Project) - prjfound = true - break + if err := tuning.CheckServerPrj(data, &optimizer); err != nil { + return err } - } - - if !prjfound { - log.Errorf("project:%s not found", data) - return fmt.Errorf("project:%s not found", data) - } - //content == nil means in restore config - if content == nil { - if !s.TryLock() { - return fmt.Errorf("dynamic optimizer search or analysis has been in running") + //content == nil means in restore config + if content == nil { + if err := optimizer.RestoreConfigTuned(ch); err != nil { + return err + } + continue } - optimizer := tuning.Optimizer{Prj: prj} - err := optimizer.RestoreConfigTuned() - s.Unlock() - if err != nil { + + optimizer.Content = content + if err = optimizer.InitTuned(ch); err != nil { return err } - return nil - } - - log.Info("begin to dynamic optimizer search") - _ = stream.Send(&PB.AckCheck{Name: fmt.Sprintf("begin to dynamic optimizer search")}) - - if !s.TryLock() { - return fmt.Errorf("dynamic optimizer search or analysis has been in running") - } - - optimizer := tuning.Optimizer{Prj: prj} - iter, _ := strconv.Atoi(string(content)) - log.Infof("client ask iterations:%d", iter) - err = optimizer.InitTuned(ch, iter) - if err != nil { - s.Unlock() - return err } return nil