nvflare.private.fed.cmi module

class CellMessageInterface(engine)[source]

Bases: FLComponent, ABC

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

HEADER_CLIENT_NAME = 'cmi.client_name'
HEADER_CLIENT_TOKEN = 'cmi.client_token'
HEADER_JOB_ID = 'cmi.job_id'
HEADER_KEY_PEER_PROPS = 'cmi.peer_props'
HEADER_PROJECT_NAME = 'cmi.project'
HEADER_SSID = 'cmi.ssid'
PROP_KEY_CLIENT = 'cmi.client'
PROP_KEY_FL_CTX = 'cmi.fl_ctx'
PROP_KEY_PEER_CTX = 'cmi.peer_ctx'
RC_TABLE = {'abort_run': 'abort_run', 'authentication_error': 'unauthenticated', 'comm_error': 'COMMUNICATION_ERROR', 'invalid_request': 'invalid_request', 'invalid_session': 'invalid_session', 'process_exception': 'EXECUTION_EXCEPTION', 'service_unavailable': 'service_unavailable', 'timeout': 'COMMUNICATION_ERROR'}
new_cmi_message(fl_ctx: FLContext, headers=None, payload=None)[source]
abstract send_to_cell(targets: [], channel: str, topic: str, request: Shareable, timeout: float, fl_ctx: FLContext, bulk_send=False) dict[source]
class JobCellMessenger(engine, job_id: str)[source]

Bases: CellMessageInterface

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

send_to_cell(targets: [], channel: str, topic: str, request: Shareable, timeout: float, fl_ctx: FLContext, bulk_send=False, optional=False) dict[source]

Send request to the job cells of other target sites. :param targets: list of client names that the request will be sent to :type targets: list :param channel: channel of the request :type channel: str :param topic: topic of the request :type topic: str :param request: request :type request: Shareable :param timeout: how long to wait for result. 0 means fire-and-forget :type timeout: float :param fl_ctx: the FL context :type fl_ctx: FLContext :param bulk_send: whether to bulk send this request (only applies in the fire-and-forget situation) :param optional: whether the request is optional

Returns:

A dict of Shareables