diff --git a/go.mod b/go.mod index 29b4975..c7c942f 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ replace ( github.com/vhive-serverless/vSwarm-proto/proto/helloworld => ./proto/helloworld github.com/vhive-serverless/vSwarm-proto/proto/hipstershop => ./proto/hipstershop github.com/vhive-serverless/vSwarm-proto/proto/hotel_reserv => ./proto/hotel_reserv + github.com/vhive-serverless/vSwarm-proto/proto/image_classification => ./proto/image_classification ) require ( diff --git a/grpcclient/getclient.go b/grpcclient/getclient.go index 66056aa..1043203 100644 --- a/grpcclient/getclient.go +++ b/grpcclient/getclient.go @@ -12,6 +12,8 @@ func FindServiceName(functionName string) string { return "auth" case "fibonacci-go", "fibonacci-python", "fibonacci-nodejs", "fibonacci-cpp": return "fibonacci" + case "image_classification-python": + return "image_classification" default: return functionName } @@ -33,6 +35,9 @@ func FindGrpcClient(service_name string) GrpcClient { case "fibonacci": log.Debug("Found Fibonacci client") return new(FibonacciClient) + case "image_classification": + log.Debug("Found Image Classification client") + return new(ImgClassificationClient) // Hotel reservation --- case "Geo", "geo": diff --git a/grpcclient/image_classification_client.go b/grpcclient/image_classification_client.go new file mode 100644 index 0000000..f19c4a3 --- /dev/null +++ b/grpcclient/image_classification_client.go @@ -0,0 +1,71 @@ +// MIT License + +// Copyright (c) 2023 Hyscale 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" + + log "github.com/sirupsen/logrus" + pb "github.com/vhive-serverless/vSwarm-proto/proto/image_classification" +) + +type ImgClassificationGenerator struct { + GeneratorBase +} + +func (g *ImgClassificationGenerator) 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 = "A random message" + } + return pkt +} + +func (c *ImgClassificationClient) GetGenerator() Generator { + return new(ImgClassificationGenerator) +} + +type ImgClassificationClient struct { + ClientBase + client pb.GreeterClient +} + +func (c *ImgClassificationClient) Init(ctx context.Context, ip, port string) { + c.Connect(ctx, ip, port) + c.client = pb.NewGreeterClient(c.conn) +} + +func (c *ImgClassificationClient) Request(ctx context.Context, req Input) string { + var message = req.Value + r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: message}) + if err != nil { + log.Fatalf("could not greet: %v", err) + } + + return r.GetMessage() +} diff --git a/proto/image_classification/image_classification.pb.go b/proto/image_classification/image_classification.pb.go new file mode 100644 index 0000000..58d8655 --- /dev/null +++ b/proto/image_classification/image_classification.pb.go @@ -0,0 +1,243 @@ +// MIT License + +// Copyright (c) 2023 Hyscale 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. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.14.0 +// source: proto/image_classification/image_classification.proto + +package image_classification + +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) +) + +// The request message containing the user's name. +type HelloRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *HelloRequest) Reset() { + *x = HelloRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_image_classification_image_classification_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HelloRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HelloRequest) ProtoMessage() {} + +func (x *HelloRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_image_classification_image_classification_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 HelloRequest.ProtoReflect.Descriptor instead. +func (*HelloRequest) Descriptor() ([]byte, []int) { + return file_proto_image_classification_image_classification_proto_rawDescGZIP(), []int{0} +} + +func (x *HelloRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// The response message containing the greetings +type HelloReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *HelloReply) Reset() { + *x = HelloReply{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_image_classification_image_classification_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HelloReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HelloReply) ProtoMessage() {} + +func (x *HelloReply) ProtoReflect() protoreflect.Message { + mi := &file_proto_image_classification_image_classification_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 HelloReply.ProtoReflect.Descriptor instead. +func (*HelloReply) Descriptor() ([]byte, []int) { + return file_proto_image_classification_image_classification_proto_rawDescGZIP(), []int{1} +} + +func (x *HelloReply) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_proto_image_classification_image_classification_proto protoreflect.FileDescriptor + +var file_proto_image_classification_image_classification_proto_rawDesc = []byte{ + 0x0a, 0x35, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x69, 0x6d, 0x61, + 0x67, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x22, 0x0a, + 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x26, 0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x5d, 0x0a, 0x07, 0x47, 0x72, 0x65, + 0x65, 0x74, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, + 0x12, 0x22, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x68, 0x69, 0x76, 0x65, 0x2d, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x6c, 0x65, 0x73, 0x73, 0x2f, 0x76, 0x53, 0x77, 0x61, 0x72, 0x6d, 0x2d, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_image_classification_image_classification_proto_rawDescOnce sync.Once + file_proto_image_classification_image_classification_proto_rawDescData = file_proto_image_classification_image_classification_proto_rawDesc +) + +func file_proto_image_classification_image_classification_proto_rawDescGZIP() []byte { + file_proto_image_classification_image_classification_proto_rawDescOnce.Do(func() { + file_proto_image_classification_image_classification_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_image_classification_image_classification_proto_rawDescData) + }) + return file_proto_image_classification_image_classification_proto_rawDescData +} + +var file_proto_image_classification_image_classification_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_proto_image_classification_image_classification_proto_goTypes = []interface{}{ + (*HelloRequest)(nil), // 0: image_classification.HelloRequest + (*HelloReply)(nil), // 1: image_classification.HelloReply +} +var file_proto_image_classification_image_classification_proto_depIdxs = []int32{ + 0, // 0: image_classification.Greeter.SayHello:input_type -> image_classification.HelloRequest + 1, // 1: image_classification.Greeter.SayHello:output_type -> image_classification.HelloReply + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_image_classification_image_classification_proto_init() } +func file_proto_image_classification_image_classification_proto_init() { + if File_proto_image_classification_image_classification_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_image_classification_image_classification_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_image_classification_image_classification_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloReply); 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_proto_image_classification_image_classification_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_image_classification_image_classification_proto_goTypes, + DependencyIndexes: file_proto_image_classification_image_classification_proto_depIdxs, + MessageInfos: file_proto_image_classification_image_classification_proto_msgTypes, + }.Build() + File_proto_image_classification_image_classification_proto = out.File + file_proto_image_classification_image_classification_proto_rawDesc = nil + file_proto_image_classification_image_classification_proto_goTypes = nil + file_proto_image_classification_image_classification_proto_depIdxs = nil +} diff --git a/proto/image_classification/image_classification.proto b/proto/image_classification/image_classification.proto new file mode 100644 index 0000000..8bbe4af --- /dev/null +++ b/proto/image_classification/image_classification.proto @@ -0,0 +1,41 @@ +// MIT License + +// Copyright (c) 2023 Hyscale 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/image_classification"; + +package image_classification; + +// 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 {string message =1;} diff --git a/proto/image_classification/image_classification_grpc.pb.go b/proto/image_classification/image_classification_grpc.pb.go new file mode 100644 index 0000000..9da9f13 --- /dev/null +++ b/proto/image_classification/image_classification_grpc.pb.go @@ -0,0 +1,103 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package image_classification + +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, "/image_classification.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: "/image_classification.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: "image_classification.Greeter", + HandlerType: (*GreeterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _Greeter_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/image_classification/image_classification.proto", +} diff --git a/proto/image_classification/image_classification_pb2.py b/proto/image_classification/image_classification_pb2.py new file mode 100644 index 0000000..476c0fc --- /dev/null +++ b/proto/image_classification/image_classification_pb2.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/image_classification/image_classification.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'\n5proto/image_classification/image_classification.proto\x12\x14image_classification\"\x1c\n\x0cHelloRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x1d\n\nHelloReply\x12\x0f\n\x07message\x18\x01 \x01(\t2]\n\x07Greeter\x12R\n\x08SayHello\x12\".image_classification.HelloRequest\x1a .image_classification.HelloReply\"\x00\x42\x45ZCgithub.com/vhive-serverless/vSwarm-proto/proto/image_classificationb\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.image_classification.image_classification_pb2' + # @@protoc_insertion_point(class_scope:image_classification.HelloRequest) + }) +_sym_db.RegisterMessage(HelloRequest) + +HelloReply = _reflection.GeneratedProtocolMessageType('HelloReply', (_message.Message,), { + 'DESCRIPTOR' : _HELLOREPLY, + '__module__' : 'proto.image_classification.image_classification_pb2' + # @@protoc_insertion_point(class_scope:image_classification.HelloReply) + }) +_sym_db.RegisterMessage(HelloReply) + +_GREETER = DESCRIPTOR.services_by_name['Greeter'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'ZCgithub.com/vhive-serverless/vSwarm-proto/proto/image_classification' + _HELLOREQUEST._serialized_start=79 + _HELLOREQUEST._serialized_end=107 + _HELLOREPLY._serialized_start=109 + _HELLOREPLY._serialized_end=138 + _GREETER._serialized_start=140 + _GREETER._serialized_end=233 +# @@protoc_insertion_point(module_scope) diff --git a/proto/image_classification/image_classification_pb2_grpc.py b/proto/image_classification/image_classification_pb2_grpc.py new file mode 100644 index 0000000..a3edf3a --- /dev/null +++ b/proto/image_classification/image_classification_pb2_grpc.py @@ -0,0 +1,70 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from proto.image_classification import image_classification_pb2 as proto_dot_image__classification_dot_image__classification__pb2 + + +class GreeterStub(object): + """The greeting service definition. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SayHello = channel.unary_unary( + '/image_classification.Greeter/SayHello', + request_serializer=proto_dot_image__classification_dot_image__classification__pb2.HelloRequest.SerializeToString, + response_deserializer=proto_dot_image__classification_dot_image__classification__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_image__classification_dot_image__classification__pb2.HelloRequest.FromString, + response_serializer=proto_dot_image__classification_dot_image__classification__pb2.HelloReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'image_classification.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, '/image_classification.Greeter/SayHello', + proto_dot_image__classification_dot_image__classification__pb2.HelloRequest.SerializeToString, + proto_dot_image__classification_dot_image__classification__pb2.HelloReply.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata)