nvflare.private.fed.simulator.simulator_server module

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: RunManager

Manage 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

create_job_processing_context_properties(workspace, job_id)[source]
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, overseer_agent=None)[source]

Bases: FederatedServer

Federated 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

create_run_manager(workspace, job_id)[source]
deploy(args, grpc_args=None, secure_train=False)[source]

Start a grpc server and listening the designated port.

remove_dead_clients()[source]
stop_training()[source]
class SimulatorServerEngine(server, args, client_manager: ClientManager, snapshot_persistor, workers=3)[source]

Bases: ServerEngine

Server engine.

Parameters:
  • server – server

  • args – arguments

  • client_manager (ClientManager) – client manager.

  • workers – number of worker threads.

parent_aux_send(targets: [], topic: str, request: Shareable, timeout: float, fl_ctx: FLContext) dict[source]
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:

sync_clients_from_main_process()[source]

To fetch the participating clients from the main parent process

Returns: clients