本文整理汇总了Python中grpc.stream_unary_rpc_method_handler方法的典型用法代码示例。如果您正苦于以下问题:Python grpc.stream_unary_rpc_method_handler方法的具体用法?Python grpc.stream_unary_rpc_method_handler怎么用?Python grpc.stream_unary_rpc_method_handler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grpc
的用法示例。
在下文中一共展示了grpc.stream_unary_rpc_method_handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_DataTransferServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_DataTransferServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'push': grpc.stream_unary_rpc_method_handler(
servicer.push,
request_deserializer=fate__proxy__pb2.Packet.FromString,
response_serializer=fate__proxy__pb2.Metadata.SerializeToString,
),
'pull': grpc.unary_stream_rpc_method_handler(
servicer.pull,
request_deserializer=fate__proxy__pb2.Metadata.FromString,
response_serializer=fate__proxy__pb2.Packet.SerializeToString,
),
'unaryCall': grpc.unary_unary_rpc_method_handler(
servicer.unaryCall,
request_deserializer=fate__proxy__pb2.Packet.FromString,
response_serializer=fate__proxy__pb2.Packet.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.webank.ai.fate.api.networking.proxy.DataTransferService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例2: add_DataTransferServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_DataTransferServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'push': grpc.stream_unary_rpc_method_handler(
servicer.push,
request_deserializer=proxy__pb2.Packet.FromString,
response_serializer=proxy__pb2.Metadata.SerializeToString,
),
'pull': grpc.unary_stream_rpc_method_handler(
servicer.pull,
request_deserializer=proxy__pb2.Metadata.FromString,
response_serializer=proxy__pb2.Packet.SerializeToString,
),
'unaryCall': grpc.unary_unary_rpc_method_handler(
servicer.unaryCall,
request_deserializer=proxy__pb2.Packet.FromString,
response_serializer=proxy__pb2.Packet.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.webank.ai.eggroll.api.networking.proxy.DataTransferService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例3: add_MockServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_MockServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'UnaryDoSomething': grpc.unary_unary_rpc_method_handler(
servicer.UnaryDoSomething,
request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.StringMessage.FromString,
response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.StringMessage.SerializeToString,
),
'ClientStreamDoSomething': grpc.stream_unary_rpc_method_handler(
servicer.ClientStreamDoSomething,
request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntMessage.FromString,
response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntCollectionMessage.SerializeToString,
),
'ServerSteramDoSomething': grpc.unary_stream_rpc_method_handler(
servicer.ServerSteramDoSomething,
request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntCollectionMessage.FromString,
response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntMessage.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'etcdserverpb.MockService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例4: _wrap_rpc_behavior
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def _wrap_rpc_behavior(handler, fn):
"""Returns a new rpc handler that wraps the given function"""
if handler is None:
return None
if handler.request_streaming and handler.response_streaming:
behavior_fn = handler.stream_stream
handler_factory = grpc.stream_stream_rpc_method_handler
elif handler.request_streaming and not handler.response_streaming:
behavior_fn = handler.stream_unary
handler_factory = grpc.stream_unary_rpc_method_handler
elif not handler.request_streaming and handler.response_streaming:
behavior_fn = handler.unary_stream
handler_factory = grpc.unary_stream_rpc_method_handler
else:
behavior_fn = handler.unary_unary
handler_factory = grpc.unary_unary_rpc_method_handler
return handler_factory(
fn(behavior_fn, handler.request_streaming,
handler.response_streaming),
request_deserializer=handler.request_deserializer,
response_serializer=handler.response_serializer
)
示例5: add_TransferServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_TransferServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'send': grpc.stream_unary_rpc_method_handler(
servicer.send,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
'recv': grpc.unary_stream_rpc_method_handler(
servicer.recv,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
'sendRecv': grpc.stream_stream_rpc_method_handler(
servicer.sendRecv,
request_deserializer=transfer__pb2.TransferBatch.FromString,
response_serializer=transfer__pb2.TransferBatch.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.webank.eggroll.core.transfer.TransferService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例6: add_HelloServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_HelloServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'unaryCall': grpc.unary_unary_rpc_method_handler(
servicer.unaryCall,
request_deserializer=grpc__test__pb2.HelloRequest.FromString,
response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
),
'push': grpc.stream_unary_rpc_method_handler(
servicer.push,
request_deserializer=grpc__test__pb2.HelloRequest.FromString,
response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
),
'pull': grpc.unary_unary_rpc_method_handler(
servicer.pull,
request_deserializer=grpc__test__pb2.HelloRequest.FromString,
response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.webank.eggroll.grpc.test.HelloService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例7: add_WisdomServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_WisdomServicer_to_server(servicer, server):
rpc_method_handlers = {
'send': grpc.unary_unary_rpc_method_handler(
servicer.send,
request_deserializer=WisdomGrpcService__pb2.Event.FromString,
response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
),
'feed': grpc.stream_unary_rpc_method_handler(
servicer.feed,
request_deserializer=WisdomGrpcService__pb2.Event.FromString,
response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
),
'receive': grpc.unary_stream_rpc_method_handler(
servicer.receive,
request_deserializer=WisdomGrpcService__pb2.Event.FromString,
response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'com.javahelps.wisdom.service.gprc.Wisdom', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例8: add_GigagenieServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_GigagenieServicer_to_server(servicer, server):
rpc_method_handlers = {
'getVoice2Text': grpc.stream_stream_rpc_method_handler(
servicer.getVoice2Text,
request_deserializer=gigagenieRPC__pb2.reqVoice.FromString,
response_serializer=gigagenieRPC__pb2.resText.SerializeToString,
),
'getText2VoiceUrl': grpc.unary_unary_rpc_method_handler(
servicer.getText2VoiceUrl,
request_deserializer=gigagenieRPC__pb2.reqText.FromString,
response_serializer=gigagenieRPC__pb2.resUrl.SerializeToString,
),
'getText2VoiceStream': grpc.unary_stream_rpc_method_handler(
servicer.getText2VoiceStream,
request_deserializer=gigagenieRPC__pb2.reqText.FromString,
response_serializer=gigagenieRPC__pb2.resVoice.SerializeToString,
),
'queryByText': grpc.unary_unary_rpc_method_handler(
servicer.queryByText,
request_deserializer=gigagenieRPC__pb2.reqQueryText.FromString,
response_serializer=gigagenieRPC__pb2.resQueryText.SerializeToString,
),
'queryByVoice': grpc.stream_unary_rpc_method_handler(
servicer.queryByVoice,
request_deserializer=gigagenieRPC__pb2.reqQueryVoice.FromString,
response_serializer=gigagenieRPC__pb2.resQueryText.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'kt.gigagenie.ai.speech.Gigagenie', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例9: add_GreeterServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_GreeterServicer_to_server(servicer, server):
rpc_method_handlers = {
'SayHello': grpc.unary_unary_rpc_method_handler(
servicer.SayHello,
request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
),
'SayHelloGoodbye': grpc.unary_stream_rpc_method_handler(
servicer.SayHelloGoodbye,
request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
),
'SayHelloToMany': grpc.stream_stream_rpc_method_handler(
servicer.SayHelloToMany,
request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
),
'SayHelloToManyAtOnce': grpc.stream_unary_rpc_method_handler(
servicer.SayHelloToManyAtOnce,
request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Greeter', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例10: add_HetrServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_HetrServicer_to_server(servicer, server):
rpc_method_handlers = {
'BuildTransformer': grpc.unary_unary_rpc_method_handler(
servicer.BuildTransformer,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.BuildTransformerRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.BuildTransformerReply.SerializeToString,
),
'CloseTransformer': grpc.unary_unary_rpc_method_handler(
servicer.CloseTransformer,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseTransformerRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseTransformerReply.SerializeToString,
),
'Computation': grpc.stream_unary_rpc_method_handler(
servicer.Computation,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.ComputationRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.ComputationReply.SerializeToString,
),
'FeedInput': grpc.unary_unary_rpc_method_handler(
servicer.FeedInput,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.FeedInputRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.FeedInputReply.SerializeToString,
),
'GetResults': grpc.unary_unary_rpc_method_handler(
servicer.GetResults,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.GetResultsRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.GetResultsReply.SerializeToString,
),
'Close': grpc.unary_unary_rpc_method_handler(
servicer.Close,
request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseRequest.FromString,
response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseReply.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Hetr', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例11: add_HetrServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_HetrServicer_to_server(servicer, server):
rpc_method_handlers = {
'BuildTransformer': grpc.unary_unary_rpc_method_handler(
servicer.BuildTransformer,
request_deserializer=BuildTransformerRequest.FromString,
response_serializer=BuildTransformerReply.SerializeToString,
),
'CloseTransformer': grpc.unary_unary_rpc_method_handler(
servicer.CloseTransformer,
request_deserializer=CloseTransformerRequest.FromString,
response_serializer=CloseTransformerReply.SerializeToString,
),
'Computation': grpc.stream_unary_rpc_method_handler(
servicer.Computation,
request_deserializer=ComputationRequest.FromString,
response_serializer=ComputationReply.SerializeToString,
),
'FeedInput': grpc.unary_unary_rpc_method_handler(
servicer.FeedInput,
request_deserializer=FeedInputRequest.FromString,
response_serializer=FeedInputReply.SerializeToString,
),
'GetResults': grpc.unary_unary_rpc_method_handler(
servicer.GetResults,
request_deserializer=GetResultsRequest.FromString,
response_serializer=GetResultsReply.SerializeToString,
),
'Close': grpc.unary_unary_rpc_method_handler(
servicer.Close,
request_deserializer=CloseRequest.FromString,
response_serializer=CloseReply.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Hetr', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例12: add_StanServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_StanServicer_to_server(servicer, server):
rpc_method_handlers = {
'OneQuestionOneResponse': grpc.unary_unary_rpc_method_handler(
servicer.OneQuestionOneResponse,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
'ManyQuestionsOneResponse': grpc.stream_unary_rpc_method_handler(
servicer.ManyQuestionsOneResponse,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
'OneQuestionManyResponses': grpc.unary_stream_rpc_method_handler(
servicer.OneQuestionManyResponses,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
'ManyQuestionsManyReponses': grpc.stream_stream_rpc_method_handler(
servicer.ManyQuestionsManyReponses,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
'OneQuestionOneErrorResponse': grpc.unary_unary_rpc_method_handler(
servicer.OneQuestionOneErrorResponse,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
'OneErroredQuestionOneResponse': grpc.unary_unary_rpc_method_handler(
servicer.OneErroredQuestionOneResponse,
request_deserializer=stan__pb2.QuestionRequest.FromString,
response_serializer=stan__pb2.QuestionResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'stan.Stan', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例13: add_TestServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_TestServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'NormalMethod': grpc.unary_unary_rpc_method_handler(
servicer.NormalMethod,
request_deserializer=service__pb2.StandardRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
'StreamMethod': grpc.unary_stream_rpc_method_handler(
servicer.StreamMethod,
request_deserializer=service__pb2.StreamRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
'StreamInputMethod': grpc.stream_unary_rpc_method_handler(
servicer.StreamInputMethod,
request_deserializer=service__pb2.StandardRequest.FromString,
response_serializer=service__pb2.StreamReply.SerializeToString,
),
'StreamStreamMethod': grpc.stream_stream_rpc_method_handler(
servicer.StreamStreamMethod,
request_deserializer=service__pb2.StandardRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
'DelayedMethod': grpc.unary_unary_rpc_method_handler(
servicer.DelayedMethod,
request_deserializer=service__pb2.StandardRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
'ExceptionMethod': grpc.unary_unary_rpc_method_handler(
servicer.ExceptionMethod,
request_deserializer=service__pb2.StandardRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
'DelayedStream': grpc.unary_stream_rpc_method_handler(
servicer.DelayedStream,
request_deserializer=service__pb2.StreamRequest.FromString,
response_serializer=service__pb2.StandardReply.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'TestService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例14: add_TestServiceServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_TestServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'NormalMethod': grpc.unary_unary_rpc_method_handler(
servicer.NormalMethod,
request_deserializer=StandardRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
'StreamMethod': grpc.unary_stream_rpc_method_handler(
servicer.StreamMethod,
request_deserializer=StreamRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
'StreamInputMethod': grpc.stream_unary_rpc_method_handler(
servicer.StreamInputMethod,
request_deserializer=StandardRequest.FromString,
response_serializer=StreamReply.SerializeToString,
),
'StreamStreamMethod': grpc.stream_stream_rpc_method_handler(
servicer.StreamStreamMethod,
request_deserializer=StandardRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
'DelayedMethod': grpc.unary_unary_rpc_method_handler(
servicer.DelayedMethod,
request_deserializer=StandardRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
'ExceptionMethod': grpc.unary_unary_rpc_method_handler(
servicer.ExceptionMethod,
request_deserializer=StandardRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
'DelayedStream': grpc.unary_stream_rpc_method_handler(
servicer.DelayedStream,
request_deserializer=StreamRequest.FromString,
response_serializer=StandardReply.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'TestService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
示例15: add_StoreServicer_to_server
# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 别名]
def add_StoreServicer_to_server(servicer, server):
rpc_method_handlers = {
'AddItem': grpc.unary_unary_rpc_method_handler(
servicer.AddItem,
request_deserializer=AddItemRequest.FromString,
response_serializer=Empty.SerializeToString,
),
'AddItems': grpc.stream_unary_rpc_method_handler(
servicer.AddItems,
request_deserializer=AddItemRequest.FromString,
response_serializer=Empty.SerializeToString,
),
'RemoveItem': grpc.unary_unary_rpc_method_handler(
servicer.RemoveItem,
request_deserializer=RemoveItemRequest.FromString,
response_serializer=RemoveItemResponse.SerializeToString,
),
'RemoveItems': grpc.stream_unary_rpc_method_handler(
servicer.RemoveItems,
request_deserializer=RemoveItemRequest.FromString,
response_serializer=RemoveItemResponse.SerializeToString,
),
'ListInventory': grpc.unary_stream_rpc_method_handler(
servicer.ListInventory,
request_deserializer=Empty.FromString,
response_serializer=QuantityResponse.SerializeToString,
),
'QueryQuantity': grpc.unary_unary_rpc_method_handler(
servicer.QueryQuantity,
request_deserializer=QueryItemRequest.FromString,
response_serializer=QuantityResponse.SerializeToString,
),
'QueryQuantities': grpc.stream_stream_rpc_method_handler(
servicer.QueryQuantities,
request_deserializer=QueryItemRequest.FromString,
response_serializer=QuantityResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'store.Store', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))