我正在尝试在Python中运行gRPC服务器。我找到了这样的方法:
import grpc
from concurrent import futures
server = grpc.server(futures.ThreadPoolExecutor(max_workers=100))
... # add my grpc servicer to server
server.add_insecure_port('[::]:50051')
server.start()
Run Code Online (Sandbox Code Playgroud)
我需要向服务器添加一些选项,例如max_send_message_length,max_receive_message_length等等。中有一个options参数grpc.server(...),但是我不知道如何使用它。
server = grpc.server(futures.ThreadPoolExecutor(max_workers=100), options=[???])
Run Code Online (Sandbox Code Playgroud)
从gRPC文档中:
options –用于配置通道的键/值对(gRPC运行时中的通道args)的可选列表。
如何创建这些选项?它们是字符串对吗?
我是Python和gRPC的新手。
您可以在此github问题中找到一个示例:https : //github.com/grpc/grpc/issues/11299
对于30mb最大消息长度,请使用:
options = [('grpc.max_message_length', 30 * 1024 * 1024)]
| 归档时间: |
|
| 查看次数: |
1810 次 |
| 最近记录: |