diff --git a/go.mod b/go.mod index 29b4975..4b4d61d 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 replace ( github.com/vhive-serverless/vSwarm-proto/proto/aes => ./proto/aes github.com/vhive-serverless/vSwarm-proto/proto/auth => ./proto/auth + github.com/vhive-serverless/vSwarm-proto/proto/bert => ./proto/bert github.com/vhive-serverless/vSwarm-proto/proto/fibonacci => ./proto/fibonacci github.com/vhive-serverless/vSwarm-proto/proto/helloworld => ./proto/helloworld github.com/vhive-serverless/vSwarm-proto/proto/hipstershop => ./proto/hipstershop diff --git a/grpcclient/bert_client.go b/grpcclient/bert_client.go new file mode 100644 index 0000000..dfa4d67 --- /dev/null +++ b/grpcclient/bert_client.go @@ -0,0 +1,71 @@ +// MIT License + +// Copyright (c) 2022 EASE lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +package grpcclient + +import ( + "context" + "fmt" + + log "github.com/sirupsen/logrus" + pb "github.com/vhive-serverless/vSwarm-proto/proto/bert" +) + +type BertGenerator struct { + GeneratorBase +} + +func (g *BertGenerator) Next() Input { + var pkt = g.defaultInput + switch g.GeneratorBase.generator { + case Unique: + pkt.Value = "A unique message" + case Linear: + pkt.Value = "A linear message" + case Random: + pkt.Value = "random" + } + return pkt +} + +func (c *BertClient) GetGenerator() Generator { + return new(BertGenerator) +} + +type BertClient struct { + ClientBase + client pb.GreeterClient +} + +func (c *BertClient) Init(ctx context.Context, ip, port string) { + c.Connect(ctx, ip, port) + c.client = pb.NewGreeterClient(c.conn) +} + +func (c *BertClient) Request(ctx context.Context, req Input) string { + var bertMessage = req.Value + r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: bertMessage}) + if err != nil { + log.Fatalf("could not greet: %v", err) + } + msg := fmt.Sprintf("inference time in ns: max: %d; min: %d; mean: %d", r.GetMaxLatency(),r.GetMinLatency(),r.GetMeanLatency()) + return msg +} diff --git a/grpcclient/getclient.go b/grpcclient/getclient.go index 66056aa..30b0584 100644 --- a/grpcclient/getclient.go +++ b/grpcclient/getclient.go @@ -1,3 +1,24 @@ +// MIT License + +// Copyright (c) 2022 EASE lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. package grpcclient import ( @@ -10,6 +31,8 @@ func FindServiceName(functionName string) string { return "aes" case "auth-go", "auth-python", "auth-nodejs": return "auth" + case "bert-python": + return "bert" case "fibonacci-go", "fibonacci-python", "fibonacci-nodejs", "fibonacci-cpp": return "fibonacci" default: @@ -30,6 +53,9 @@ func FindGrpcClient(service_name string) GrpcClient { case "auth": log.Debug("Found Auth client") return new(AuthClient) + case "bert": + log.Debug("Found Bert client") + return new(BertClient) case "fibonacci": log.Debug("Found Fibonacci client") return new(FibonacciClient) diff --git a/proto/bert/bert.pb.go b/proto/bert/bert.pb.go new file mode 100644 index 0000000..64cb4e2 --- /dev/null +++ b/proto/bert/bert.pb.go @@ -0,0 +1,163 @@ +// MIT License + +// Copyright (c) 2022 EASE lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: proto/bert/bert.proto + +package bert + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// The request message containing the user's name. +type HelloRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelloRequest) Reset() { *m = HelloRequest{} } +func (m *HelloRequest) String() string { return proto.CompactTextString(m) } +func (*HelloRequest) ProtoMessage() {} +func (*HelloRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_93e3207e7ccc7498, []int{0} +} + +func (m *HelloRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloRequest.Unmarshal(m, b) +} +func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic) +} +func (m *HelloRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloRequest.Merge(m, src) +} +func (m *HelloRequest) XXX_Size() int { + return xxx_messageInfo_HelloRequest.Size(m) +} +func (m *HelloRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HelloRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HelloRequest proto.InternalMessageInfo + +func (m *HelloRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The response message containing the greetings +type HelloReply struct { + MinLatency int64 `protobuf:"varint,1,opt,name=min_latency,json=minLatency,proto3" json:"min_latency,omitempty"` + MaxLatency int64 `protobuf:"varint,2,opt,name=max_latency,json=maxLatency,proto3" json:"max_latency,omitempty"` + MeanLatency int64 `protobuf:"varint,3,opt,name=mean_latency,json=meanLatency,proto3" json:"mean_latency,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelloReply) Reset() { *m = HelloReply{} } +func (m *HelloReply) String() string { return proto.CompactTextString(m) } +func (*HelloReply) ProtoMessage() {} +func (*HelloReply) Descriptor() ([]byte, []int) { + return fileDescriptor_93e3207e7ccc7498, []int{1} +} + +func (m *HelloReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloReply.Unmarshal(m, b) +} +func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic) +} +func (m *HelloReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloReply.Merge(m, src) +} +func (m *HelloReply) XXX_Size() int { + return xxx_messageInfo_HelloReply.Size(m) +} +func (m *HelloReply) XXX_DiscardUnknown() { + xxx_messageInfo_HelloReply.DiscardUnknown(m) +} + +var xxx_messageInfo_HelloReply proto.InternalMessageInfo + +func (m *HelloReply) GetMinLatency() int64 { + if m != nil { + return m.MinLatency + } + return 0 +} + +func (m *HelloReply) GetMaxLatency() int64 { + if m != nil { + return m.MaxLatency + } + return 0 +} + +func (m *HelloReply) GetMeanLatency() int64 { + if m != nil { + return m.MeanLatency + } + return 0 +} + +func init() { + proto.RegisterType((*HelloRequest)(nil), "bert.HelloRequest") + proto.RegisterType((*HelloReply)(nil), "bert.HelloReply") +} + +func init() { proto.RegisterFile("proto/bert/bert.proto", fileDescriptor_93e3207e7ccc7498) } + +var fileDescriptor_93e3207e7ccc7498 = []byte{ + // 224 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0xd0, 0xbb, 0x4f, 0xc3, 0x30, + 0x10, 0x06, 0x70, 0x4a, 0x2b, 0x1e, 0xd7, 0x0e, 0xc8, 0x12, 0x12, 0x62, 0x01, 0x3c, 0xb1, 0x34, + 0x91, 0x5a, 0x31, 0xb2, 0xb0, 0xc0, 0xc0, 0x94, 0x6e, 0x2c, 0xc8, 0x89, 0x4e, 0xc4, 0x92, 0x1f, + 0x89, 0xed, 0x98, 0xf8, 0xbf, 0x47, 0xb9, 0x04, 0x42, 0x17, 0xeb, 0xf3, 0xa7, 0x9f, 0xac, 0xf3, + 0xc1, 0x75, 0xe3, 0x6c, 0xb0, 0x79, 0x89, 0x2e, 0xd0, 0x91, 0xd1, 0x9d, 0xad, 0x86, 0xcc, 0x39, + 0x6c, 0xde, 0x50, 0x29, 0x5b, 0x60, 0xdb, 0xa1, 0x0f, 0x8c, 0xc1, 0xca, 0x08, 0x8d, 0x37, 0x8b, + 0xfb, 0xc5, 0xe3, 0x65, 0x41, 0x99, 0xb7, 0x00, 0x93, 0x69, 0x54, 0x62, 0x77, 0xb0, 0xd6, 0xd2, + 0x7c, 0x2a, 0x11, 0xd0, 0x54, 0x89, 0xe0, 0xb2, 0x00, 0x2d, 0xcd, 0xfb, 0xd8, 0x10, 0x10, 0xfd, + 0x1f, 0x38, 0x9d, 0x80, 0xe8, 0x7f, 0xc1, 0x03, 0x6c, 0x34, 0x8a, 0xf9, 0x89, 0x25, 0x89, 0xf5, + 0xd0, 0x4d, 0x64, 0xf7, 0x0c, 0xe7, 0xaf, 0x0e, 0x31, 0xa0, 0x63, 0x3b, 0xb8, 0x38, 0x88, 0x44, + 0x03, 0x30, 0x96, 0xd1, 0x07, 0xfe, 0x4f, 0x7c, 0x7b, 0x75, 0xd4, 0x35, 0x2a, 0xf1, 0x93, 0x97, + 0xa7, 0x8f, 0xfd, 0x97, 0x0c, 0x75, 0x57, 0x66, 0x95, 0xd5, 0x79, 0xac, 0x65, 0xc4, 0xad, 0x47, + 0x17, 0xd1, 0x29, 0xf4, 0x3e, 0x8f, 0x87, 0x6f, 0xe1, 0xf4, 0x76, 0xdc, 0xcb, 0xbc, 0x9d, 0xf2, + 0x8c, 0xf2, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xf8, 0xdd, 0x99, 0x32, 0x01, 0x00, 0x00, +} diff --git a/proto/bert/bert.proto b/proto/bert/bert.proto new file mode 100644 index 0000000..88aad4a --- /dev/null +++ b/proto/bert/bert.proto @@ -0,0 +1,45 @@ +// MIT License + +// Copyright (c) 2022 EASE lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +syntax = "proto3"; + +option go_package = "github.com/vhive-serverless/vSwarm-proto/proto/bert"; + +package bert; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings +message HelloReply { + int64 min_latency = 1; + int64 max_latency = 2; + int64 mean_latency = 3; +} diff --git a/proto/bert/bert_grpc.pb.go b/proto/bert/bert_grpc.pb.go new file mode 100644 index 0000000..e26cd0f --- /dev/null +++ b/proto/bert/bert_grpc.pb.go @@ -0,0 +1,124 @@ +// MIT License + +// Copyright (c) 2022 EASE lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package bert + +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 + +// GreeterClient is the client API for Greeter 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 GreeterClient interface { + // Sends a greeting + SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) +} + +type greeterClient struct { + cc grpc.ClientConnInterface +} + +func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient { + return &greeterClient{cc} +} + +func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { + out := new(HelloReply) + err := c.cc.Invoke(ctx, "/bert.Greeter/SayHello", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GreeterServer is the server API for Greeter service. +// All implementations must embed UnimplementedGreeterServer +// for forward compatibility +type GreeterServer interface { + // Sends a greeting + SayHello(context.Context, *HelloRequest) (*HelloReply, error) + mustEmbedUnimplementedGreeterServer() +} + +// UnimplementedGreeterServer must be embedded to have forward compatible implementations. +type UnimplementedGreeterServer struct { +} + +func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") +} +func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {} + +// UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GreeterServer will +// result in compilation errors. +type UnsafeGreeterServer interface { + mustEmbedUnimplementedGreeterServer() +} + +func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) { + s.RegisterService(&Greeter_ServiceDesc, srv) +} + +func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HelloRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GreeterServer).SayHello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bert.Greeter/SayHello", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Greeter_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bert.Greeter", + HandlerType: (*GreeterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _Greeter_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/bert/bert.proto", +} diff --git a/proto/bert/bert_pb2.py b/proto/bert/bert_pb2.py new file mode 100644 index 0000000..d0c51c5 --- /dev/null +++ b/proto/bert/bert_pb2.py @@ -0,0 +1,67 @@ +""" +MIT License +Copyright (c) 2022 EASE lab +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/bert/bert.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15proto/bert/bert.proto\x12\x04\x62\x65rt\"\x1c\n\x0cHelloRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"L\n\nHelloReply\x12\x13\n\x0bmin_latency\x18\x01 \x01(\x03\x12\x13\n\x0bmax_latency\x18\x02 \x01(\x03\x12\x14\n\x0cmean_latency\x18\x03 \x01(\x03\x32=\n\x07Greeter\x12\x32\n\x08SayHello\x12\x12.bert.HelloRequest\x1a\x10.bert.HelloReply\"\x00\x42\x35Z3github.com/vhive-serverless/vSwarm-proto/proto/bertb\x06proto3') + + + +_HELLOREQUEST = DESCRIPTOR.message_types_by_name['HelloRequest'] +_HELLOREPLY = DESCRIPTOR.message_types_by_name['HelloReply'] +HelloRequest = _reflection.GeneratedProtocolMessageType('HelloRequest', (_message.Message,), { + 'DESCRIPTOR' : _HELLOREQUEST, + '__module__' : 'proto.bert.bert_pb2' + # @@protoc_insertion_point(class_scope:bert.HelloRequest) + }) +_sym_db.RegisterMessage(HelloRequest) + +HelloReply = _reflection.GeneratedProtocolMessageType('HelloReply', (_message.Message,), { + 'DESCRIPTOR' : _HELLOREPLY, + '__module__' : 'proto.bert.bert_pb2' + # @@protoc_insertion_point(class_scope:bert.HelloReply) + }) +_sym_db.RegisterMessage(HelloReply) + +_GREETER = DESCRIPTOR.services_by_name['Greeter'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'Z3github.com/vhive-serverless/vSwarm-proto/proto/bert' + _HELLOREQUEST._serialized_start=31 + _HELLOREQUEST._serialized_end=59 + _HELLOREPLY._serialized_start=61 + _HELLOREPLY._serialized_end=137 + _GREETER._serialized_start=139 + _GREETER._serialized_end=200 +# @@protoc_insertion_point(module_scope) diff --git a/proto/bert/bert_pb2_grpc.py b/proto/bert/bert_pb2_grpc.py new file mode 100644 index 0000000..71e44ee --- /dev/null +++ b/proto/bert/bert_pb2_grpc.py @@ -0,0 +1,89 @@ +""" +MIT License +Copyright (c) 2022 EASE lab +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from proto.bert import bert_pb2 as proto_dot_bert_dot_bert__pb2 + + +class GreeterStub(object): + """The greeting service definition. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SayHello = channel.unary_unary( + '/bert.Greeter/SayHello', + request_serializer=proto_dot_bert_dot_bert__pb2.HelloRequest.SerializeToString, + response_deserializer=proto_dot_bert_dot_bert__pb2.HelloReply.FromString, + ) + + +class GreeterServicer(object): + """The greeting service definition. + """ + + def SayHello(self, request, context): + """Sends a greeting + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GreeterServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SayHello': grpc.unary_unary_rpc_method_handler( + servicer.SayHello, + request_deserializer=proto_dot_bert_dot_bert__pb2.HelloRequest.FromString, + response_serializer=proto_dot_bert_dot_bert__pb2.HelloReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'bert.Greeter', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class Greeter(object): + """The greeting service definition. + """ + + @staticmethod + def SayHello(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bert.Greeter/SayHello', + proto_dot_bert_dot_bert__pb2.HelloRequest.SerializeToString, + proto_dot_bert_dot_bert__pb2.HelloReply.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata)