nvflare.private.fed.simulator.simulator_server module
- class SimulatorIdentityAsserter(private_key_file: str, cert_file: str)[source]
Bases:
IdentityAsserter
- class SimulatorRunManager(server_name, engine: ~nvflare.apis.server_engine_spec.ServerEngineSpec, job_id, workspace: ~nvflare.apis.workspace.Workspace, components: {<class 'str'>: <class 'nvflare.apis.fl_component.FLComponent'>}, client_manager: ~nvflare.private.fed.server.client_manager.ClientManager | None = None, handlers: ~typing.List[~nvflare.apis.fl_component.FLComponent] | None = None)[source]
Bases:
RunManagerManage run.
- Parameters:
server_name – server name
engine (ServerEngineSpec) – server engine
job_id – job id
workspace (Workspace) – workspace
components (dict) – A dict of extra python objects {id: object}
client_manager (ClientManager, optional) – client manager
handlers (List[FLComponent], optional) – handlers
- class SimulatorServer(project_name=None, min_num_clients=2, max_num_clients=10, cmd_modules=None, heart_beat_timeout=600, handlers: List[FLComponent] | None = None, args=None, secure_train=False, enable_byoc=False, snapshot_persistor=None)[source]
Bases:
FederatedServerFederated server services.
- Parameters:
project_name – server project name.
min_num_clients – minimum number of contributors at each round.
max_num_clients – maximum number of contributors at each round.
cmd_modules – command modules.
heart_beat_timeout – heartbeat timeout
handlers – A list of handler
args – arguments
secure_train – whether to use secure communication
- class SimulatorServerEngine(server, args, client_manager: ClientManager, snapshot_persistor, workers=3)[source]
Bases:
ServerEngineServer engine.
- Parameters:
server – server
args – arguments
client_manager (ClientManager) – client manager.
workers – number of worker threads.
- multicast_aux_requests(topic: str, target_requests: Dict[str, Shareable], timeout: float, fl_ctx: FLContext, optional: bool = False, secure: bool = False) dict[source]
Send requests to specified clients via the aux channel.
Implementation: simply calls the AuxRunner’s multicast_aux_requests method.
- Parameters:
topic – topic of the request
target_requests – requests of the target clients. Different target can have different request.
timeout – amount of time to wait for responses. 0 means fire and forget.
fl_ctx – FL context
optional – whether this request is optional
secure – whether to send the aux request in P2P secure
Returns: a dict of replies (client name => reply Shareable)
- persist_components(fl_ctx: FLContext, completed: bool)[source]
To persist the FL running components
- Parameters:
fl_ctx – FLContext
completed – flag to indicate where the run is complete
Returns:
- send_aux_request(targets: [], topic: str, request: Shareable, timeout: float, fl_ctx: FLContext, optional=False, secure=False) dict[source]
Send a request to specified clients via the aux channel.
Implementation: simply calls the AuxRunner’s send_aux_request method.
- Parameters:
targets – target clients. None or empty list means all clients.
topic – topic of the request.
request – request to be sent
timeout – number of secs to wait for replies. 0 means fire-and-forget.
fl_ctx – FL context
optional – whether this message is optional
secure – send the aux request in a secure way
Returns: a dict of replies (client name => reply Shareable)