nvflare.app_common.tie.controller module

class TieController(configure_task_name='config', configure_task_timeout=10, start_task_name='start', start_task_timeout=10, job_status_check_interval: float = 2.0, max_client_op_interval: float = 90.0, progress_timeout: float = 3600.0)[source]

Bases: Controller, ABC

Constructor

Parameters:
  • task (start_task_name - name of the start)

  • timeout. (start_task_timeout - time to wait for clients’ responses to the start task before)

  • task

  • timeout.

  • job (job_status_check_interval - how often to check client statuses of the)

  • client (max_client_op_interval - max amount of time allowed between app ops from a)

  • progress. (progress_timeout- the maximum amount of time allowed for the workflow to not make any) – In other words, at least one participating client must have made progress during this time. Otherwise, the workflow will be considered to be in trouble and the job will be aborted.

control_flow(abort_signal: Signal, fl_ctx: FLContext)[source]

To ensure smooth app execution: - ensure that all clients are online and ready to go before starting server - ensure that server is started and ready to take requests before asking clients to start operation - monitor the health of the clients - if anything goes wrong, terminate the job

Parameters:
  • abort_signal – abort signal that is used to notify components to abort

  • fl_ctx – FL context

Returns: None

abstract get_applet(fl_ctx: FLContext) Applet[source]

Called by the TieController to get the Applet to be used with the controller. Subclass of TieController must implement this method.

Parameters:

fl_ctx – FL context

Returns: an Applet object

abstract get_client_config_params(fl_ctx: FLContext) dict[source]

Called by the TieController to get config parameters to be sent to FL clients. Subclass of TieController must implement this method.

Parameters:

fl_ctx – FL context

Returns: a dict of config params

abstract get_connector(fl_ctx: FLContext) Connector[source]

Called by the TieController to get the Connector to be used with the controller. Subclass of TieController must implement this method.

Parameters:

fl_ctx – FL context

Returns: a Connector object

abstract get_connector_config_params(fl_ctx: FLContext) dict[source]

Called by the TieController to get config parameters for configuring the connector. Subclass of TieController must implement this method.

Parameters:

fl_ctx – FL context

Returns: a dict of config params

process_result_of_unknown_task(client: Client, task_name: str, client_task_id: str, result: Shareable, fl_ctx: FLContext)[source]

Process result when no task is found for it.

This is called when a result submission is received from a client, but no standing task can be found for it (from the task queue)

This could happen when: - the client’s submission is too late - the task is already completed - the Controller lost the task, e.g. the Server is restarted

Parameters:
  • client – the client that the result comes from

  • task_name – the name of the task

  • client_task_id – ID of the task

  • result – the result from the client

  • fl_ctx – the FL context that comes with the client’s submission

start_controller(fl_ctx: FLContext)[source]

Start the controller. It first tries to get the connector and applet to be used. It then initializes the applet, set the applet to the connector, and initializes the connector. It finally registers message handlers for APP_REQUEST and CLIENT_DONE. If error occurs in any step, the job is stopped.

Note: if a subclass overwrites this method, it must call super().start_controller()!

Parameters:

fl_ctx – the FL context

Returns: None

stop_controller(fl_ctx: FLContext)[source]

This is called by base controller to stop. If a subclass overwrites this method, it must call super().stop_controller(fl_ctx).

Parameters:

fl_ctx

Returns: