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: List[Filter] | None = None, handlers: List[FLComponent] | None = None, compression=None, overseer_agent=None, args=None, components=None, cell: Cell | None = 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

  • cell – CellNet communicator

client_register(project_name, fl_ctx: FLContext)[source]

Register the client to the FL server.

Parameters:
  • project_name – FL study project name.

  • register_data – customer defined client register data (in a dict)

  • fl_ctx – FLContext

close()[source]

Quit the remote federated server, close the local session.

fetch_execute_task(project_name, fl_ctx: FLContext, timeout=None)[source]

Fetch a task from the server.

Parameters:
  • project_name – FL study project name

  • fl_ctx – FLContext

  • timeout – timeout for the getTask message sent tp server

Returns:

A CurrentTask message from server

heartbeat(interval)[source]

Sends a heartbeat from the client to the server.

logout_client(fl_ctx: FLContext)[source]

Logout the client from the server.

Parameters:

fl_ctx – FLContext

Returns: N/A

overseer_callback(overseer_agent)[source]
pull_task(fl_ctx: FLContext, timeout=None)[source]

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

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

Submit execution results of a task to server.

Parameters:
  • project_name – FL study project name

  • shareable – Shareable object

  • fl_ctx – FLContext

  • timeout – how long to wait for reply from server

Returns:

A FederatedSummary message from the server.

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

Push the local model to multiple servers.

quit_remote(project_name, fl_ctx: FLContext)[source]

Sending the last message to the server before leaving.

Parameters:

fl_ctx – FLContext

Returns: N/A

register(fl_ctx: FLContext)[source]

Push the local model to multiple servers.

run_heartbeat(interval)[source]

Periodically runs the heartbeat.

send_heartbeat(project_name, interval)[source]
set_client_engine(engine)[source]
set_client_runner(client_runner)[source]
set_primary_sp(sp)[source]
set_sp(project_name, sp: SP)[source]
start_heartbeat(interval=30)[source]
start_overseer_agent()[source]
stop_cell()[source]

Stop the cell communication

terminate()[source]

Terminating the local client session.