def _start_server(port):
    """Starts the Catch gRPC server."""
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
    servicer = catch_environment.CatchEnvironmentService()
    dm_env_rpc_pb2_grpc.add_EnvironmentServicer_to_server(servicer, server)

    server.add_insecure_port('localhost:{}'.format(port))
    server.start()
    return server
Exemple #2
0
def _start_server():
    """Starts the Catch gRPC server."""
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
    servicer = catch_environment.CatchEnvironmentService()
    dm_env_rpc_pb2_grpc.add_EnvironmentServicer_to_server(servicer, server)

    port = server.add_secure_port('localhost:0',
                                  grpc.local_server_credentials())
    server.start()
    return server, port
Exemple #3
0
    def __init__(self):
        self._server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
        servicer = catch_environment.CatchEnvironmentService()
        dm_env_rpc_pb2_grpc.add_EnvironmentServicer_to_server(
            servicer, self._server)
        port = self._server.add_secure_port('[::]:0',
                                            grpc.local_server_credentials())
        self._server.start()

        self._channel = grpc.secure_channel(f'[::]:{port}',
                                            grpc.local_channel_credentials())
        grpc.channel_ready_future(self._channel).result()

        self.connection = dm_env_rpc_connection.Connection(self._channel)
Exemple #4
0
  def setUp(self):
    super(CatchTestBase, self).setUp()

    port = portpicker.pick_unused_port()
    self._server = grpc.server(
        futures.ThreadPoolExecutor(max_workers=1))
    servicer = catch_environment.CatchEnvironmentService()
    dm_env_rpc_pb2_grpc.add_EnvironmentServicer_to_server(
        servicer, self._server)
    self._server.add_insecure_port(_local_address(port))
    self._server.start()

    self._channel = grpc.secure_channel(
        _local_address(port), grpc.local_channel_credentials())
    grpc.channel_ready_future(self._channel).result()

    self._connection = dm_env_rpc_connection.Connection(self._channel)
    response = self._connection.send(dm_env_rpc_pb2.CreateWorldRequest())
    self._world_name = response.world_name