New REST+OpenAPI interface
This commit is contained in:
@@ -1,313 +0,0 @@
|
||||
# Copyright (2019-2023) Paul Scherrer Institute
|
||||
#
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
import grpc
|
||||
import numpy
|
||||
from fastapi import FastAPI, HTTPException, Response, Request
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from google.protobuf.json_format import Parse, ParseError, MessageToDict
|
||||
from tifffile import imwrite
|
||||
|
||||
import jfjoch_pb2
|
||||
import jfjoch_pb2_grpc
|
||||
|
||||
static_directory = "../frontend_ui/build"
|
||||
grpc_addr = "localhost:5232"
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.mount("/frontend", StaticFiles(directory=static_directory), name="static")
|
||||
|
||||
MAX_MESSAGE_LENGTH = 64 * 1024 * 1024
|
||||
channel = grpc.insecure_channel(
|
||||
grpc_addr,
|
||||
options=[
|
||||
("grpc.max_send_message_length", MAX_MESSAGE_LENGTH),
|
||||
("grpc.max_receive_message_length", MAX_MESSAGE_LENGTH),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@app.get("/", response_class=RedirectResponse)
|
||||
async def get_root():
|
||||
return "/frontend/index.html"
|
||||
|
||||
|
||||
@app.get("/frontend", response_class=RedirectResponse)
|
||||
async def get_frontend():
|
||||
return "/frontend/index.html"
|
||||
|
||||
|
||||
@app.post("/detector/pedestal")
|
||||
async def pedestal():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Pedestal(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.post("/detector/initialize")
|
||||
async def initialize():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Initialize(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.post("/detector/deactivate")
|
||||
async def deactivate():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Deactivate(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.post("/detector/start")
|
||||
async def start(request: Request):
|
||||
try:
|
||||
data = await request.body()
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Start(Parse(data, jfjoch_pb2.DatasetSettings()))
|
||||
return {}
|
||||
except ParseError as e:
|
||||
return HTTPException(status_code=400, detail="Parser error: " + str(e))
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.post("/detector/stop")
|
||||
async def stop():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Stop(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.post("/detector/trigger")
|
||||
async def trigger():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Trigger(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.post("/detector/cancel")
|
||||
async def cancel():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.Cancel(jfjoch_pb2.Empty())
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
return {}
|
||||
|
||||
|
||||
@app.get("/detector/status")
|
||||
async def get_status():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetStatus(jfjoch_pb2.Empty()), including_default_value_fields=True
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get("/detector/settings")
|
||||
async def get_settings():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetDetectorSettings(jfjoch_pb2.Empty()),
|
||||
including_default_value_fields=True,
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.put("/detector/settings")
|
||||
async def put_settings(request: Request):
|
||||
try:
|
||||
data = await request.body()
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.PutDetectorSettings(Parse(data, jfjoch_pb2.DetectorSettings()))
|
||||
return {}
|
||||
except ParseError as e:
|
||||
return HTTPException(status_code=400, detail="Parser error: " + str(e))
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get("/detector/calibration")
|
||||
async def get_calibration():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetCalibrationStatistics(jfjoch_pb2.Empty()),
|
||||
including_default_value_fields=True,
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get("/data_processing/settings")
|
||||
async def get_settings():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetDataProcessingSettings(jfjoch_pb2.Empty()),
|
||||
including_default_value_fields=True,
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.put("/data_processing/settings")
|
||||
async def put_data_processing_settings(request: Request):
|
||||
try:
|
||||
data = await request.body()
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.PutDataProcessingSettings(Parse(data, jfjoch_pb2.DataProcessingSettings()))
|
||||
return {}
|
||||
except ParseError as e:
|
||||
return HTTPException(status_code=400, detail="Parser error: " + str(e))
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.post("/data_processing/plots")
|
||||
async def get_settings(request: Request):
|
||||
try:
|
||||
data = await request.body()
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetPlots(Parse(data, jfjoch_pb2.PlotRequest())), including_default_value_fields=True
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get("/data_processing/rad_int_profiles")
|
||||
async def get_settings():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetRadialIntegrationProfiles(jfjoch_pb2.Empty()), including_default_value_fields=True
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get("/detector/measurement_statistics")
|
||||
async def get_meas_stats():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
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())
|
||||
|
||||
|
||||
@app.get("/detector/list")
|
||||
async def get_detector_list():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
return MessageToDict(
|
||||
stub.GetDetectorList(jfjoch_pb2.Empty()), including_default_value_fields=True
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.put("/detector/select")
|
||||
async def put_detector_selection(request: Request):
|
||||
try:
|
||||
data = await request.body()
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
stub.SelectDetector(Parse(data, jfjoch_pb2.DetectorSelection()))
|
||||
return {}
|
||||
except ParseError as e:
|
||||
return HTTPException(status_code=400, detail="Parser error: " + str(e))
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
def calib_to_tiff(im: jfjoch_pb2.Image) -> bytes:
|
||||
if im.pixel_depth == 2:
|
||||
image_array = numpy.frombuffer(im.data, numpy.uint16)
|
||||
else:
|
||||
image_array = numpy.frombuffer(im.data, numpy.uint32)
|
||||
image_array = numpy.reshape(image_array, (im.height, im.width))
|
||||
b = BytesIO()
|
||||
imwrite(b, image_array)
|
||||
return bytes(b.getvalue())
|
||||
|
||||
|
||||
@app.get(
|
||||
"/image/pedestalG0.tiff",
|
||||
responses={200: {"content": {"image/tiff": {}}}},
|
||||
response_class=Response,
|
||||
)
|
||||
async def get_pedestalg0():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
pbuf = stub.GetPedestalG0(jfjoch_pb2.Empty())
|
||||
return Response(content=calib_to_tiff(pbuf), media_type="image/tiff")
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get(
|
||||
"/image/pedestalG0.tiff",
|
||||
responses={200: {"content": {"image/tiff": {}}}},
|
||||
response_class=Response,
|
||||
)
|
||||
async def get_pedestalg1():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
pbuf = stub.GetPedestalG1(jfjoch_pb2.Empty())
|
||||
return Response(content=calib_to_tiff(pbuf), media_type="image/tiff")
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get(
|
||||
"/image/pedestalG2.tiff",
|
||||
responses={200: {"content": {"image/tiff": {}}}},
|
||||
response_class=Response,
|
||||
)
|
||||
async def get_pedestalg2():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
pbuf = stub.GetPedestalG2(jfjoch_pb2.Empty())
|
||||
return Response(content=calib_to_tiff(pbuf), media_type="image/tiff")
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
|
||||
@app.get(
|
||||
"/image/mask.tiff",
|
||||
responses={200: {"content": {"image/tiff": {}}}},
|
||||
response_class=Response,
|
||||
)
|
||||
async def get_mask():
|
||||
try:
|
||||
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
|
||||
pbuf = stub.GetMask(jfjoch_pb2.Empty())
|
||||
return Response(content=calib_to_tiff(pbuf), media_type="image/tiff")
|
||||
except grpc.RpcError as e:
|
||||
raise HTTPException(status_code=400, detail=e.details())
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,627 +0,0 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
|
||||
import jfjoch_pb2 as jfjoch__pb2
|
||||
|
||||
|
||||
class gRPC_JFJochBrokerStub(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.Start = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Start',
|
||||
request_serializer=jfjoch__pb2.DatasetSettings.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Stop = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Stop',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Pedestal = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Pedestal',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Initialize = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Initialize',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Cancel = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Cancel',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Deactivate = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Deactivate',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.Trigger = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/Trigger',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.GetStatus = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetStatus',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.BrokerStatus.FromString,
|
||||
)
|
||||
self.GetCalibrationStatistics = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetCalibrationStatistics',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.JFCalibrationStatistics.FromString,
|
||||
)
|
||||
self.GetDetectorSettings = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetDetectorSettings',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.DetectorSettings.FromString,
|
||||
)
|
||||
self.PutDetectorSettings = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/PutDetectorSettings',
|
||||
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,
|
||||
response_deserializer=jfjoch__pb2.DataProcessingSettings.FromString,
|
||||
)
|
||||
self.PutDataProcessingSettings = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/PutDataProcessingSettings',
|
||||
request_serializer=jfjoch__pb2.DataProcessingSettings.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
self.GetPlots = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetPlots',
|
||||
request_serializer=jfjoch__pb2.PlotRequest.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Plot.FromString,
|
||||
)
|
||||
self.GetRadialIntegrationProfiles = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetRadialIntegrationProfiles',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.RadialIntegrationProfiles.FromString,
|
||||
)
|
||||
self.GetDetectorList = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/GetDetectorList',
|
||||
request_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.DetectorList.FromString,
|
||||
)
|
||||
self.SelectDetector = channel.unary_unary(
|
||||
'/JFJochProtoBuf.gRPC_JFJochBroker/SelectDetector',
|
||||
request_serializer=jfjoch__pb2.DetectorSelection.SerializeToString,
|
||||
response_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
)
|
||||
|
||||
|
||||
class gRPC_JFJochBrokerServicer(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def Start(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 Stop(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 Pedestal(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 Initialize(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 Cancel(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 Deactivate(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 Trigger(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 GetStatus(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 GetCalibrationStatistics(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 GetDetectorSettings(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 PutDetectorSettings(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 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)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def PutDataProcessingSettings(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 GetPlots(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 GetRadialIntegrationProfiles(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 GetDetectorList(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 SelectDetector(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 add_gRPC_JFJochBrokerServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'Start': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Start,
|
||||
request_deserializer=jfjoch__pb2.DatasetSettings.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Stop': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Stop,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Pedestal': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Pedestal,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Initialize': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Initialize,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Cancel': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Cancel,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Deactivate': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Deactivate,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'Trigger': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Trigger,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'GetStatus': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetStatus,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.BrokerStatus.SerializeToString,
|
||||
),
|
||||
'GetCalibrationStatistics': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetCalibrationStatistics,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.JFCalibrationStatistics.SerializeToString,
|
||||
),
|
||||
'GetDetectorSettings': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetDetectorSettings,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.DetectorSettings.SerializeToString,
|
||||
),
|
||||
'PutDetectorSettings': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.PutDetectorSettings,
|
||||
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,
|
||||
response_serializer=jfjoch__pb2.DataProcessingSettings.SerializeToString,
|
||||
),
|
||||
'PutDataProcessingSettings': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.PutDataProcessingSettings,
|
||||
request_deserializer=jfjoch__pb2.DataProcessingSettings.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
'GetPlots': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetPlots,
|
||||
request_deserializer=jfjoch__pb2.PlotRequest.FromString,
|
||||
response_serializer=jfjoch__pb2.Plot.SerializeToString,
|
||||
),
|
||||
'GetRadialIntegrationProfiles': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetRadialIntegrationProfiles,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.RadialIntegrationProfiles.SerializeToString,
|
||||
),
|
||||
'GetDetectorList': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetDetectorList,
|
||||
request_deserializer=jfjoch__pb2.Empty.FromString,
|
||||
response_serializer=jfjoch__pb2.DetectorList.SerializeToString,
|
||||
),
|
||||
'SelectDetector': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SelectDetector,
|
||||
request_deserializer=jfjoch__pb2.DetectorSelection.FromString,
|
||||
response_serializer=jfjoch__pb2.Empty.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'JFJochProtoBuf.gRPC_JFJochBroker', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class gRPC_JFJochBroker(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
@staticmethod
|
||||
def Start(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/Start',
|
||||
jfjoch__pb2.DatasetSettings.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Stop(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/Stop',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Pedestal(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/Pedestal',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Initialize(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/Initialize',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Cancel(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/Cancel',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Deactivate(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/Deactivate',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Trigger(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/Trigger',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetStatus(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/GetStatus',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.BrokerStatus.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetCalibrationStatistics(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/GetCalibrationStatistics',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.JFCalibrationStatistics.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetDetectorSettings(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/GetDetectorSettings',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.DetectorSettings.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def PutDetectorSettings(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/PutDetectorSettings',
|
||||
jfjoch__pb2.DetectorSettings.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
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,
|
||||
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/GetDataProcessingSettings',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.DataProcessingSettings.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def PutDataProcessingSettings(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/PutDataProcessingSettings',
|
||||
jfjoch__pb2.DataProcessingSettings.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetPlots(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/GetPlots',
|
||||
jfjoch__pb2.PlotRequest.SerializeToString,
|
||||
jfjoch__pb2.Plot.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetRadialIntegrationProfiles(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/GetRadialIntegrationProfiles',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.RadialIntegrationProfiles.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetDetectorList(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/GetDetectorList',
|
||||
jfjoch__pb2.Empty.SerializeToString,
|
||||
jfjoch__pb2.DetectorList.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SelectDetector(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/SelectDetector',
|
||||
jfjoch__pb2.DetectorSelection.SerializeToString,
|
||||
jfjoch__pb2.Empty.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
Reference in New Issue
Block a user