grpc: add health checks to python services (#28)

also converted line endings for recommendationservice/requirements.txt from
dos to unix.
This commit is contained in:
Ahmet Alp Balkan 2018-09-19 12:34:56 -07:00 committed by GitHub
parent fc6df2daea
commit 880ee16be2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 331 additions and 259 deletions

View file

@ -1,19 +1,3 @@
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
@ -441,11 +425,6 @@ class CheckoutServiceStub(object):
Args:
channel: A grpc.Channel.
"""
self.CreateOrder = channel.unary_unary(
'/hipstershop.CheckoutService/CreateOrder',
request_serializer=demo__pb2.CreateOrderRequest.SerializeToString,
response_deserializer=demo__pb2.CreateOrderResponse.FromString,
)
self.PlaceOrder = channel.unary_unary(
'/hipstershop.CheckoutService/PlaceOrder',
request_serializer=demo__pb2.PlaceOrderRequest.SerializeToString,
@ -458,13 +437,6 @@ class CheckoutServiceServicer(object):
"""
def CreateOrder(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def PlaceOrder(self, request, context):
# missing associated documentation comment in .proto file
pass
@ -475,11 +447,6 @@ class CheckoutServiceServicer(object):
def add_CheckoutServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'CreateOrder': grpc.unary_unary_rpc_method_handler(
servicer.CreateOrder,
request_deserializer=demo__pb2.CreateOrderRequest.FromString,
response_serializer=demo__pb2.CreateOrderResponse.SerializeToString,
),
'PlaceOrder': grpc.unary_unary_rpc_method_handler(
servicer.PlaceOrder,
request_deserializer=demo__pb2.PlaceOrderRequest.FromString,
@ -489,3 +456,47 @@ def add_CheckoutServiceServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'hipstershop.CheckoutService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
class AdsServiceStub(object):
"""------------Ads service------------------
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetAds = channel.unary_unary(
'/hipstershop.AdsService/GetAds',
request_serializer=demo__pb2.AdsRequest.SerializeToString,
response_deserializer=demo__pb2.AdsResponse.FromString,
)
class AdsServiceServicer(object):
"""------------Ads service------------------
"""
def GetAds(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_AdsServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetAds': grpc.unary_unary_rpc_method_handler(
servicer.GetAds,
request_deserializer=demo__pb2.AdsRequest.FromString,
response_serializer=demo__pb2.AdsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'hipstershop.AdsService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))