nvflare.fuel.f3.cellnet.utils module

buffer_len(buffer: Any)[source]
decode_payload(message: Message, encoding_key='cn__payload_encoding')[source]
encode_payload(message: Message, encoding_key='cn__payload_encoding') int[source]

Encode the payload of the specified message.

Parameters:
  • message – the message to be encoded

  • encoding_key – the key name of the encoding property in the message header. If the encoding property is not

  • header (set in the message)

  • is (then it means that the message payload has not been encoded. If the property)

  • set (already)

  • encoded (then the message payload is already)

  • done. (and no processing is)

  • needed (If encoding is)

  • payload (we will determine the encoding scheme based on the data type of the)

  • None (- If the payload is)

  • NONE (encoding scheme is)

  • bytes (- If the payload data type is like)

  • BYTES (encoding scheme is)

  • Otherwise (-)

  • FOBS (encoding scheme is)

  • FOBS. (and the payload is serialized with)

Returns: the encoded payload size.

format_log_message(fqcn: str, message: Message, log: str) str[source]
format_size(size, binary=False)[source]

Format size in human-readable formats like KB, MB, KiB, MiB

Parameters:
  • size – Size in bytes

  • binary – If binary, one K is 1024 bytes, otherwise 1000 bytes.

Returns: Size in human-readable format (like 10MB, 100.2GiB etc)

get_msg_header_value(m, k)[source]
make_reply(rc: str, error: str = '', body=None) Message[source]
new_cell_message(headers: dict, payload=None)[source]
shorten_fqcn(fqcn)[source]
shorten_string(string)[source]