nvflare.edge.assessors.device_manager module
- class DeviceManager[source]
Bases:
FLComponent,ABCAbstract base class for device managers in federated learning.
This class defines the interface that all device managers must implement. Device managers are responsible for handling the selection of devices for model training.
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.
- abstract fill_selection(fl_ctx: FLContext) None[source]
Fill the device selection sampled from available devices. update self.current_selection
- Parameters:
current_model_version (int) – Current version of the model
fl_ctx – FLContext object
Returns – none
- abstract get_active_model_versions(fl_ctx: FLContext) Set[int][source]
Get the active model versions that is associated with the current selection.
- Parameters:
fl_ctx – FLContext object
- Returns:
Set of active model versions
- get_available_devices(fl_ctx: FLContext) Set[str][source]
Get the available devices.
- Parameters:
fl_ctx – FLContext object
- Returns:
Set of available devices
- get_selection(fl_ctx: FLContext) Any[source]
Get the current device selection.
- Parameters:
fl_ctx – FLContext object
- Returns:
Current device selection
- get_used_devices(fl_ctx: FLContext) Set[str][source]
Get the used devices.
- Parameters:
fl_ctx – FLContext object
- Returns:
Set of used devices
- abstract has_enough_devices_and_clients(fl_ctx: FLContext) bool[source]
Check if there are enough devices and clients available to start task distribution.
- Parameters:
fl_ctx – FLContext object
- Returns:
True if there are enough devices and clients to start task distribution, False otherwise
- Return type:
bool
- abstract remove_devices_from_selection(devices: Any, fl_ctx: FLContext) None[source]
Remove devices from the current selection. update self.current_selection
- Parameters:
devices – Set of devices to remove
fl_ctx – FLContext object
Returns – none
- abstract remove_devices_from_used(devices: Any, fl_ctx: FLContext) None[source]
Remove devices from the used device set. update self.used_devices
- Parameters:
devices – Set of devices to remove
fl_ctx – FLContext object
Returns – none