Run ServerApp or ClientApp as a Subprocess¶
The SuperLink and SuperNode components support two distinct isolation modes, allowing for flexible deployment and control:
Subprocess Mode: In this configuration (default), the SuperLink and SuperNode take responsibility for launching the ServerApp and ClientApp processes internally. This differs from the
process
isolation-mode which uses separate containers, as demonstrated in the Quickstart with Docker guide.Using the
subprocess
approach reduces the number of running containers, which can be beneficial for environments with limited resources. However, it also means that the applications are not isolated from their parent containers, which may introduce additional security concerns.Process Mode: In this mode, the ServerApp and ClientApps run in completely separate processes. Unlike the alternative Subprocess mode, the SuperLink or SuperNode does not attempt to create or manage these processes. Instead, they must be started externally.
Both modes can be mixed for added flexibility. For instance, you can run the SuperLink
in subprocess
mode while keeping the SuperNode in process
mode, or vice versa.
To run the SuperLink and SuperNode in isolation mode process
, refer to the
Quickstart with Docker guide. To run them in subprocess
mode, follow the
instructions below.
Prerequisites
1. Before running the ServerApp as a subprocess, ensure that the FAB dependencies have been installed in the SuperLink images. This can be done by extending the SuperLink image:
1FROM flwr/superlink:1.13.1
2
3WORKDIR /app
4COPY pyproject.toml .
5RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
6 && python -m pip install -U --no-cache-dir .
7
8ENTRYPOINT ["flower-superlink"]
2. Next, build the SuperLink Docker image by running the following command in the directory where Dockerfile is located:
$ docker build -f superlink.Dockerfile -t flwr_superlink:0.0.1 .
Run the ServerApp as a Subprocess
Start the SuperLink and run the ServerApp as a subprocess (note that
the subprocess mode is the default, so you do not have to explicitly set the --isolation
flag):
$ docker run --rm \
-p 9091:9091 -p 9092:9092 -p 9093:9093 \
--detach \
flwr_superlink:0.0.1 \
--insecure
Prerequisites
1. Before running the ClientApp as a subprocess, ensure that the FAB dependencies have been installed in the SuperNode images. This can be done by extending the SuperNode image:
1FROM flwr/supernode:1.13.1
2
3WORKDIR /app
4COPY pyproject.toml .
5RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
6 && python -m pip install -U --no-cache-dir .
7
8ENTRYPOINT ["flower-supernode"]
2. Next, build the SuperNode Docker image by running the following command in the directory where Dockerfile is located:
$ docker build -f supernode.Dockerfile -t flwr_supernode:0.0.1 .
Run the ClientApp as a Subprocess
Start the SuperNode and run the ClientApp as a subprocess (note that
the subprocess mode is the default, so you do not have to explicitly set the --isolation
flag):
$ docker run --rm \
--detach \
flwr_supernode:0.0.1 \
--insecure \
--superlink <superlink-address>:9092