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.
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging from nvflare.apis.utils.fl_context_utils import generate_log_message from nvflare.security.logging import secure_format_traceback from .analytix import AnalyticsData, AnalyticsDataType from .event_type import EventType
FLComponent is automatically added as an event handler in the system when a new instance is created.
You can implement the
handle_event to plugin additional customized actions to the FL workflows.
To fire events,
fire_event can be used, and
fire_fed_event can be used to
fire an event across participants.
The logging methods
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,
be called to end the task, or
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
You can also define the structure of
Sharable objects that fits your needs and
add your training associated data into