Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.6 KB

fl_component.rst

File metadata and controls

32 lines (23 loc) · 1.6 KB

FLComponent

nvflare.apis.fl_component.FLComponent

nvflare.apis.fl_component.FLComponent is the base class of all the FL components. Executors, controllers, filters, aggregators, and their subtypes for example trainer are all FLComponents now.

../../nvflare/apis/fl_component.py

Each FLComponent is automatically added as an event handler in the system when a new instance is created. You can implement the handle_event<handle_event> to plugin additional customized actions to the FL workflows.

To fire events, fire_event<fire_event> can be used, and fire_fed_event<fire_fed_event> can be used to fire an event across participants.

The logging methods log_debug<log_debug>, log_info<log_info>, log_warning<log_warning>, log_error<log_error>, and log_exception<log_exception> should be used to prefix log messages with contextual information and integrate with other system features.

In extreme cases where the system encounters errors that prevent further operation, task_panic<task_panic> can be called to end the task, or system_panic<system_panic> can be called to end the run.

Default data in the built-in FLComponents

For the built-in FLComponents provided by NVIDIA FLARE, we assure the following data is set in the Shareable and FLContext.

You can also define the structure of Sharable objects that fits your needs and add your training associated data into FLContext.