nvflare.apis.fl_snapshot module

class FLSnapshot[source]

Bases: object

FLSnapshot keeps a snapshot of all the current running FL application RunSnapshots.

The format is:

{ job_id: RunSnapshot }

add_snapshot(job_id: str, snapshot: RunSnapshot)[source]

Add the RunSnapshot for job_id to the FLSnapshot.

Parameters:
  • job_id – the job_id

  • snapshot – snapshot of the Run

Returns:

get_snapshot(job_id: str) RunSnapshot[source]

Get the RunSnapshot for job_id to the FLSnapshot.

Parameters:

job_id – the job_id

Returns: Snapshot of the Run

remove_snapshot(job_id: str)[source]

Remove the RunSnapshot of job_id from the FLSnapshot.

Parameters:

job_id – the job_id

Returns:

class RunSnapshot(job_id: str)[source]

Bases: object

RunSnapshot keeps a snapshot of all the FLComponent states.

The format is:

{ component_id: component_state_dict }

get_component_snapshot(component_id: str) dict[source]

Get a state snapshot of a particular FL component.

Parameters:

component_id – Component ID

Returns:

A component state dict.

get_snapshot() dict[source]
set_component_snapshot(component_id: str, component_state: dict)[source]

Set the snapshot of a particular FL component.

Parameters:
  • component_id – Component ID

  • component_state – component state dict