nvflare.app_common.widgets.metrics_artifact_writer module

class MetricsArtifactWriter(results_dir: str = 'metrics', summary_file_name: str = 'metrics_summary.json', round_file_name: str = 'round_metrics.jsonl', limits: Dict[str, int] | None = None)[source]

Bases: Widget

Writes safe, machine-readable round and summary metric artifacts.

The writer consumes metrics already produced by workflows/controllers. It records dynamic metric names as values instead of object keys so downstream consumers do not need to treat client-provided names as JSON object structure.

Init the Widget.

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.