nvflare.apis.utils.reliable_message module

class ReliableMessage[source]

Bases: object

classmethod debug(fl_ctx: FLContext, msg: str)[source]
classmethod enable(fl_ctx: FLContext)[source]

Enable ReliableMessage. This method can be called multiple times, but only the 1st call has effect.

Parameters:

fl_ctx – FL Context

Returns:

classmethod error(fl_ctx: FLContext, msg: str)[source]
classmethod info(fl_ctx: FLContext, msg: str)[source]
classmethod register_request_handler(topic: str, handler_f)[source]

Register a handler for the reliable message with this topic

Parameters:
  • topic – The topic of the reliable message

  • handler_f – The callback function to handle the request in the form of handler_f(topic, request, fl_ctx)

classmethod send_request(target: str, topic: str, request: Shareable, per_msg_timeout: float, tx_timeout: float, abort_signal: Signal, fl_ctx: FLContext) Shareable[source]

Send a reliable request.

Parameters:
  • target – the target cell of this request

  • topic – topic of the request;

  • request – the request to be sent

  • per_msg_timeout – timeout when sending a message

  • tx_timeout – the timeout of the whole transaction

  • abort_signal – abort signal

  • fl_ctx – the FL context

Returns: reply from the peer.

If tx_timeout is not specified or <= per_msg_timeout, the request will be sent only once without retrying.

classmethod shutdown()[source]

Shutdown ReliableMessage.

Returns: