nvflare.private.fed.client.fed_client_base module

class FederatedClientBase(client_name, client_args, secure_train, server_args=None, retry_timeout=30, client_state_processors: Optional[List[Filter]] = None, handlers: Optional[List[FLComponent]] = None, compression=None, overseer_agent=None, args=None, components=None)[source]

Bases: object

The client-side base implementation of federated learning.

This class provide the tools function which will be used in both FedClient and FedClientLite.

To init FederatedClientBase.

Parameters
  • client_name – client name

  • client_args – client config args

  • secure_train – True/False to indicate secure train

  • server_args – server config args

  • retry_timeout – retry timeout

  • client_state_processors – client state processor filters

  • handlers – handlers

  • compression – communication compression algorithm

aux_send(topic, shareable: Shareable, timeout: float, fl_ctx: FLContext)[source]

Push the local model to multiple servers.

check_progress(remote_tasks)[source]
client_register(project_name)[source]

Register the client to the FL server.

Parameters

project_name – FL study project name.

close()[source]

Quit the remote federated server, close the local session.

fetch_execute_task(project_name, fl_ctx: FLContext)[source]

Fetch a task from the server.

Parameters
  • project_name – FL study project name

  • fl_ctx – FLContext

Returns

A CurrentTask message from server

heartbeat()[source]

Sends a heartbeat from the client to the server.

overseer_callback(overseer_agent)[source]
pull_task(fl_ctx: FLContext)[source]

Fetch remote models and update the local client’s session.

push_execute_result(project_name, shareable: Shareable, fl_ctx: FLContext)[source]

Submit execution results of a task to server.

Parameters
  • project_name – FL study project name

  • shareable – Shareable object

  • fl_ctx – FLContext

Returns

A FederatedSummary message from the server.

push_results(shareable: Shareable, fl_ctx: FLContext)[source]

Push the local model to multiple servers.

quit_remote(task_name, fl_ctx: FLContext)[source]

Sending the last message to the server before leaving.

Parameters
  • task_name – task name

  • fl_ctx – FLContext

Returns: N/A

register()[source]

Push the local model to multiple servers.

run_heartbeat()[source]

Periodically runs the heartbeat.

send_aux_message(project_name, topic: str, shareable: Shareable, timeout: float, fl_ctx: FLContext)[source]

Send auxiliary message to the server.

Parameters
  • project_name – FL study project name

  • topic – aux topic name

  • shareable – Shareable object

  • timeout – communication timeout

  • fl_ctx – FLContext

Returns

A reply message

send_heartbeat(project_name)[source]
set_client_engine(engine)[source]
set_primary_sp(sp)[source]
set_sp(project_name, sp: SP)[source]
start_heartbeat()[source]