nvflare.app_common.tie.cli_applet module

class CLIApplet[source]

Bases: Applet, ABC

Constructor of CLIApplet, which runs the applet as a subprocess started with CLI command.

abstract get_command(app_ctx: dict) CommandDescriptor[source]

Subclass must implement this method to return the CLI command to be executed.

Parameters:

app_ctx – the applet context that contains execution env info

Returns: a CommandDescriptor that describes the CLI command

is_stopped() -> (<class 'bool'>, <class 'int'>)[source]

Called to check whether the applet is already stopped.

Returns: whether the applet is stopped, and the exit code if stopped.

start(app_ctx: dict)[source]

Start the execution of the applet.

Parameters:

app_ctx – the applet run context

Returns:

stop(timeout=0.0) int[source]

Stop the applet

Parameters:

timeout – amount of time to wait for the applet to stop by itself. If the applet does not stop on its own within this time, we’ll forcefully stop it by kill.

Returns: exit code