nvflare.private.aux_runner module
- class AuxRunner(engine)[source]
Bases:
FLComponentTo init the AuxRunner.
- dispatch(topic: str, request: Shareable, fl_ctx: FLContext) Shareable[source]
This method is to be called by the Engine when an aux message is received from peer.
Note
peer_ctx props must have been set into the PEER_PROPS header of the request by Engine.
- Parameters:
topic – message topic
request – request message
fl_ctx – FLContext
Returns: reply message
- multicast_aux_requests(topic: str, target_requests: List[Tuple[AuxMsgTarget, Shareable]], timeout: float, fl_ctx: FLContext, optional: bool = False, secure: bool = False) dict[source]
- register_aux_message_handler(topic: str, message_handle_func)[source]
Register aux message handling function with specified topics.
This method should be called by Engine’s register_aux_message_handler method.
- Parameters:
topic – the topic to be handled by the func
message_handle_func – the func to handle the message. Must follow aux_message_handle_func_signature.
Returns: N/A
- Exception is raised when:
a handler is already registered for the topic; bad topic - must be a non-empty string bad message_handle_func - must be callable
- send_aux_request(targets: List[AuxMsgTarget], topic: str, request: Shareable, timeout: float, fl_ctx: FLContext, bulk_send: bool = False, optional: bool = False, secure: bool = False) dict[source]
Send aux request to specified targets.
- Parameters:
targets – a list of AuxMsgTarget(s)
topic – topic of the message
request – the request to be sent
timeout – timeout of the request
fl_ctx – FL context data
bulk_send – whether to bulk send
optional – whether the request is optional
secure – whether to use P2P message encryption
Returns: a dict of target_name => reply
Note: each AuxMsgTarget in “targets” has the target’s name and FQCN. The returned dict is keyed on the client Name, not client FQCN (which can be multiple levels).