flwr-nightly 1.11.0.dev20240817__py3-none-any.whl → 1.11.0.dev20240818__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flwr-nightly might be problematic. Click here for more details.
- flwr/client/app.py +8 -2
- flwr/client/clientapp/app.py +11 -3
- flwr/client/clientapp/clientappio_servicer.py +4 -2
- {flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/METADATA +1 -1
- {flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/RECORD +8 -8
- {flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/entry_points.txt +0 -0
flwr/client/app.py
CHANGED
|
@@ -21,7 +21,7 @@ import time
|
|
|
21
21
|
from dataclasses import dataclass
|
|
22
22
|
from logging import ERROR, INFO, WARN
|
|
23
23
|
from pathlib import Path
|
|
24
|
-
from typing import Callable, ContextManager, Dict, Optional, Tuple, Type, Union
|
|
24
|
+
from typing import Callable, ContextManager, Dict, Optional, Tuple, Type, Union, cast
|
|
25
25
|
|
|
26
26
|
import grpc
|
|
27
27
|
from cryptography.hazmat.primitives.asymmetric import ec
|
|
@@ -294,6 +294,7 @@ def start_client_internal(
|
|
|
294
294
|
_clientappio_grpc_server, clientappio_servicer = run_clientappio_api_grpc(
|
|
295
295
|
address=supernode_address
|
|
296
296
|
)
|
|
297
|
+
supernode_address = cast(str, supernode_address)
|
|
297
298
|
|
|
298
299
|
# At this point, only `load_client_app_fn` should be used
|
|
299
300
|
# Both `client` and `client_fn` must not be used directly
|
|
@@ -454,7 +455,7 @@ def start_client_internal(
|
|
|
454
455
|
|
|
455
456
|
# Handle app loading and task message
|
|
456
457
|
try:
|
|
457
|
-
if isolate
|
|
458
|
+
if isolate:
|
|
458
459
|
# Generate SuperNode token
|
|
459
460
|
token: int = generate_rand_int_from_bytes(RUN_ID_NUM_BYTES)
|
|
460
461
|
|
|
@@ -483,6 +484,11 @@ def start_client_internal(
|
|
|
483
484
|
stderr=None,
|
|
484
485
|
check=True,
|
|
485
486
|
)
|
|
487
|
+
|
|
488
|
+
# Wait for output to become available
|
|
489
|
+
while not clientappio_servicer.has_outputs():
|
|
490
|
+
time.sleep(0.1)
|
|
491
|
+
|
|
486
492
|
outputs = clientappio_servicer.get_outputs()
|
|
487
493
|
reply_message, context = outputs.message, outputs.context
|
|
488
494
|
else:
|
flwr/client/clientapp/app.py
CHANGED
|
@@ -58,10 +58,13 @@ def flwr_clientapp() -> None:
|
|
|
58
58
|
)
|
|
59
59
|
parser.add_argument(
|
|
60
60
|
"--supernode",
|
|
61
|
+
type=str,
|
|
61
62
|
help="Address of SuperNode ClientAppIo gRPC servicer",
|
|
62
63
|
)
|
|
63
64
|
parser.add_argument(
|
|
64
65
|
"--token",
|
|
66
|
+
type=int,
|
|
67
|
+
required=False,
|
|
65
68
|
help="Unique token generated by SuperNode for each ClientApp execution",
|
|
66
69
|
)
|
|
67
70
|
args = parser.parse_args()
|
|
@@ -72,7 +75,7 @@ def flwr_clientapp() -> None:
|
|
|
72
75
|
args.supernode,
|
|
73
76
|
args.token,
|
|
74
77
|
)
|
|
75
|
-
run_clientapp(supernode=args.supernode, token=
|
|
78
|
+
run_clientapp(supernode=args.supernode, token=args.token)
|
|
76
79
|
|
|
77
80
|
|
|
78
81
|
def on_channel_state_change(channel_connectivity: str) -> None:
|
|
@@ -82,7 +85,7 @@ def on_channel_state_change(channel_connectivity: str) -> None:
|
|
|
82
85
|
|
|
83
86
|
def run_clientapp( # pylint: disable=R0914
|
|
84
87
|
supernode: str,
|
|
85
|
-
token: int,
|
|
88
|
+
token: Optional[int] = None,
|
|
86
89
|
) -> None:
|
|
87
90
|
"""Run Flower ClientApp process.
|
|
88
91
|
|
|
@@ -90,7 +93,7 @@ def run_clientapp( # pylint: disable=R0914
|
|
|
90
93
|
----------
|
|
91
94
|
supernode : str
|
|
92
95
|
Address of SuperNode
|
|
93
|
-
token : int
|
|
96
|
+
token : Optional[int] (default: None)
|
|
94
97
|
Unique SuperNode token for ClientApp-SuperNode authentication
|
|
95
98
|
"""
|
|
96
99
|
channel = create_channel(
|
|
@@ -102,6 +105,10 @@ def run_clientapp( # pylint: disable=R0914
|
|
|
102
105
|
try:
|
|
103
106
|
stub = ClientAppIoStub(channel)
|
|
104
107
|
|
|
108
|
+
# If token is not set, loop until token is received from SuperNode
|
|
109
|
+
while token is None:
|
|
110
|
+
token = get_token(stub)
|
|
111
|
+
|
|
105
112
|
# Pull Message, Context, and Run from SuperNode
|
|
106
113
|
message, context, run = pull_message(stub=stub, token=token)
|
|
107
114
|
|
|
@@ -149,6 +156,7 @@ def run_clientapp( # pylint: disable=R0914
|
|
|
149
156
|
|
|
150
157
|
def get_token(stub: grpc.Channel) -> Optional[int]:
|
|
151
158
|
"""Get a token from SuperNode."""
|
|
159
|
+
log(DEBUG, "Flower ClientApp process requests token")
|
|
152
160
|
res: GetTokenResponse = stub.GetToken(GetTokenRequest())
|
|
153
161
|
return res.token
|
|
154
162
|
|
|
@@ -209,7 +209,6 @@ class ClientAppIoServicer(clientappio_pb2_grpc.ClientAppIoServicer):
|
|
|
209
209
|
Set to `True` when passing the token to `flwr-clientap`
|
|
210
210
|
and `False` otherwise.
|
|
211
211
|
"""
|
|
212
|
-
log(DEBUG, "ClientAppIo.SetInputs")
|
|
213
212
|
if (
|
|
214
213
|
self.clientapp_input is not None
|
|
215
214
|
or self.clientapp_output is not None
|
|
@@ -222,9 +221,12 @@ class ClientAppIoServicer(clientappio_pb2_grpc.ClientAppIoServicer):
|
|
|
222
221
|
self.clientapp_input = clientapp_input
|
|
223
222
|
self.token_returned = token_returned
|
|
224
223
|
|
|
224
|
+
def has_outputs(self) -> bool:
|
|
225
|
+
"""Check if ClientAppOutputs are available."""
|
|
226
|
+
return self.clientapp_output is not None
|
|
227
|
+
|
|
225
228
|
def get_outputs(self) -> ClientAppIoOutputs:
|
|
226
229
|
"""Get ClientApp outputs."""
|
|
227
|
-
log(DEBUG, "ClientAppIo.GetOutputs")
|
|
228
230
|
if self.clientapp_output is None:
|
|
229
231
|
raise ValueError("ClientAppIoOutputs not set before calling `get_outputs`.")
|
|
230
232
|
|
{flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/RECORD
RENAMED
|
@@ -53,12 +53,12 @@ flwr/cli/run/__init__.py,sha256=oCd6HmQDx-sqver1gecgx-uMA38BLTSiiKpl7RGNceg,789
|
|
|
53
53
|
flwr/cli/run/run.py,sha256=Ero4hxwZqx5ztFWvaJqslYCUBgp-AmImkomRosdGXyc,7661
|
|
54
54
|
flwr/cli/utils.py,sha256=l65Ul0YsSBPuypk0uorAtEDmLEYiUrzpCXi6zCg9mJ4,4506
|
|
55
55
|
flwr/client/__init__.py,sha256=wzJZsYJIHf_8-PMzvfbinyzzjgh1UP1vLrAw2_yEbKI,1345
|
|
56
|
-
flwr/client/app.py,sha256=
|
|
56
|
+
flwr/client/app.py,sha256=tB-bl3pcUhn-bUgGxRVUaZiS-AlZjf-zfxWdZA-r50Q,30483
|
|
57
57
|
flwr/client/client.py,sha256=Vp9UkOkoHdNfn6iMYZsj_5m_GICiFfUlKEVaLad-YhM,8183
|
|
58
58
|
flwr/client/client_app.py,sha256=WcO4r6wrdfaus__3s22D2sYjfcptdgmVujUAYdNE6HU,10393
|
|
59
59
|
flwr/client/clientapp/__init__.py,sha256=kZqChGnTChQ1WGSUkIlW2S5bc0d0mzDubCAmZUGRpEY,800
|
|
60
|
-
flwr/client/clientapp/app.py,sha256=
|
|
61
|
-
flwr/client/clientapp/clientappio_servicer.py,sha256=
|
|
60
|
+
flwr/client/clientapp/app.py,sha256=Ae5dNoLbLsaKKRUZHRnZ7povobk6DdA0C7e06gPiJLc,6003
|
|
61
|
+
flwr/client/clientapp/clientappio_servicer.py,sha256=ysCgLY4oV2FmyltPQH2ZobbQ5e_TYd9BAuR1MdQrtXA,8353
|
|
62
62
|
flwr/client/clientapp/utils.py,sha256=2fYKY1LfZPalG5Cm5FbSuNMIDtouQg17GbrzPINyM_A,3990
|
|
63
63
|
flwr/client/dpfedavg_numpy_client.py,sha256=ylZ-LpBIKmL1HCiS8kq4pkp2QGalc8rYEzDHdRG3VRQ,7435
|
|
64
64
|
flwr/client/grpc_adapter_client/__init__.py,sha256=QyNWIbsq9DpyMk7oemiO1P3TBFfkfkctnJ1JoAkTl3s,742
|
|
@@ -286,8 +286,8 @@ flwr/superexec/exec_grpc.py,sha256=PhqGoZEpTMxSQmUSV8Wgtzb1Za_pHJ-adZqo5RYnDyE,1
|
|
|
286
286
|
flwr/superexec/exec_servicer.py,sha256=jl0aKVjm0PLQABcTL5c3jdSIzb0Z6hpVOtrAn4Ob7ts,2323
|
|
287
287
|
flwr/superexec/executor.py,sha256=k_adivto6R2U82DADOHNvdtobehBYreRek1gOEBIQnQ,2318
|
|
288
288
|
flwr/superexec/simulation.py,sha256=lfdClQYSAIMHe43aJ0Pk-kBw_xoV09LsIMfHo2eo-Ck,6775
|
|
289
|
-
flwr_nightly-1.11.0.
|
|
290
|
-
flwr_nightly-1.11.0.
|
|
291
|
-
flwr_nightly-1.11.0.
|
|
292
|
-
flwr_nightly-1.11.0.
|
|
293
|
-
flwr_nightly-1.11.0.
|
|
289
|
+
flwr_nightly-1.11.0.dev20240818.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
290
|
+
flwr_nightly-1.11.0.dev20240818.dist-info/METADATA,sha256=9h_o6Y1-M5y5_TUc0stYWb0E1GPhBo0uN_yCLAMqgNs,15690
|
|
291
|
+
flwr_nightly-1.11.0.dev20240818.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
292
|
+
flwr_nightly-1.11.0.dev20240818.dist-info/entry_points.txt,sha256=3cDQVJEBRCSLzJrVYAgjXpoCjuQ74I3A9NZ61DOHdVo,388
|
|
293
|
+
flwr_nightly-1.11.0.dev20240818.dist-info/RECORD,,
|
{flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/LICENSE
RENAMED
|
File without changes
|
{flwr_nightly-1.11.0.dev20240817.dist-info → flwr_nightly-1.11.0.dev20240818.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|