How to enable Flower federated learning in Workspaces (BETA)
What is Flower?
Flower is a framework for running federated learning tasks across a network. It has three main components:
- A CLI tool for managing the network
- SuperLink the network aggregator which manages federated tasks across multiple nodes
- SuperNode the deployed node software that runs the FL task on the remote data
Users of the Aridhia DRE can now provision a Flower network inside their hub. The Flower CLI is already integrated with Worksapces, this article explains how a workspace user can create SuperLinks and SuperNodes inside workspaces and then connect these to form a federated network.
Creating a SuperLink app in a workspace:
-
Login to workspace and create a new R Web App. Give the app a clear name e.g. SuperLink App. Leave default selected fields and click Create R Web App.

-
Go to Workspace Files ->your R-Web-App folder. You should see
.version, in the folder -
Open
.versionfile , delete everything there and update file with43604069-832b-4d5e-9a97-d78cb5f5d7b7/ttyd-terminaland save it. -
Go to Workspace Files ->your R-Web-App folder. You should see
app.Rin the folder. Deleteapp.Rand create a new file calledapp. -
Open
appas a text file and add content below.
superlink example:
#!/bin/bash
flower-superlink --ssl-ca-certfile path-to-ca.crt --ssl-certfile path-to-server.pem --ssl-keyfile path-to-server.key --control-api-address 0.0.0.0:8080
Example of SuperLink App:
#!/bin/bash
flower-superlink --ssl-ca-certfile /home/workspace/files/cert/certificates/ca.crt --ssl-certfile /home/workspace/files/cert/certificates/server.pem --ssl-keyfile /home/workspace/files/cert/certificates/server.key --control-api-address 0.0.0.0:8080#flower-superlink --insecure --control-api-address 0.0.0.0:8080
Tip: Some times if you are using copy/paste the R Web App gives error as its reading some non Unix characters in the app file. To fix this you can vi the app file in you Terminal App and do :set ff=unix and save the file and re run the R web App
How to Generate Certificate for superlink:
Superlink needs to run in TLS mode. Flower has an example python script to generate certificates which can be found here:
flower/examples/supernode-authentication/generate_creds.py at main · flwrlabs/flower.
Download this script to your local or workspace, and follow the below steps to generate your certificates:
-
-
-
-
Create a folder in Files
cert -
Create a file
generate_creds.pyand copy the content from the link above -
Start a Terminal App
-
Go to Files → cert
-
Run Command
python3 generate_creds.py
-
-
-

This will create the following files in /home/workspace/files/cert/certificates/

Creating a SuperNode app in workspace:
-
Login to workspace and create a new R Web App. Give the app a clear name e.g SuperNode App. Leave default selected fields and click Create R Web App.

-
Go to Workspace Files ->your R-Web-App folder. You should see
.version, in the folder -
Open
.versionfile , delete everything there and update file with43604069-832b-4d5e-9a97-d78cb5f5d7b7/ttyd-terminaland save it. -
Go to Workspace Files ->your R-Web-App folder. You should see
app.Rin the folder. Deleteapp.Rand create a new file calledapp. -
Open
appas a text file and fill in the content.
Example of SuperNode app :
#!/bin/bash
flower-supernode --superlink "public-instance1-<superlink app session id>.<hub-domain>:443"
For a SuperNode to join a Superlink it requires the domain name of the SuperLink as shown above.
The hub domain is the domain of the hub the network is being run in. A workspace Tennant Admin can add this to the workspace network whitelist.
Instructions on how to find the SuperLink app session ID are detailed below.
Starting SuperLink and SuperNode apps
Following set up of the SuperLink and SuperNodes the network can be started using the following instructions:
-
Go to R web apps, start your superlink app
-
Turn on developer tool to find session_id for the SuperLink app
-
Give this to supernode
appsfile that you would like to join this superlink. Supernode apps adjust theirappfile content and then can start supernode apps.
Use FlowerCLI to handle Flower: (This is Flower configuration)
-
In workspace
Files, create a new folder.flwrand then create fileconfig.toml. -
Add superlink info into the config file.
Example:
[superlink.myserver]address = "public-instance-<superlink app session id>.<hub-domain>"Example from QC hub:
[superlink.myserver]address = "public-instance-cb5cf4eed4ddf719ecf976b2547d90c0.westeurope.qc.aridhiatest.net"Start the terminal app from workspace Apps. You should be able to run
flwrcommand in the app.
Some flwr commands to verify:
Show superlinks
flwr config listShow supernodes in a superlink
flwr supernode list <superlink name>Run a task (you need to upload flower task to workspace)
flwr run <app path to pyproject.toml> <superlink name>Check running tasks
flwr list <superlink name>

