Messengers to generate communication payloads
The messenger functions are defined in the messengers.py
file, which can be found in the lib/util
folder of the fl_main
directory.
Importing libraries for messengers
In this messengers.py
code example, the file imports general libraries, such as time
and numpy
. It also imports ModelType
, DBMsgType
, AgentMsgType
, and AggMsgType
, which were defined in the Enumeration classes for implementing the FL system section in this chapter:
import time import numpy as np from typing import Dict, List, Any from fl_main.lib.util.states import \ Â Â Â Â ModelType, DBMsgType, AgentMsgType, AggMsgType
Next, let’s move on to the list of functions of the messengers
library.
Functions of messengers
The following is a list of functions related to the messengers
library.
The generate_db_push_message function
The generate_db_push_message
function generates and returns a message for pushing the message containing ML...