nvflare.private.fed.server.server_commands module

FL Admin commands.

class AbortCommand[source]

Bases: CommandProcessor

To implement the abort command.

get_command_name() str[source]

To get the command name.

Returns: AdminCommandNames.ABORT

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: abort command message

class ByeCommand[source]

Bases: CommandProcessor

To implement the ShutdownCommand.

get_command_name() str[source]

To get the command name.

Returns: AdminCommandNames.SHUTDOWN

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the Shutdown command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: Shutdown command message

class CommandProcessor[source]

Bases: ABC

The CommandProcessor is responsible for processing a command from parent process.

abstract get_command_name() str[source]

Gets the command name that this processor will handle.

Returns:

name of the command

abstract process(data: Shareable, fl_ctx: FLContext)[source]

Processes the data.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns:

A reply message

class GetErrorsCommand[source]

Bases: CommandProcessor

To implement the show_errors command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.GET_ERRORS

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: Engine run_info

class GetRunInfoCommand[source]

Bases: CommandProcessor

Implements the GET_RUN_INFO command.

get_command_name() str[source]

Gets the command name that this processor will handle.

Returns:

name of the command

process(data: Shareable, fl_ctx: FLContext)[source]

Processes the data.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns:

A reply message

class GetTaskCommand[source]

Bases: CommandProcessor, ServerStateCheck

To implement the server GetTask command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.GET_TASK

get_state_check(fl_ctx: FLContext) dict[source]

Get the state check data for the server command.

Parameters:

fl_ctx – FLContext

Returns: server state check dict data

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: task data

class HandleDeadJobCommand[source]

Bases: CommandProcessor

To implement the server HandleDeadJob command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.SUBMIT_UPDATE

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the HandleDeadJob command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns:

class HeartbeatCommand[source]

Bases: CommandProcessor

To implement the HEARTBEATCommand.

get_command_name() str[source]

To get the command name.

Returns: AdminCommandNames.HEARTBEAT

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the HEARTBEAT command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

class ResetErrorsCommand[source]

Bases: CommandProcessor

To implement the show_errors command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.GET_ERRORS

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

class ServerCommands[source]

Bases: object

AdminCommands contains all the commands for processing the commands from the parent process.

client_request_commands_names = ['get_task', 'submit_update']
commands: List[CommandProcessor] = [<nvflare.private.fed.server.server_commands.AbortCommand object>, <nvflare.private.fed.server.server_commands.ByeCommand object>, <nvflare.private.fed.server.server_commands.GetRunInfoCommand object>, <nvflare.private.fed.server.server_commands.GetTaskCommand object>, <nvflare.private.fed.server.server_commands.SubmitUpdateCommand object>, <nvflare.private.fed.server.server_commands.HandleDeadJobCommand object>, <nvflare.private.fed.server.server_commands.ShowStatsCommand object>, <nvflare.private.fed.server.server_commands.GetErrorsCommand object>, <nvflare.private.fed.server.server_commands.ResetErrorsCommand object>, <nvflare.private.fed.server.server_commands.HeartbeatCommand object>, <nvflare.private.fed.server.server_commands.ServerStateCommand object>]
static get_command(command_name)[source]

Call to return the AdminCommand object.

Parameters:

command_name – AdminCommand name

Returns: AdminCommand object

static register_command(command_processor: CommandProcessor)[source]

Call to register the AdminCommand processor.

Parameters:

command_processor – AdminCommand processor

class ServerStateCheck[source]

Bases: ABC

Server command requires the server state check

abstract get_state_check(fl_ctx: FLContext) dict[source]

Get the state check data for the server command.

Parameters:

fl_ctx – FLContext

Returns: server state check dict data

class ServerStateCommand[source]

Bases: CommandProcessor

To implement the ServerStateCommand.

get_command_name() str[source]

To get the command name.

Returns: AdminCommandNames.SERVER_STATE

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the SERVER_STATE command.

Parameters:
  • data – ServerState object

  • fl_ctx – FLContext

class ShowStatsCommand[source]

Bases: CommandProcessor

To implement the show_stats command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.SHOW_STATS

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: Engine run_info

class SubmitUpdateCommand[source]

Bases: CommandProcessor, ServerStateCheck

To implement the server GetTask command.

get_command_name() str[source]

To get the command name.

Returns: ServerCommandNames.SUBMIT_UPDATE

get_state_check(fl_ctx: FLContext) dict[source]

Get the state check data for the server command.

Parameters:

fl_ctx – FLContext

Returns: server state check dict data

process(data: Shareable, fl_ctx: FLContext)[source]

Called to process the abort command.

Parameters:
  • data – process data

  • fl_ctx – FLContext

Returns: