nvflare.app_opt.flower.applet module
- class FlowerClientApplet(extra_env: dict | None = None, allow_runtime_dependency_installation: bool = False)[source]
Bases:
CLIAppletConstructor of FlowerClientApplet, which extends CLIApplet.
Note: flower_app_path is not used on clients - the Flower app is distributed from the server via Flower’s FAB mechanism.
- get_command(ctx: dict) CommandDescriptor[source]
Implementation of the get_command method required by the super class CLIApplet. It returns the CLI command for starting Flower’s client app, as well as the full path of the log file for the client app.
- Parameters:
ctx – the applet run context
Returns: CLI command for starting client app and name of log file.
- class FlowerServerApplet(database: str, superlink_ready_timeout: float, superlink_grace_period=1.0, superlink_min_query_interval=10.0, run_config: dict | None = None, allow_runtime_dependency_installation: bool = False, flower_app_path: str | None = None)[source]
Bases:
AppletConstructor of FlowerServerApplet.
- Parameters:
database – database spec to be used by the server app
superlink_ready_timeout – how long to wait for the superlink process to become ready
superlink_grace_period – how long to wait for superlink to gracefully shutdown
superlink_min_query_interval – minimal interval for querying superlink for status
run_config – optional dict for flwr run –run-config arguments
allow_runtime_dependency_installation – whether to allow dynamic dependency installation (flwr>=1.29)
flower_app_path – absolute path to pre-deployed Flower app on the server (clients receive via FAB)
- is_stopped() -> (<class 'bool'>, <class 'int'>)[source]
Check whether the server applet is already stopped
Returns: a tuple of: whether the applet is stopped, exit code if stopped.
Note: if either superlink or server app is stopped, we treat the applet as stopped.
- start(app_ctx: dict)[source]
Start the applet.
- Flower requires two processes for server application:
superlink: this process is responsible for client communication server_app: this process performs server side of training.
We start the superlink first, and wait for it to become ready, then start the server app. Each process will have its own log file in the job’s run dir. The superlink’s log file is named “superlink_log.txt”. The server app’s log file is named “server_app_log.txt”.
- Parameters:
app_ctx – the run context of the applet.
Returns: