예제 #1
0
 def test_returns_ack_message(self, pybio_model_bytes, grpc_stub):
     model = grpc_stub.CreateModelSession(valid_model_request(pybio_model_bytes))
     resp = grpc_stub.GetLogs(inference_pb2.Empty())
     record = next(resp)
     assert inference_pb2.LogEntry.Level.INFO == record.level
     assert "Sending model logs" == record.content
     grpc_stub.CloseModelSession(model)
예제 #2
0
 def get_devices(self):
     resp = self._client.ListDevices(inference_pb2.Empty())
     return [(d.id, d.id) for d in resp.devices]
예제 #3
0
 def _query_devices(self, grpc_stub):
     dev_resp = grpc_stub.ListDevices(inference_pb2.Empty())
     device_by_id = {d.id: d for d in dev_resp.devices}
     return device_by_id
예제 #4
0
 def test_list_devices(self, grpc_stub):
     resp = grpc_stub.ListDevices(inference_pb2.Empty())
     device_by_id = {d.id: d for d in resp.devices}
     assert "cpu" in device_by_id
     assert inference_pb2.Device.Status.AVAILABLE == device_by_id["cpu"].status
예제 #5
0
 def Ping(self, request: inference_pb2.Empty, context) -> inference_pb2.Empty:
     return inference_pb2.Empty()
예제 #6
0
 def Shutdown(self, request: inference_pb2.Empty, context) -> inference_pb2.Empty:
     if self.__done_evt:
         self.__done_evt.set()
     return inference_pb2.Empty()
예제 #7
0
 def Ping(self, request: inference_pb2.Empty,
          context) -> inference_pb2.Empty:
     self.__last_ping = time.time()
     return inference_pb2.Empty()
예제 #8
0
def run():
    with grpc.insecure_channel("127.0.0.1:5567") as channel:
        stub = inference_pb2_grpc.InferenceStub(channel)
        response = stub.ListDevices(inference_pb2.Empty())
        print(response)
예제 #9
0
 def CloseModelSession(self, request: inference_pb2.ModelSession,
                       context) -> inference_pb2.Empty:
     self.__session_manager.close_session(request.id)
     return inference_pb2.Empty()