jfjoch_grpc2http.py: implement cancel

This commit is contained in:
2023-05-08 11:18:08 +02:00
parent 747c7f8f0b
commit 107e980e31

View File

@@ -95,7 +95,7 @@ async def stop():
@app.post("/detector/trigger")
async def stop():
async def trigger():
try:
stub = jfjoch_pb2_grpc.gRPC_JFJochBrokerStub(channel)
stub.Trigger(jfjoch_pb2.Empty())
@@ -104,6 +104,16 @@ async def stop():
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: