nvflare.private.fed.server.server_engine_internal_spec module

class EngineInfo[source]

Bases: object

Engine information.

class ServerEngineInternalSpec[source]

Bases: ServerEngineSpec, ABC

abstract abort_app_on_clients(clients: [<class 'str'>])[source]

Abort the application on the specified clients.

abstract abort_app_on_server(job_id: str)[source]

Abort the application on the server.

abstract ask_to_stop()[source]

Ask the engine to stop the current run.

abstract aux_send(targets: [], topic: str, request: Shareable, timeout: float, fl_ctx: FLContext) dict[source]

Send a request to client(s) via the auxiliary channel.

Parameters
  • targets – list of Client or client names

  • topic – topic of the request

  • request – request to be sent

  • timeout – number of secs to wait for replies

  • fl_ctx – FL context

Returns

client_name => Shareable

Return type

A dict of replies

NOTE: when a reply is received, the peer_ctx props must be set into the PEER_PROPS header of the reply Shareable.

If a reply is not received from a client, do not put it into the reply dict.

abstract build_component(config_dict)[source]

Build a component from the config_dict.

Parameters

config_dict – configuration.

abstract check_app_start_readiness(job_id: str) str[source]

Check whether the app is ready to start.

Returns

An error message. An empty string if successful.

abstract delete_job_id(job_id: str) str[source]

Delete specified RUN.

The Engine must do status check before the run can be deleted. :param job_id: job id

Returns

An error message. An empty string if successful.

abstract deploy_app_to_server(job_id: str, app_name: str, app_staging_path: str) str[source]

Deploy the specified app to the server.

Copy the app folder tree from staging area to the server’s RUN area

Parameters
  • job_id – job id of the app to be deployed

  • app_name – name of the app to be deployed

  • app_staging_path – the full path to the app folder in staging area

Returns

An error message. An empty string if successful.

abstract get_app_data(app_name: str) -> (<class 'str'>, <class 'object'>)[source]

Get data for deploying the app.

Parameters

app_name – name of the app

Returns

An error message. An empty string if successful.

abstract get_app_run_info(job_id) RunInfo[source]

Get the app RunInfo from the child process.

Returns

App RunInfo

abstract get_client_from_name(client_name: str) Client[source]

Get the registered client token from client_name.

Parameters

client_name – client name

Returns: registered client

abstract get_client_name_from_token(token: str) str[source]

Get the registered client name from communication token.

Parameters

token – communication token

Returns

Client name

get_engine_info() EngineInfo[source]

Get general info of the engine.

abstract get_errors(job_id)[source]

Get the errors of the server components.

Parameters

job_id – current job_id

Returns

Server components errors.

abstract get_job_clients(client_sites) {}[source]

To get the participating clients for the job

Parameters

client_sites – clients with the dispatching info

Returns:

get_run_info() RunInfo[source]
abstract get_staging_path_of_app(app_name: str) str[source]

Get the staging path of the app waiting to be deployed.

Parameters

app_name (str) – application name

Returns

The app’s folder path or empty string if the app doesn’t exist

abstract remove_clients(clients: [<class 'str'>]) str[source]

Remove specified clients.

Parameters

clients – clients to be removed

Returns

An error message. An empty string if successful.

abstract restart_server() str[source]

Restart the server.

The engine should not exit right away. See shutdown_server.

Returns

An error message. An empty string if successful.

abstract set_configurator(conf: ServerJsonConfigurator)[source]

Set the configurator for server.

Parameters

conf – A ServerJsonConfigurator object

abstract set_job_runner(job_runner: JobRunner, job_manager: JobDefManagerSpec)[source]

Set the JobRunner for server.

Parameters
  • job_runner – A JobRunner object

  • job_manager – A JobDefManagerSpec object

abstract set_run_manager(run_manager: RunManager)[source]

Set the RunManager for server.

Parameters

run_manager – A RunManager object

abstract show_stats(job_id)[source]

Show_stats of the server.

Parameters

job_id – current job_id

Returns

Component stats of the server

abstract shutdown_server() str[source]

Shutdown the server.

The engine should not exit right away. It should set its status to STOPPING, and set up a timer (in a different thread), and return from this call right away (if other restart conditions are met). When the timer fires, it exits. This would give the caller to process the feedback or clean up (e.g. admin cmd response).

Returns

An error message. An empty string if successful.

abstract start_app_on_server(job_idber: str, job_id: Optional[str] = None, job_clients=None, snapshot=None) str[source]

Start the FL app on Server.

Returns

An error message. An empty string if successful.