nvflare.app_common.tracking.log_writer module

class LogWriter(event_type: str = 'analytix_log_stats', metrics_sender_id: str | None = None)[source]

Bases: FLComponent, ABC

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.

get_default_metric_data_type() AnalyticsDataType[source]
abstract get_writer_name() LogWriterName[source]
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.

write(tag: str, value, data_type: AnalyticsDataType, global_step: int | None = None, **kwargs)[source]

Writes a record.

Parameters:
  • tag (str) – Tag name

  • value – Value to send

  • data_type (AnalyticsDataType) – Data type of the value being sent

  • global_step (optional, int) – Global step value.

Raises:

TypeError – global_step must be an int