nvflare.edge.updater module

class Updater[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.

end_task(fl_ctx: FLContext)[source]

This is called by HUG at the end of the task.

Parameters:

fl_ctx – FLContext object

Returns: None

get_current_state(fl_ctx: FLContext) Any[source]

Get the current state of the updater, which will be used as the value of the “task” in TaskInfo for edge devices.

Parameters:

fl_ctx – FLContext object

Returns: the current state of the updater

abstract prepare_update_for_parent(fl_ctx: FLContext) Shareable | None[source]

This is called by HUG to prepare update report to be sent to the parent.

Parameters:

fl_ctx – FLContext object

Returns: a Shareable object for the update report; or None if no update

abstract process_child_update(update: ~nvflare.apis.shareable.Shareable, fl_ctx: ~nvflare.apis.fl_context.FLContext) -> (<class 'bool'>, typing.Optional[nvflare.apis.shareable.Shareable])[source]

This is called by HUG to process an update report from a child.

Parameters:
  • update – the update report from the child

  • fl_ctx – FLContext object

Returns: a tuple of (whether the update is accepted, reply to the child)

abstract process_parent_update_reply(reply: Shareable, fl_ctx: FLContext)[source]

This is called by HUG to process the reply received from the parent for the update report sent to it. The reply typically contains information for how to update the current state of this Updater.

Parameters:
  • reply – the reply from the parent

  • fl_ctx – FLContext object

Returns: None

start_task(task_data: Shareable, fl_ctx: FLContext) Any[source]

This is called by HUG at the start of a task.

Parameters:
  • task_data – the task received from parent

  • fl_ctx – FLContext object

Returns: initialized task data