nvflare.app_common.tie.applet module

class Applet[source]

Bases: ABC, FLComponent

An Applet implements App (server or client) processing logic.

initialize(fl_ctx: FLContext)[source]

Called by Controller/Executor to initialize the applet. This happens when the job is about to start.

Parameters:

fl_ctx – FL context

Returns: None

abstract 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.

abstract start(app_ctx: dict)[source]

Called to start the execution of the applet.

Parameters:

app_ctx – the contextual info to help the applet execution

Returns: None

abstract stop(timeout=0.0) int[source]

Called to stop the applet.

Parameters:

timeout – the max amount of time (seconds) to stop the applet

Returns: the exit code after stopped