This demo shows aCollaborative Learning Scenario and the AML-IP nodes involved:Model Manager Receiver Node andModel Manager Sender Node. With these 2 nodes implemented, the user can deploy as many nodes of each kind as desired and check the behavior of a simulated AML-IP network running. They are implemented in Python to prove the communication between the two implementations.
Background
The purpose of the demo is to show how a Sender and a Receiver node can communicate. The Receiver node awaits model statistics from the Sender. Since the Sender doesn’t have a real AML Engine, it sends the model statistics as a string. Upon receiving the statistics, the Receiver sends a model request, also as a string since it doesn’t have an AML Engine. Then, the Sender converts the received model request to uppercase and sends it back as a model reply.
Prerequisites
Before running this demo, ensure that AML-IP is correctly installed using one of the following installation methods:
Building the demo
If the demo package is not compiled, please refer toBuild demos or run the command below.

Once AML-IP packages are installed and built, import the libraries using the following command.

Explaining the demo
In this section, we will delve into the details of the demo and how it works.
Model Manager Receiver Node
This is the Python code for theModel Manager Receiver Node application. It does not use real AML Models, but strings. It is implemented in Python using amlip_pyAPI.
This code can be found here.
The next block includes the Python header files that allow the use of the AML-IP Python API.

Let’s continue explaining the global variables.
DOMAIN_ID variable isolates the execution within a specific domain. Nodes with the same domain ID can communicate with each other.

waiter is a WaitHandler that waits on a boolean value. Whenever this value is True, threads awake. Whenever it is False, threads wait.

The CustomModelListener class listens toModel Statistics Data Type andModel Reply Data Type messages received from aModel Manager Sender Node. This class is supposed to be implemented by the user in order to process the messages received from other nodes in the network.

The main function orchestrates the execution of theModel Manager Receiver Node. It creates an instance of the ModelManagerReceiverNode and starts its execution with the specified listener.

After starting the node, it waits for statistics to arrive from theModel Manager Sender Node.

Then, it requests a model from the Model Manager Sender Node using the received server ID.

Finally, the node stops.

Model Manager Sender Node
This is the Python code for the Model Manager Sender Node application. It does not use real AML Models, but strings. It does not have a real AML Engine but instead the calculation is an upper-case conversion of the string received. It is implemented in Python using amlip_py API.
This code can be found here.
The following block includes the Python header files necessary for using the AML-IP Python API.

Let’s continue explaining the global variables.
DOMAIN_ID isolates the execution within a specific domain. Nodes with the same domain ID can communicate with each other.

waiter is a WaitHandler that waits on a boolean value. Whenever this value is True, threads awake. Whenever it is False, threads wait.

The CustomModelReplier class listens to Model Request Data Type request messages received from a Model Manager Receiver Node. This class is supposed to be implemented by the user in order to process the messages.

The main function orchestrates the execution of the Model Manager Sender Node. It creates an instance of ModelManagerSenderNode.

After starting the node, it publishes statistics using the publish_statistics() function, which fills a Model Statistics Data Type and publishes it.

Then we start the node execution, passing the previously defined CustomModelReplier() class, which is responsible for managing the request received.

Waits for the response model to be sent to the Model Manager Receiver Node.

Finally, it stops and closes the node.

Running the demo
This demo runs the implemented nodes in amlip_demo_nodes/amlip_collaborative_learning_demo.
Run Model Manager Receiver Node
Run the following command:

Run Model Manager Sender Node
Run the following command to answer before closing:

Check the video to see how it works:
By Denisa Alexandru from eProsima.
MORE INFORMATION ABOUT ALMA:
For any questions please contact










This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 952091.