Missed TensorFlow World? Check out the recap. Learn more

tff.simulation.run_server

View source on GitHub

Runs a gRPC server hosting a simulation component in this process.

tff.simulation.run_server(
    executor,
    num_threads,
    port,
    credentials=None,
    options=None
)

The server runs indefinitely, but can be stopped by a keyboard interrrupt.

Args:

  • executor: The executor to be hosted by the server.
  • num_threads: The number of network threads to use for handling gRPC calls.
  • port: The port to listen on (for gRPC), must be a non-zero integer.
  • credentials: The optional credentials to use for the secure connection if any, or None if the server should open an insecure port. If specified, must be a valid ServerCredentials object that can be accepted by the gRPC server's add_secure_port().
  • options: The optional list of server options, each in the (key, value) format accepted by the grpc.server() constructor.

Raises:

  • ValueError: If num_threads or port are invalid.