nvflare.app_common.executors.learner_executor module

class LearnerExecutor(learner_id, train_task='train', submit_model_task='submit_model', validate_task='validate')[source]

Bases: Executor

Key component to run learner on clients.

Parameters:
  • learner_id (str) – id of the learner object

  • train_task (str, optional) – task name for train. Defaults to AppConstants.TASK_TRAIN.

  • submit_model_task (str, optional) – task name for submit model. Defaults to AppConstants.TASK_SUBMIT_MODEL.

  • validate_task (str, optional) – task name for validation. Defaults to AppConstants.TASK_VALIDATION.

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]
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]
submit_model(shareable: Shareable, fl_ctx: FLContext) Shareable[source]
train(shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]
validate(shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]