当调用我的服务器获取某种类型的消息时,我收到以下错误:
Exception calling application: module \'grpc\' has no attribute \'experimental\', grpc-status: 2};
。
服务器收到呼叫后立即发生此错误。该服务能够验证消息的格式(如果我传递了错误的格式,我将收到正确的错误)
我的服务器上有其他服务运行,没有任何问题。
我的服务器定义如下:
Settings.load_settings()
server = grpc.server(
futures.ThreadPoolExecutor(max_workers=int(os.getenv("WORKER_NB")))
)
Compiler(server).compile_controllers()
SQLProvider()
# Add Health checking:
health_pb2_grpc.add_HealthServicer_to_server(health.HealthServicer(), server)
# Start the server:
server.add_insecure_port("[::]:{}".format(os.getenv("API_PORT")))
server.start()
logger.info("Server started")
server.wait_for_termination()
我在调用中发现的主要区别是 protobuf 消息包含时间戳和枚举。是否有传递到服务器的选项?
我试图传递的原始消息看起来像这样:
syntax = "proto3";
import "google/protobuf/timestamp.proto";
enum En {
a = 0;
b = 1;
c = 2;
}
message ComputeRequest {
int32 a = 2;
google.protobuf.Timestamp start_date = 3;
repeated int32 ids = 7;
En en = 11;
}
message ComputeResponse {
float a = 1;
float b = 2;
}
service ComputeService {
rpc GetComputeResponse (ComputeRequest) returns (ComputeResponse) {}
}
grpc版本:1.54.2
你们知道如何解决这个问题吗?
Prashant Saraswat 提出了我需要的东西 我有一个未实现的不相关功能,这触发了我的错误。