nvflare.apis.impl.any_relay_manager module

class AnyRelayTaskManager(task: Task, task_result_timeout, dynamic_targets)[source]

Bases: TaskManager

Task manager for relay controller on SendOrder.ANY.

Parameters:
  • task (Task) – an instance of Task

  • task_result_timeout (int) – timeout value on reply of one client

  • dynamic_targets (bool) – allow clients to join after this task starts

check_task_exit(task: Task) Tuple[bool, TaskCompletionStatus][source]

Determine whether the task should exit.

Parameters:

task (Task) – an instance of Task

Returns:

first entry in the tuple means whether to exit the task or not. If it’s True, the task should exit. second entry in the tuple indicates the TaskCompletionStatus.

Return type:

Tuple[bool, TaskCompletionStatus]

check_task_result(result: Shareable, client_task: ClientTask, fl_ctx: FLContext)[source]

Check the result received from the client.

See whether the client_task is the last one in the task’s list If not, then it is a late response and ReservedHeaderKey.REPLY_IS_LATE is set to True in result’s header.

Parameters:
  • result (Shareable) – an instance of Shareable

  • client_task (ClientTask) – the task processing state of the client

  • fl_ctx (FLContext) – fl context that comes with the task request

check_task_send(client_task: ClientTask, fl_ctx: FLContext) TaskCheckStatus[source]

Determine whether the task should be sent to the client.

Parameters:
  • client_task (ClientTask) – the task processing state of the client

  • fl_ctx (FLContext) – fl context that comes with the task request

Raises:

RuntimeError – when a client asking for a task while the same client_task has already been dispatched to it

Returns:

NO_BLOCK for not sending the task, BLOCK for waiting, SEND for OK to send

Return type:

TaskCheckStatus