nvflare.app_common.aggregators.lazy module
- class LazyAggregator(aggregator_id: str, accept_timeout: float = 600.0)[source]
Bases:
AggregatorConstructor of LazyAggregator. LazyAggregator is a wrapper for other aggregators to do accept processing in a separate thread.
During a typical SAG-based training, updates from clients are processed by the aggregator’s “accept” method. To ensure the integrity of training task, The SAG workflow processes client updates sequentially. If the “accept” method is time-consuming and there are many clients, then the update processing will become bottleneck.
Using the LazyAggregator, the updates from clients are simply added to a queue quickly. The actual “accept” processing is done in a separate thread that processes the queued updates sequentially.
- Parameters:
aggregator_id – component ID of the real aggregator
accept_timeout – max amount of time to wait for accept to finish
- accept(shareable: Shareable, fl_ctx: FLContext) bool[source]
Accept the shareable submitted by the client.
- Parameters:
shareable – submitted Shareable object
fl_ctx – FLContext
- Returns:
first boolean to indicate if the contribution has been accepted.