Skip to content

Commit

Permalink
feat(framework) Make flower-supernode run in subprocess mode by d…
Browse files Browse the repository at this point in the history
…efault (#4485)
  • Loading branch information
chongshenng authored Nov 15, 2024
1 parent 7f7281f commit 581f3fd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions e2e/test_exec_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ sleep 2
if [ "$3" = "deployment-engine" ]; then
timeout 2m flower-supernode ./ $client_arg $server_arg \
--superlink $server_address $client_auth_1 \
--clientappio-api-address localhost:9094 \
--node-config "partition-id=0 num-partitions=2" --max-retries 0 &
cl1_pid=$!
sleep 2

timeout 2m flower-supernode ./ $client_arg $server_arg \
--superlink $server_address $client_auth_2 \
--clientappio-api-address localhost:9095 \
--node-config "partition-id=1 num-partitions=2" --max-retries 0 &
cl2_pid=$!
sleep 2
Expand Down
8 changes: 4 additions & 4 deletions e2e/test_reconnection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ echo "Starting SuperLink"
sleep 3

timeout 10m flower-supernode --insecure $rest_arg --superlink $server_address \
--isolation="subprocess" --clientappio-api-address="localhost:9094" &
--clientappio-api-address="localhost:9094" &
cl1_pid=$!
echo "Starting first client"
sleep 3

timeout 10m flower-supernode --insecure $rest_arg --superlink $server_address \
--isolation="subprocess" --clientappio-api-address="localhost:9095" &
--clientappio-api-address="localhost:9095" &
cl2_pid=$!
echo "Starting second client"
sleep 3
Expand All @@ -81,7 +81,7 @@ sleep 5

# Starting new client, this is so we have enough clients to execute `flwr run`
timeout 10m flower-supernode --insecure $rest_arg --superlink $server_address \
--isolation="subprocess" --clientappio-api-address "localhost:9094" &
--clientappio-api-address "localhost:9094" &
cl1_pid=$!
echo "Starting new client"
sleep 5
Expand All @@ -100,7 +100,7 @@ sleep 3

# Restart first client so enough clients are connected to continue the FL rounds
timeout 5m flower-supernode --insecure $rest_arg --superlink $server_address \
--isolation="subprocess" --clientappio-api-address "localhost:9094" &
--clientappio-api-address "localhost:9094" &
cl1_pid=$!
echo "Starting new client"
sleep 5
Expand Down
4 changes: 2 additions & 2 deletions e2e/test_superlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ sleep 3

timeout 5m flower-supernode $client_arg $server_arg $rest_arg_supernode \
--superlink $server_address $client_auth_1 \
--isolation="subprocess" --clientappio-api-address "localhost:9094" \
--clientappio-api-address "localhost:9094" \
--max-retries 0 &
cl1_pid=$!
sleep 3

timeout 5m flower-supernode $client_arg $server_arg $rest_arg_supernode \
--superlink $server_address $client_auth_2 \
--isolation="subprocess" --clientappio-api-address "localhost:9096" \
--clientappio-api-address "localhost:9096" \
--max-retries 0 &
cl2_pid=$!
sleep 3
Expand Down
11 changes: 5 additions & 6 deletions src/py/flwr/client/supernode/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,16 @@ def _parse_args_run_supernode() -> argparse.ArgumentParser:
)
parser.add_argument(
"--isolation",
default=None,
default=ISOLATION_MODE_SUBPROCESS,
required=False,
choices=[
ISOLATION_MODE_SUBPROCESS,
ISOLATION_MODE_PROCESS,
],
help="Isolation mode when running a `ClientApp` (optional, possible values: "
"`subprocess`, `process`). By default, a `ClientApp` runs in the same process "
"that executes the SuperNode. Use `subprocess` to configure SuperNode to run "
"a `ClientApp` in a subprocess. Use `process` to indicate that a separate "
"independent process gets created outside of SuperNode.",
help="Isolation mode when running a `ClientApp` (`subprocess` by default, "
"possible values: `subprocess`, `process`). Use `subprocess` to configure "
"SuperNode to run a `ClientApp` in a subprocess. Use `process` to indicate "
"that a separate independent process gets created outside of SuperNode.",
)
parser.add_argument(
"--clientappio-api-address",
Expand Down

0 comments on commit 581f3fd

Please sign in to comment.