nvflare.app_opt.p2p.executors.sync_executor module

class SyncAlgorithmExecutor(sync_timeout: int = 10)[source]

Bases: BaseDistOptExecutor

An executor to implement synchronous peer-to-peer (P2P) algorithms.

This executor extends the BaseP2PAlgorithmExecutor to support synchronous execution of P2P algorithms. It manages the exchange of values with neighboring clients and ensures synchronization at each iteration.

Parameters:

sync_timeout (int) – The timeout for waiting for values from neighbors. Defaults to 10 seconds.

neighbors_values

A dictionary to store values received from neighbors, keyed by iteration and neighbor ID.

Type:

defaultdict

sync_waiter

An event to synchronize the exchange of values.

Type:

threading.Event

lock

A lock to manage concurrent access to shared data structures.

Type:

threading.Lock

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.

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.