Node Configuration

A Fed-BioMed instance includes 3 types of components: node, network, and researcher. A node provides datasets for experiments and trains models on these datasets. It communicates with the researcher component over MQTT messaging server that is located at the network component. It also uses the network component to download model files that are uploaded by the researcher. At this point, configuring a node means;

  • providing a python environment
  • assigning a unique node id
  • providing information about how it can connect to the network to consume/publish messages from/to researcher.

Environment for Nodes

A node requires a conda environment to be able to run. This environment provides necessary python modules for both the task management part and the model training part. Thanks to Fed-BioMed Node CLI, this conda environment can be created easily.

$ ${FEDBIOMED_DIR}/scripts/configure_conda

The command above creates three different environments including fedbiomed-node. You can see details in installation tutorial. This documentation will focus more on configuration steps.

Note: FEDBIOMED_DIR represents the path of the base Fed-BioMed project directory.

Config Files

Config files are the ini files including the following information.

  • Default parameters:

    • node_id: This is the unique id which identifies the node.
    • uploads_url: The URL string that indicates upload request URL for the model parameters.
  • MQTT Parameters:

    • broker_ip: The IP address for connecting MQTT to consume and publish messages with the researcher
    • port: Connection port for MQTT messaging server
    • keep_alive: Delay in seconds before sending an applicative MQTT ping if there is no MQTT exchange during this period.

An example for a config file is shown below;

[default]
node_id = node_7fd39224-4040-448f-8360-577e2066e2ce
uploads_url = http://localhost:8844/upload/

[mqtt]
broker_ip = localhost
port = 1883
keep_alive = 60

Note: Since Fed-BioMed is currently in development phase, it is better to keep these configuration files as created by the CLI.

Starting Nodes with Config Files

Currently, creating config files is done by the fedbiomed_run script. It automatically creates config files based on default values assigned in the fedbiomed.node.environ. Starting nodes with specific file names creates a new configuration file with those default values. The following command creates a config file and starts the node with the configuration in the created config file.

$ ./scripts/fedbiomed_run node config config-n1.ini start

If you run this command, you can see the config file created in the etc/ directory of the Fed-BioMed project. Each node that runs at the same time should have a different node id. This means that starting another node with the same config file might raise errors in the system. Therefore, when you work on multiple nodes you should start nodes by passing different names to the config argument.

Other processes for listing and adding datasets also follows the same logic. If you want to list or add datasets in the nodes, you need to specify its config file.

$ ./scripts/fedbiomed_run node config config-n1.ini list
$ ./scripts/fedbiomed_run node config config-n1.ini add

Note: This is the process for the local development environment. In the future, when the nodes are located in the remote server there might be extra configuration instructions.