nvflare.private.fed.server.admin module

class FedAdminServer(cell: Cell, fed_admin_interface, users, cmd_modules, file_upload_dir, file_download_dir, host, port, ca_cert_file_name, server_cert_file_name, server_key_file_name, accepted_client_cns=None, download_job_url='')[source]

Bases: AdminServer

The FedAdminServer is the framework for developing admin commands.

Parameters:
  • fed_admin_interface – the server’s federated admin interface

  • users – a dict of {username: pwd hash}

  • cmd_modules – a list of CommandModules

  • file_upload_dir – the directory for uploaded files

  • file_download_dir – the directory for files to be downloaded

  • host – the IP address of the admin server

  • port – port number of admin server

  • ca_cert_file_name – the root CA’s cert file name

  • server_cert_file_name – server’s cert, signed by the CA

  • server_key_file_name – server’s private key file

  • accepted_client_cns – list of accepted Common Names from client, if specified

  • download_job_url – download job url

client_dead(token)[source]

Remove dead client.

Parameters:

token – the session token of the client

client_heartbeat(token, name: str)[source]

Receive client heartbeat.

Parameters:
  • token – the session token of the client

  • name – client name

Returns:

Client.

get_client_tokens() [][source]

Get tokens of existing clients.

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

stop()[source]
check_client_replies(replies: List[ClientReply], client_sites: List[str], command: str)[source]
new_message(conn: Connection, topic, body, require_authz: bool) Message[source]