nvflare.app_opt.p2p.executors.base_dist_opt_executor module

class BaseDistOptExecutor[source]

Bases: Executor, ABC

Base class for peer-to-peer distributed optimization algorithm executors.

This class provides the foundational structure for executors that run P2P distributed optimization algorithms. It handles the configuration of the local network, execution flow based on tasks, and interaction with neighboring clients.

id

Unique identifier for the client.

Type:

int

client_name

Name of the client.

Type:

str

config

Local configuration containing neighbor information.

Type:

LocalConfig

_weight

Weight assigned to the client in the network topology.

Type:

float

neighbors

List of neighboring clients.

Type:

list[Neighbor]

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal)[source]

Executes a task.

Parameters:
  • task_name (str) – task name.

  • shareable (Shareable) – input shareable.

  • fl_ctx (FLContext) – fl context.

  • abort_signal (Signal) – signal to check during execution to determine whether this task is aborted.

Returns:

An output shareable.

handle_event(event_type: str, fl_ctx: FLContext)[source]

Handles events.

Parameters:
  • event_type (str) – event type fired by workflow.

  • fl_ctx (FLContext) – FLContext information.

abstract run_algorithm(fl_ctx: FLContext, shareable: Shareable, abort_signal: Signal)[source]

Abstract method to execute the main P2P algorithm.

Subclasses must implement this method to define the algorithm logic.