nvflare.app_common.abstract.response_processor module

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

abstract create_task_data(task_name: str, fl_ctx: FLContext) Shareable[source]

Create the task data for the process request to clients This method is called at the beginning of the ResponseProcessor controller, e.g., in BroadcastAndProcess. The internal state of the processor should be reset here, if the processor is used multiple times.

Parameters:
  • task_name – name of the task

  • fl_ctx – FL context

Returns: task data as a shareable

abstract final_process(fl_ctx: FLContext) bool[source]

Perform the final process. This method is called after received responses from all clients.

Parameters:

fl_ctx – FLContext

Returns:

boolean indicating whether the final response processing is successful. If not successful, the control flow will exit.

abstract process_client_response(client: Client, task_name: str, response: Shareable, fl_ctx: FLContext) bool[source]

Processes the response submitted by a client. This method is called every time a response is received from a client.

Parameters:
  • client – the client that submitted response

  • task_name – name of the task that the response corresponds to

  • response – client submitted response

  • fl_ctx – FLContext

Returns:

boolean to indicate if the client data is acceptable. If not acceptable, the control flow will exit.