viam.rpc.server

Module Contents

Classes

Server

gRPC Server

Attributes

LOGGER

viam.rpc.server.LOGGER
class viam.rpc.server.Server(components: List[viam.components.component_base.ComponentBase])[source]

gRPC Server

async serve(host: str = 'localhost', port: int = 9090, log_level: int = logging.INFO)[source]

Server the gRPC server on the provided host and port

Parameters
  • host (str, optional) – Desired hostname of the server. Defaults to ‘localhost’.

  • port (int, optional) – Desired port of the server. Defaults to 9090.

  • log_level (int, optional) – The minimum log level. To not receive any logs, set to None Defaults to logging.INFO

close()[source]
async classmethod create_and_serve(components: List[viam.components.component_base.ComponentBase], host: str = 'localhost', port: int = 9090, log_level: int = logging.INFO)[source]

Convenience method to create and start the server.

Parameters
  • components (List[ComponentBase]) – List of components to manage

  • host (str, optional) – Desired hostname. Defaults to “localhost”.

  • port (int, optional) – Desired port. Defaults to 9090.

  • log_level (int, optional) – The minimum log level. To not receive any logs, set to None. Defaults to logging.INFO