Skip to content

Commit

Permalink
feat(framework) Add internal flwr-clientapp command (#3973)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel J. Beutel <[email protected]>
  • Loading branch information
chongshenng and danieljanes authored Aug 12, 2024
1 parent 59ad136 commit 1100d89
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ flower-supernode = "flwr.client:run_supernode"
flower-client-app = "flwr.client:run_client_app"
flower-server-app = "flwr.server:run_server_app"
flower-simulation = "flwr.simulation.run_simulation:run_simulation_from_cli"
flwr-clientapp = "flwr.client.supernode:flwr_clientapp"

[tool.poetry.dependencies]
python = "^3.8"
Expand Down
2 changes: 2 additions & 0 deletions src/py/flwr/client/supernode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
"""Flower SuperNode."""


from .app import flwr_clientapp as flwr_clientapp
from .app import run_client_app as run_client_app
from .app import run_supernode as run_supernode

__all__ = [
"flwr_clientapp",
"run_client_app",
"run_supernode",
]
25 changes: 25 additions & 0 deletions src/py/flwr/client/supernode/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,31 @@ def run_client_app() -> None:
register_exit_handlers(event_type=EventType.RUN_CLIENT_APP_LEAVE)


def flwr_clientapp() -> None:
"""Run process-isolated Flower ClientApp."""
log(INFO, "Starting Flower ClientApp")

parser = argparse.ArgumentParser(
description="Run a Flower ClientApp",
)
parser.add_argument(
"--address",
help="Address of SuperNode ClientAppIo gRPC servicer",
)
parser.add_argument(
"--token",
help="Unique token generated by SuperNode for each ClientApp execution",
)
args = parser.parse_args()
log(
DEBUG,
"Staring isolated `ClientApp` connected to SuperNode ClientAppIo at %s "
"with the token %s",
args.address,
args.token,
)


def _warn_deprecated_server_arg(args: argparse.Namespace) -> None:
"""Warn about the deprecated argument `--server`."""
if args.server != ADDRESS_FLEET_API_GRPC_RERE:
Expand Down

0 comments on commit 1100d89

Please sign in to comment.