nvflare.private.fed.client.client_run_manager module

class ClientRunInfo(job_id)[source]

Bases: object

To init the ClientRunInfo.

Parameters

job_id – job id

class ClientRunManager(client_name: str, job_id: str, workspace: Workspace, client: FederatedClient, components: Dict[str, FLComponent], handlers: Optional[List[FLComponent]] = None, conf: Optional[ClientJsonConfigurator] = None)[source]

Bases: ClientEngineExecutorSpec

ClientRunManager provides the ClientEngine APIs implementation running in the child process.

To init the ClientRunManager.

Parameters
  • client_name – client name

  • job_id – job id

  • workspace – workspacee

  • client – FL client object

  • components – available FL components

  • handlers – available handlers

  • conf – ClientJsonConfigurator object

abort_app(job_id: str, fl_ctx: FLContext)[source]

Abort the running FL App on the client.

Parameters
  • job_id – current_job_id

  • fl_ctx – FLContext

add_handler(handler: FLComponent)[source]
aux_send(topic: str, request: Shareable, timeout: float, fl_ctx: FLContext) Shareable[source]

Send the request to the Server.

If reply is received, make sure to set peer_ctx into the reply shareable!

Parameters
  • topic – topic of the request

  • request – request Shareable to be sent

  • timeout – number of secs to wait for reply. 0 means fire-and-forget.

  • fl_ctx – fl context

Returns: a reply.

build_component(config_dict)[source]

Build a component from the config_dict.

Parameters

config_dict – config dict

dispatch(topic: str, request: Shareable, fl_ctx: FLContext) Shareable[source]
fire_and_forget_aux_request(topic: str, request: Shareable, fl_ctx: FLContext) Shareable[source]

Send an async request to Server via the aux channel.

Parameters
  • topic – topic of the request

  • request – request to be sent

  • fl_ctx – FL context

Returns:

fire_event(event_type: str, fl_ctx: FLContext)[source]
get_all_components() dict[source]
get_component(component_id: str) object[source]
get_run_info() ClientRunInfo[source]
get_task_assignment(fl_ctx: FLContext) TaskAssignment[source]
get_widget(widget_id: str) Widget[source]
get_workspace() Workspace[source]
new_context() FLContext[source]
register_aux_message_handler(topic: str, message_handle_func)[source]

Register aux message handling function with specified topics.

Exception is raised when:

a handler is already registered for the topic; bad topic - must be a non-empty string bad message_handle_func - must be callable

Implementation Note: This method should simply call the ClientAuxRunner’s register_aux_message_handler method.

Parameters
  • topic – the topic to be handled by the func

  • message_handle_func – the func to handle the message. Must follow aux_message_handle_func_signature.

reset_errors() ClientRunInfo[source]
send_aux_request(topic: str, request: Shareable, timeout: float, fl_ctx: FLContext) Shareable[source]

Send a request to Server via the aux channel.

Implementation: simply calls the ClientAuxRunner’s send_aux_request method.

Parameters
  • topic – topic of the request

  • request – request to be sent

  • timeout – number of secs to wait for replies. 0 means fire-and-forget.

  • fl_ctx – FL context

Returns: a reply Shareable

send_task_result(result: Shareable, fl_ctx: FLContext) bool[source]
show_errors() ClientRunInfo[source]