nvflare.app_common.executors.multi_process_executor module

class MultiProcessExecutor(executor_id=None, num_of_processes=1, components=None)[source]

Bases: Executor

Manage the multi-process execution life cycle.

Parameters:
  • executor_id – executor component ID

  • num_of_processes – number of processes to create

  • components – a dictionary for component classes to their arguments

execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]

Executes a task.

Parameters:
  • task_name (str) – task name.

  • shareable (Shareable) – input shareable.

  • fl_ctx (FLContext) – fl context.

  • abort_signal (Signal) – signal to check during execution to determine whether this task is aborted.

Returns:

An output shareable.

finalize(fl_ctx: FLContext)[source]

This is called when exiting/aborting the executor.

abstract get_multi_process_command() str[source]

Provide the command for starting multi-process execution.

Returns:

multi-process starting command

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.

initialize(fl_ctx: FLContext)[source]
receive_execute_result(request: Message) Message[source]
class WorkerComponentBuilder[source]

Bases: ComponentBuilder

Component to build workers.

FL_MODULES = ['client', 'app']
FL_PACKAGES = ['nvflare']
get_module_scanner()[source]

Provide the package module scanner.

Returns: module_scanner