Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(framework) Add internal flwr-clientapp command #3973

Merged
merged 19 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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