nvflare.private.fed.server.admin module
- class FedAdminServer(cell: Cell, fed_admin_interface, cmd_modules, file_upload_dir, file_download_dir, download_job_url='', timeout: float = 10.0)[source]
Bases:
AdminServerThe FedAdminServer is the framework for developing admin commands.
- Parameters:
fed_admin_interface – the server’s federated admin interface
cmd_modules – a list of CommandModules
file_upload_dir – the directory for uploaded files
file_download_dir – the directory for files to be downloaded
download_job_url – download job url
timeout – admin command timeouts
- client_heartbeat(token, name: str, fqcn: str)[source]
Receive client heartbeat.
- Parameters:
token – the session token of the client
name – client name
fqcn – the FQCN of the client
- Returns:
Client.
- send_request_to_client(req: Message, client_token: str, timeout_secs=2.0) ClientReply | None[source]
- send_requests(requests: dict, fl_ctx: FLContext, timeout_secs=2.0, optional=False) [<class 'nvflare.private.fed.server.message_send.ClientReply'>][source]
Send requests to clients.
NOTE:
This method is to be used by a Command Handler to send requests to Clients. Hence, it is run in the Command Handler's handling thread. This is a blocking call - returned only after all responses are received or timeout.
- Parameters:
requests – A dict of requests: {client token: request or list of requests}
fl_ctx – FLContext
timeout_secs – how long to wait for reply before timeout
optional – whether the requests are optional
- Returns:
A list of ClientReply
- send_requests_and_get_reply_dict(requests: dict, timeout_secs=2.0) dict[source]
Send requests to clients
- Parameters:
requests – A dict of requests: {client token: Message}
timeout_secs – how long to wait for reply before timeout
- Returns:
reply}, where reply is a Message or None (no reply received)
- Return type:
A dict of {client token
- check_client_replies(replies: List[ClientReply], client_sites: List[str], command: str, strict: bool = False) List[str][source]
Check client replies for errors.
- Parameters:
replies – list of client replies
client_sites – list of expected client names
command – command description for error messages
strict – if True, detect timed-out clients (reply=None) and return them as a list rather than raising. Explicit errors (non-OK return code or error body) always raise regardless of this flag.
- Returns:
List of client names whose reply was None (timed out). Only populated when strict=True; always empty when strict=False.
- Raises:
RuntimeError – if no replies were received, reply count mismatches, structurally missing replies (strict mode), or any client returned an explicit error.
- new_message(conn: Connection, topic, body, require_authz: bool) Message[source]