Context manager yielding gRPC server hosting simulation component.
@contextlib.contextmanager
tff.simulation.server_context(
ex_factory: tff.framework.ExecutorFactory
,
num_threads: int,
port: int,
credentials: Optional[grpc.ServerCredentials] = None,
options: Optional[list[tuple[Any, Any]]] = None
)
Args |
ex_factory
|
The executor factory 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.
|
Yields |
The constructed gRPC server.
|
Raises |
ValueError
|
If num_threads or port are invalid.
|