From d905089a02e4bbeb33e758bf259761c63aa0b5f6 Mon Sep 17 00:00:00 2001 From: "Daniel J. Beutel" Date: Sat, 13 Jul 2024 16:40:23 +0200 Subject: [PATCH] docs(framework) Update client_fn docstrings to new signature --- src/py/flwr/client/app.py | 2 +- src/py/flwr/client/client_app.py | 2 +- src/py/flwr/simulation/app.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/py/flwr/client/app.py b/src/py/flwr/client/app.py index 700ac85f341f..348ef8910dd3 100644 --- a/src/py/flwr/client/app.py +++ b/src/py/flwr/client/app.py @@ -139,7 +139,7 @@ class `flwr.client.Client` (default: None) Starting an SSL-enabled gRPC client using system certificates: >>> def client_fn(context: Context): - >>> return FlowerClient() + >>> return FlowerClient().to_client() >>> >>> start_client( >>> server_address=localhost:8080, diff --git a/src/py/flwr/client/client_app.py b/src/py/flwr/client/client_app.py index 9566302d0721..2a913b3a248d 100644 --- a/src/py/flwr/client/client_app.py +++ b/src/py/flwr/client/client_app.py @@ -91,7 +91,7 @@ class ClientApp: >>> class FlowerClient(NumPyClient): >>> # ... >>> - >>> def client_fn(node_id: int, partition_id: Optional[int]): + >>> def client_fn(context: Context): >>> return FlowerClient().to_client() >>> >>> app = ClientApp(client_fn) diff --git a/src/py/flwr/simulation/app.py b/src/py/flwr/simulation/app.py index fc52267f9a04..973a9a89e652 100644 --- a/src/py/flwr/simulation/app.py +++ b/src/py/flwr/simulation/app.py @@ -111,9 +111,9 @@ def start_simulation( Parameters ---------- client_fn : ClientFnExt - A function creating Client instances. The function must have the signature - `client_fn(node_id: int, partition_id: Optional[int]). It should return - a single client instance of type Client. Note that the created client + A function creating `Client` instances. The function must have the signature + `client_fn(context: Context). It should return + a single client instance of type `Client`. Note that the created client instances are ephemeral and will often be destroyed after a single method invocation. Since client instances are not long-lived, they should not attempt to carry state over method invocations. Any state required by the instance