JFJochBroker: Get measurement statistics

This commit is contained in:
2023-04-10 17:59:00 +02:00
parent 6f0d9e70b7
commit b42af7d10d
6 changed files with 60 additions and 3 deletions

View File

@@ -173,6 +173,16 @@ async def get_settings():
raise HTTPException(status_code=400, detail=e.details())
@app.put("/detector/measurement_statistics")
async def get_meas_stats():
try:
return MessageToDict(
stub.GetMeasurementStatistics(jfjoch_pb2.Empty()), including_default_value_fields=True
)
except grpc.RpcError as e:
raise HTTPException(status_code=400, detail=e.details())
# https://stackoverflow.com/questions/55873174/how-do-i-return-an-image-in-fastapi
@app.get(
"/image/preview.tiff",

File diff suppressed because one or more lines are too long

View File

@@ -747,6 +747,11 @@ class gRPC_JFJochBrokerStub(object):
request_serializer=jfjoch__pb2.DetectorSettings.SerializeToString,
response_deserializer=jfjoch__pb2.Empty.FromString,
)
self.GetMeasurementStatistics = channel.unary_unary(
'/JFJochProtoBuf.gRPC_JFJochBroker/GetMeasurementStatistics',
request_serializer=jfjoch__pb2.Empty.SerializeToString,
response_deserializer=jfjoch__pb2.MeasurementStatistics.FromString,
)
self.GetDataProcessingSettings = channel.unary_unary(
'/JFJochProtoBuf.gRPC_JFJochBroker/GetDataProcessingSettings',
request_serializer=jfjoch__pb2.Empty.SerializeToString,
@@ -858,6 +863,12 @@ class gRPC_JFJochBrokerServicer(object):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetMeasurementStatistics(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetDataProcessingSettings(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -964,6 +975,11 @@ def add_gRPC_JFJochBrokerServicer_to_server(servicer, server):
request_deserializer=jfjoch__pb2.DetectorSettings.FromString,
response_serializer=jfjoch__pb2.Empty.SerializeToString,
),
'GetMeasurementStatistics': grpc.unary_unary_rpc_method_handler(
servicer.GetMeasurementStatistics,
request_deserializer=jfjoch__pb2.Empty.FromString,
response_serializer=jfjoch__pb2.MeasurementStatistics.SerializeToString,
),
'GetDataProcessingSettings': grpc.unary_unary_rpc_method_handler(
servicer.GetDataProcessingSettings,
request_deserializer=jfjoch__pb2.Empty.FromString,
@@ -1201,6 +1217,23 @@ class gRPC_JFJochBroker(object):
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetMeasurementStatistics(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, '/JFJochProtoBuf.gRPC_JFJochBroker/GetMeasurementStatistics',
jfjoch__pb2.Empty.SerializeToString,
jfjoch__pb2.MeasurementStatistics.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetDataProcessingSettings(request,
target,