Skip to content

Commit

Permalink
Rename parameter in start_client to just rest (#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljanes committed Feb 26, 2023
1 parent 1757d5a commit 96d49e9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion examples/mt-pytorch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ def evaluate(self, parameters, config):
fl.client.start_numpy_client(
server_address="0.0.0.0:9093",
client=FlowerClient(),
use_rest=True,
rest=True,
)
56 changes: 27 additions & 29 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,36 +87,34 @@ def start_client(
client: Client,
grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,
root_certificates: Optional[bytes] = None,
use_rest: bool = False,
rest: bool = False,
) -> None:
"""Start a Flower Client which connects to a gRPC server.
Parameters
----------
server_address: str. The IPv4 or IPv6 address of the server. If the Flower
server runs on the same machine on port 8080, then `server_address`
would be `"[::]:8080"`.
client: flwr.client.Client. An implementation of the abstract base
class `flwr.client.Client`.
grpc_max_message_length: int (default: 536_870_912, this equals 512MB).
The maximum length of gRPC messages that can be exchanged with the
Flower server. The default should be sufficient for most models.
Users who train very large models might need to increase this
value. Note that the Flower server needs to be started with the
same value (see `flwr.server.start_server`), otherwise it will not
know about the increased limit and block larger messages.
root_certificates: bytes (default: None)
The PEM-encoded root certificates as a byte string. If provided, a secure
connection using the certificates will be established to a
SSL-enabled Flower server.
use_rest: bool (default: False)
Defines whether or not the client is interacting with the server using the
experimental REST API. This feature is experimental, it might change
considerably in future versions of Flower.
Returns
-------
None
server_address : str
The IPv4 or IPv6 address of the server. If the Flower
server runs on the same machine on port 8080, then `server_address`
would be `"[::]:8080"`.
client : flwr.client.Client
An implementation of the abstract base
class `flwr.client.Client`.
grpc_max_message_length : int (default: 536_870_912, this equals 512MB)
The maximum length of gRPC messages that can be exchanged with the
Flower server. The default should be sufficient for most models.
Users who train very large models might need to increase this
value. Note that the Flower server needs to be started with the
same value (see `flwr.server.start_server`), otherwise it will not
know about the increased limit and block larger messages.
root_certificates : bytes (default: None)
The PEM-encoded root certificates as a byte string. If provided, a secure
connection using the certificates will be established to a
SSL-enabled Flower server.
rest : bool (default: False)
Defines whether or not the client is interacting with the server using the
experimental REST API. This feature is experimental, it might change
considerably in future versions of Flower.
Examples
--------
Expand All @@ -140,7 +138,7 @@ class `flwr.client.Client`.
event(EventType.START_CLIENT_ENTER)

# Use either gRPC bidirectional streaming or REST request/response
connection = http_request_response if use_rest else grpc_connection
connection = http_request_response if rest else grpc_connection
while True:
sleep_duration: int = 0
with connection(
Expand Down Expand Up @@ -181,7 +179,7 @@ def start_numpy_client(
client: NumPyClient,
grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,
root_certificates: Optional[bytes] = None,
use_rest: bool = False,
rest: bool = False,
) -> None:
"""Start a Flower NumPyClient which connects to a gRPC server.
Expand All @@ -204,7 +202,7 @@ def start_numpy_client(
The PEM-encoded root certificates a byte string. If provided, a secure
connection using the certificates will be established to a
SSL-enabled Flower server.
use_rest: bool (default: False)
rest : bool (default: False)
Defines whether or not the client is interacting with the server using the
experimental REST API. This feature is experimental, it might be change
considerably in future versions of Flower.
Expand Down Expand Up @@ -234,7 +232,7 @@ def start_numpy_client(
client=_wrap_numpy_client(client=client),
grpc_max_message_length=grpc_max_message_length,
root_certificates=root_certificates,
use_rest=use_rest,
rest=rest,
)


Expand Down
2 changes: 1 addition & 1 deletion src/py/flwr/client/rest_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def http_request_response(
log(
WARN,
"""
EXPERIMENTAL: `use_rest` is an experimental feature, it might change
EXPERIMENTAL: `rest` is an experimental feature, it might change
considerably in future versions of Flower
""",
)
Expand Down

0 comments on commit 96d49e9

Please sign in to comment.