nvflare.app_common.executors.ipc_exchanger module

class IPCExchanger(send_task_timeout=5.0, resend_task_interval=2.0, agent_connection_timeout=60.0, agent_heartbeat_timeout=None, agent_heartbeat_interval=5.0, agent_ack_timeout=5.0, agent_id=None)[source]

Bases: Executor

Constructor of IPCExchanger

Parameters:
  • send_task_timeout – when sending task to Agent, how long to wait for response

  • resend_task_interval – when failed to send task to agent, how often to resend

  • agent_heartbeat_timeout – time allowed to miss heartbeat ack from agent before stopping

  • agent_connection_timeout – time allowed to miss heartbeat ack from agent for considering it disconnected

  • agent_heartbeat_interval – how often to send heartbeats to the agent

  • agent_ack_timeout – how long to wait for agent ack (for heartbeat and bye messages)

  • agent_id – the unique ID of the agent. If not specified, will get it from job’s meta

execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]

Executes a task.

Parameters:
  • task_name (str) – task name.

  • shareable (Shareable) – input shareable.

  • fl_ctx (FLContext) – fl context.

  • abort_signal (Signal) – signal to check during execution to determine whether this task is aborted.

Returns:

An output shareable.

handle_event(event_type: str, fl_ctx: FLContext)[source]

Handles events.

Parameters:
  • event_type (str) – event type fired by workflow.

  • fl_ctx (FLContext) – FLContext information.