flwr-nightly 1.21.0.dev20250730__py3-none-any.whl → 1.21.0.dev20250801__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.
- flwr/client/grpc_rere_client/connection.py +1 -12
- flwr/client/rest_client/connection.py +3 -0
- flwr/common/args.py +2 -6
- flwr/common/retry_invoker.py +30 -11
- flwr/server/app.py +2 -2
- flwr/superexec/deployment.py +2 -173
- flwr/superexec/simulation.py +2 -111
- flwr/superlink/executor/__init__.py +28 -0
- flwr/{superexec → superlink/executor}/app.py +1 -1
- flwr/superlink/executor/deployment.py +188 -0
- flwr/superlink/executor/simulation.py +126 -0
- flwr/superlink/servicer/__init__.py +15 -0
- flwr/superlink/servicer/exec/__init__.py +22 -0
- flwr/{superexec → superlink/servicer/exec}/exec_event_log_interceptor.py +1 -1
- flwr/{superexec → superlink/servicer/exec}/exec_grpc.py +5 -5
- flwr/{superexec → superlink/servicer/exec}/exec_license_interceptor.py +1 -1
- flwr/{superexec → superlink/servicer/exec}/exec_servicer.py +3 -3
- flwr/{superexec → superlink/servicer/exec}/exec_user_auth_interceptor.py +1 -1
- flwr/supernode/start_client_internal.py +10 -41
- {flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/METADATA +1 -1
- {flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/RECORD +24 -19
- /flwr/{superexec → superlink/executor}/executor.py +0 -0
- {flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/entry_points.txt +0 -0
@@ -40,7 +40,7 @@ from flwr.common.secure_aggregation.crypto.symmetric_encryption import (
|
|
40
40
|
generate_key_pairs,
|
41
41
|
)
|
42
42
|
from flwr.common.serde import message_from_proto, message_to_proto, run_from_proto
|
43
|
-
from flwr.common.typing import Fab, Run
|
43
|
+
from flwr.common.typing import Fab, Run
|
44
44
|
from flwr.proto.fab_pb2 import GetFabRequest, GetFabResponse # pylint: disable=E0611
|
45
45
|
from flwr.proto.fleet_pb2 import ( # pylint: disable=E0611
|
46
46
|
CreateNodeRequest,
|
@@ -157,17 +157,6 @@ def grpc_request_response( # pylint: disable=R0913,R0914,R0915,R0917
|
|
157
157
|
stub = adapter_cls(channel)
|
158
158
|
node: Optional[Node] = None
|
159
159
|
|
160
|
-
def _should_giveup_fn(e: Exception) -> bool:
|
161
|
-
if e.code() == grpc.StatusCode.PERMISSION_DENIED: # type: ignore
|
162
|
-
raise RunNotRunningException
|
163
|
-
if e.code() == grpc.StatusCode.UNAVAILABLE: # type: ignore
|
164
|
-
return False
|
165
|
-
return True
|
166
|
-
|
167
|
-
# Restrict retries to cases where the status code is UNAVAILABLE
|
168
|
-
# If the status code is PERMISSION_DENIED, additionally raise RunNotRunningException
|
169
|
-
retry_invoker.should_giveup = _should_giveup_fn
|
170
|
-
|
171
160
|
# Wrap stub
|
172
161
|
_wrap_stub(stub, retry_invoker)
|
173
162
|
###########################################################################
|
@@ -176,6 +176,9 @@ def http_request_response( # pylint: disable=R0913,R0914,R0915,R0917
|
|
176
176
|
# Shared variables for inner functions
|
177
177
|
node: Optional[Node] = None
|
178
178
|
|
179
|
+
# Remove should_giveup from RetryInvoker as REST does not support gRPC status codes
|
180
|
+
retry_invoker.should_giveup = None
|
181
|
+
|
179
182
|
###########################################################################
|
180
183
|
# heartbeat/create_node/delete_node/receive/send/get_run functions
|
181
184
|
###########################################################################
|
flwr/common/args.py
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import sys
|
20
|
-
from logging import DEBUG, ERROR, WARN
|
20
|
+
from logging import DEBUG, ERROR, INFO, WARN
|
21
21
|
from os.path import isfile
|
22
22
|
from pathlib import Path
|
23
23
|
from typing import Optional, Union
|
@@ -72,11 +72,7 @@ def try_obtain_root_certificates(
|
|
72
72
|
else:
|
73
73
|
# Load the certificates if provided, or load the system certificates
|
74
74
|
if root_cert_path is None:
|
75
|
-
log(
|
76
|
-
WARN,
|
77
|
-
"Both `--insecure` and `--root-certificates` were not set. "
|
78
|
-
"Using system certificates.",
|
79
|
-
)
|
75
|
+
log(INFO, "Using system certificates")
|
80
76
|
root_certificates = None
|
81
77
|
elif not isfile(root_cert_path):
|
82
78
|
log(ERROR, "Path argument `--root-certificates` does not point to a file.")
|
flwr/common/retry_invoker.py
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
import itertools
|
19
19
|
import random
|
20
|
+
import threading
|
20
21
|
import time
|
21
22
|
from collections.abc import Generator, Iterable
|
22
23
|
from dataclasses import dataclass
|
@@ -319,8 +320,12 @@ class RetryInvoker:
|
|
319
320
|
|
320
321
|
def _make_simple_grpc_retry_invoker() -> RetryInvoker:
|
321
322
|
"""Create a simple gRPC retry invoker."""
|
323
|
+
lock = threading.Lock()
|
324
|
+
system_healthy = threading.Event()
|
325
|
+
system_healthy.set() # Initially, the connection is healthy
|
322
326
|
|
323
|
-
def
|
327
|
+
def _on_success(retry_state: RetryState) -> None:
|
328
|
+
system_healthy.set()
|
324
329
|
if retry_state.tries > 1:
|
325
330
|
log(
|
326
331
|
INFO,
|
@@ -329,17 +334,11 @@ def _make_simple_grpc_retry_invoker() -> RetryInvoker:
|
|
329
334
|
retry_state.tries,
|
330
335
|
)
|
331
336
|
|
332
|
-
def _on_backoff(
|
333
|
-
|
334
|
-
log(WARN, "Connection attempt failed, retrying...")
|
335
|
-
else:
|
336
|
-
log(
|
337
|
-
WARN,
|
338
|
-
"Connection attempt failed, retrying in %.2f seconds",
|
339
|
-
retry_state.actual_wait,
|
340
|
-
)
|
337
|
+
def _on_backoff(_: RetryState) -> None:
|
338
|
+
system_healthy.clear()
|
341
339
|
|
342
340
|
def _on_giveup(retry_state: RetryState) -> None:
|
341
|
+
system_healthy.clear()
|
343
342
|
if retry_state.tries > 1:
|
344
343
|
log(
|
345
344
|
WARN,
|
@@ -355,15 +354,35 @@ def _make_simple_grpc_retry_invoker() -> RetryInvoker:
|
|
355
354
|
return False
|
356
355
|
return True
|
357
356
|
|
357
|
+
def _wait(wait_time: float) -> None:
|
358
|
+
# Use a lock to prevent multiple gRPC calls from retrying concurrently,
|
359
|
+
# which is unnecessary since they are all likely to fail.
|
360
|
+
with lock:
|
361
|
+
# Log the wait time
|
362
|
+
log(
|
363
|
+
WARN,
|
364
|
+
"Connection attempt failed, retrying in %.2f seconds",
|
365
|
+
wait_time,
|
366
|
+
)
|
367
|
+
|
368
|
+
start = time.monotonic()
|
369
|
+
# Avoid sequential waits if the system is healthy
|
370
|
+
system_healthy.wait(wait_time)
|
371
|
+
|
372
|
+
remaining_time = wait_time - (time.monotonic() - start)
|
373
|
+
if remaining_time > 0:
|
374
|
+
time.sleep(remaining_time)
|
375
|
+
|
358
376
|
return RetryInvoker(
|
359
377
|
wait_gen_factory=lambda: exponential(max_delay=MAX_RETRY_DELAY),
|
360
378
|
recoverable_exceptions=grpc.RpcError,
|
361
379
|
max_tries=None,
|
362
380
|
max_time=None,
|
363
|
-
on_success=
|
381
|
+
on_success=_on_success,
|
364
382
|
on_backoff=_on_backoff,
|
365
383
|
on_giveup=_on_giveup,
|
366
384
|
should_giveup=_should_giveup_fn,
|
385
|
+
wait_function=_wait,
|
367
386
|
)
|
368
387
|
|
369
388
|
|
flwr/server/app.py
CHANGED
@@ -73,8 +73,8 @@ from flwr.server.serverapp.app import flwr_serverapp
|
|
73
73
|
from flwr.simulation.app import flwr_simulation
|
74
74
|
from flwr.supercore.ffs import FfsFactory
|
75
75
|
from flwr.supercore.object_store import ObjectStoreFactory
|
76
|
-
from flwr.
|
77
|
-
from flwr.
|
76
|
+
from flwr.superlink.executor import load_executor
|
77
|
+
from flwr.superlink.servicer.exec import run_exec_api_grpc
|
78
78
|
|
79
79
|
from .superlink.fleet.grpc_adapter.grpc_adapter_servicer import GrpcAdapterServicer
|
80
80
|
from .superlink.fleet.grpc_rere.fleet_servicer import FleetServicer
|
flwr/superexec/deployment.py
CHANGED
@@ -12,180 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""Deployment engine executor."""
|
15
|
+
"""Deployment engine executor for backward compatibility."""
|
16
16
|
|
17
17
|
|
18
|
-
import
|
19
|
-
from logging import ERROR, INFO
|
20
|
-
from pathlib import Path
|
21
|
-
from typing import Optional
|
22
|
-
|
23
|
-
from typing_extensions import override
|
24
|
-
|
25
|
-
from flwr.cli.config_utils import get_fab_metadata
|
26
|
-
from flwr.common import ConfigRecord, Context, RecordDict
|
27
|
-
from flwr.common.constant import (
|
28
|
-
SERVERAPPIO_API_DEFAULT_CLIENT_ADDRESS,
|
29
|
-
Status,
|
30
|
-
SubStatus,
|
31
|
-
)
|
32
|
-
from flwr.common.logger import log
|
33
|
-
from flwr.common.typing import Fab, RunStatus, UserConfig
|
34
|
-
from flwr.server.superlink.linkstate import LinkState, LinkStateFactory
|
35
|
-
from flwr.supercore.ffs import Ffs, FfsFactory
|
36
|
-
|
37
|
-
from .executor import Executor
|
38
|
-
|
39
|
-
|
40
|
-
class DeploymentEngine(Executor):
|
41
|
-
"""Deployment engine executor.
|
42
|
-
|
43
|
-
Parameters
|
44
|
-
----------
|
45
|
-
serverappio_api_address: str (default: "127.0.0.1:9091")
|
46
|
-
Address of the SuperLink to connect to.
|
47
|
-
root_certificates: Optional[str] (default: None)
|
48
|
-
Specifies the path to the PEM-encoded root certificate file for
|
49
|
-
establishing secure HTTPS connections.
|
50
|
-
flwr_dir: Optional[str] (default: None)
|
51
|
-
The path containing installed Flower Apps.
|
52
|
-
"""
|
53
|
-
|
54
|
-
def __init__(
|
55
|
-
self,
|
56
|
-
serverappio_api_address: str = SERVERAPPIO_API_DEFAULT_CLIENT_ADDRESS,
|
57
|
-
root_certificates: Optional[str] = None,
|
58
|
-
flwr_dir: Optional[str] = None,
|
59
|
-
) -> None:
|
60
|
-
self.serverappio_api_address = serverappio_api_address
|
61
|
-
if root_certificates is None:
|
62
|
-
self.root_certificates = None
|
63
|
-
self.root_certificates_bytes = None
|
64
|
-
else:
|
65
|
-
self.root_certificates = root_certificates
|
66
|
-
self.root_certificates_bytes = Path(root_certificates).read_bytes()
|
67
|
-
self.flwr_dir = flwr_dir
|
68
|
-
self.linkstate_factory: Optional[LinkStateFactory] = None
|
69
|
-
self.ffs_factory: Optional[FfsFactory] = None
|
70
|
-
|
71
|
-
@override
|
72
|
-
def initialize(
|
73
|
-
self, linkstate_factory: LinkStateFactory, ffs_factory: FfsFactory
|
74
|
-
) -> None:
|
75
|
-
"""Initialize the executor with the necessary factories."""
|
76
|
-
self.linkstate_factory = linkstate_factory
|
77
|
-
self.ffs_factory = ffs_factory
|
78
|
-
|
79
|
-
@property
|
80
|
-
def linkstate(self) -> LinkState:
|
81
|
-
"""Return the LinkState."""
|
82
|
-
if self.linkstate_factory is None:
|
83
|
-
raise RuntimeError("Executor is not initialized.")
|
84
|
-
return self.linkstate_factory.state()
|
85
|
-
|
86
|
-
@property
|
87
|
-
def ffs(self) -> Ffs:
|
88
|
-
"""Return the Flower File Storage (FFS)."""
|
89
|
-
if self.ffs_factory is None:
|
90
|
-
raise RuntimeError("Executor is not initialized.")
|
91
|
-
return self.ffs_factory.ffs()
|
92
|
-
|
93
|
-
@override
|
94
|
-
def set_config(
|
95
|
-
self,
|
96
|
-
config: UserConfig,
|
97
|
-
) -> None:
|
98
|
-
"""Set executor config arguments.
|
99
|
-
|
100
|
-
Parameters
|
101
|
-
----------
|
102
|
-
config : UserConfig
|
103
|
-
A dictionary for configuration values.
|
104
|
-
Supported configuration key/value pairs:
|
105
|
-
- "superlink": str
|
106
|
-
The address of the SuperLink ServerAppIo API.
|
107
|
-
- "root-certificates": str
|
108
|
-
The path to the root certificates.
|
109
|
-
- "flwr-dir": str
|
110
|
-
The path to the Flower directory.
|
111
|
-
"""
|
112
|
-
if not config:
|
113
|
-
return
|
114
|
-
if superlink_address := config.get("superlink"):
|
115
|
-
if not isinstance(superlink_address, str):
|
116
|
-
raise ValueError("The `superlink` value should be of type `str`.")
|
117
|
-
self.serverappio_api_address = superlink_address
|
118
|
-
if root_certificates := config.get("root-certificates"):
|
119
|
-
if not isinstance(root_certificates, str):
|
120
|
-
raise ValueError(
|
121
|
-
"The `root-certificates` value should be of type `str`."
|
122
|
-
)
|
123
|
-
self.root_certificates = root_certificates
|
124
|
-
self.root_certificates_bytes = Path(str(root_certificates)).read_bytes()
|
125
|
-
if flwr_dir := config.get("flwr-dir"):
|
126
|
-
if not isinstance(flwr_dir, str):
|
127
|
-
raise ValueError("The `flwr-dir` value should be of type `str`.")
|
128
|
-
self.flwr_dir = str(flwr_dir)
|
129
|
-
|
130
|
-
def _create_run(
|
131
|
-
self,
|
132
|
-
fab: Fab,
|
133
|
-
override_config: UserConfig,
|
134
|
-
flwr_aid: Optional[str],
|
135
|
-
) -> int:
|
136
|
-
fab_hash = self.ffs.put(fab.content, {})
|
137
|
-
if fab_hash != fab.hash_str:
|
138
|
-
raise RuntimeError(
|
139
|
-
f"FAB ({fab.hash_str}) hash from request doesn't match contents"
|
140
|
-
)
|
141
|
-
fab_id, fab_version = get_fab_metadata(fab.content)
|
142
|
-
|
143
|
-
run_id = self.linkstate.create_run(
|
144
|
-
fab_id, fab_version, fab_hash, override_config, ConfigRecord(), flwr_aid
|
145
|
-
)
|
146
|
-
return run_id
|
147
|
-
|
148
|
-
def _create_context(self, run_id: int) -> None:
|
149
|
-
"""Register a Context for a Run."""
|
150
|
-
# Create an empty context for the Run
|
151
|
-
context = Context(
|
152
|
-
run_id=run_id, node_id=0, node_config={}, state=RecordDict(), run_config={}
|
153
|
-
)
|
154
|
-
|
155
|
-
# Register the context at the LinkState
|
156
|
-
self.linkstate.set_serverapp_context(run_id=run_id, context=context)
|
157
|
-
|
158
|
-
@override
|
159
|
-
def start_run(
|
160
|
-
self,
|
161
|
-
fab_file: bytes,
|
162
|
-
override_config: UserConfig,
|
163
|
-
federation_options: ConfigRecord,
|
164
|
-
flwr_aid: Optional[str],
|
165
|
-
) -> Optional[int]:
|
166
|
-
"""Start run using the Flower Deployment Engine."""
|
167
|
-
run_id = None
|
168
|
-
try:
|
169
|
-
|
170
|
-
# Call SuperLink to create run
|
171
|
-
run_id = self._create_run(
|
172
|
-
Fab(hashlib.sha256(fab_file).hexdigest(), fab_file),
|
173
|
-
override_config,
|
174
|
-
flwr_aid,
|
175
|
-
)
|
176
|
-
|
177
|
-
# Register context for the Run
|
178
|
-
self._create_context(run_id=run_id)
|
179
|
-
log(INFO, "Created run %s", str(run_id))
|
180
|
-
|
181
|
-
return run_id
|
182
|
-
# pylint: disable-next=broad-except
|
183
|
-
except Exception as e:
|
184
|
-
log(ERROR, "Could not start run: %s", str(e))
|
185
|
-
if run_id:
|
186
|
-
run_status = RunStatus(Status.FINISHED, SubStatus.FAILED, str(e))
|
187
|
-
self.linkstate.update_run_status(run_id, new_status=run_status)
|
188
|
-
return None
|
189
|
-
|
18
|
+
from flwr.superlink.executor import DeploymentEngine
|
190
19
|
|
191
20
|
executor = DeploymentEngine()
|
flwr/superexec/simulation.py
CHANGED
@@ -12,118 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""Simulation engine executor."""
|
15
|
+
"""Simulation engine executor for backward compatibility."""
|
16
16
|
|
17
17
|
|
18
|
-
import
|
19
|
-
from logging import ERROR, INFO
|
20
|
-
from typing import Optional
|
21
|
-
|
22
|
-
from typing_extensions import override
|
23
|
-
|
24
|
-
from flwr.cli.config_utils import get_fab_metadata
|
25
|
-
from flwr.common import ConfigRecord, Context, RecordDict
|
26
|
-
from flwr.common.logger import log
|
27
|
-
from flwr.common.typing import Fab, UserConfig
|
28
|
-
from flwr.server.superlink.linkstate import LinkState, LinkStateFactory
|
29
|
-
from flwr.supercore.ffs import Ffs, FfsFactory
|
30
|
-
|
31
|
-
from .executor import Executor
|
32
|
-
|
33
|
-
|
34
|
-
class SimulationEngine(Executor):
|
35
|
-
"""Simulation engine executor."""
|
36
|
-
|
37
|
-
def __init__(
|
38
|
-
self,
|
39
|
-
) -> None:
|
40
|
-
self.linkstate_factory: Optional[LinkStateFactory] = None
|
41
|
-
self.ffs_factory: Optional[FfsFactory] = None
|
42
|
-
|
43
|
-
@override
|
44
|
-
def initialize(
|
45
|
-
self, linkstate_factory: LinkStateFactory, ffs_factory: FfsFactory
|
46
|
-
) -> None:
|
47
|
-
"""Initialize the executor with the necessary factories."""
|
48
|
-
self.linkstate_factory = linkstate_factory
|
49
|
-
self.ffs_factory = ffs_factory
|
50
|
-
|
51
|
-
@property
|
52
|
-
def linkstate(self) -> LinkState:
|
53
|
-
"""Return the LinkState."""
|
54
|
-
if self.linkstate_factory is None:
|
55
|
-
raise RuntimeError("Executor is not initialized.")
|
56
|
-
return self.linkstate_factory.state()
|
57
|
-
|
58
|
-
@property
|
59
|
-
def ffs(self) -> Ffs:
|
60
|
-
"""Return the Flower File Storage (FFS)."""
|
61
|
-
if self.ffs_factory is None:
|
62
|
-
raise RuntimeError("Executor is not initialized.")
|
63
|
-
return self.ffs_factory.ffs()
|
64
|
-
|
65
|
-
@override
|
66
|
-
def set_config(
|
67
|
-
self,
|
68
|
-
config: UserConfig,
|
69
|
-
) -> None:
|
70
|
-
"""Set executor config arguments."""
|
71
|
-
|
72
|
-
# pylint: disable=too-many-locals
|
73
|
-
@override
|
74
|
-
def start_run(
|
75
|
-
self,
|
76
|
-
fab_file: bytes,
|
77
|
-
override_config: UserConfig,
|
78
|
-
federation_options: ConfigRecord,
|
79
|
-
flwr_aid: Optional[str],
|
80
|
-
) -> Optional[int]:
|
81
|
-
"""Start run using the Flower Simulation Engine."""
|
82
|
-
try:
|
83
|
-
# Check that num-supernodes is set
|
84
|
-
if "num-supernodes" not in federation_options:
|
85
|
-
raise ValueError(
|
86
|
-
"Federation options doesn't contain key `num-supernodes`."
|
87
|
-
)
|
88
|
-
|
89
|
-
# Create run
|
90
|
-
fab = Fab(hashlib.sha256(fab_file).hexdigest(), fab_file)
|
91
|
-
fab_hash = self.ffs.put(fab.content, {})
|
92
|
-
if fab_hash != fab.hash_str:
|
93
|
-
raise RuntimeError(
|
94
|
-
f"FAB ({fab.hash_str}) hash from request doesn't match contents"
|
95
|
-
)
|
96
|
-
fab_id, fab_version = get_fab_metadata(fab.content)
|
97
|
-
|
98
|
-
run_id = self.linkstate.create_run(
|
99
|
-
fab_id,
|
100
|
-
fab_version,
|
101
|
-
fab_hash,
|
102
|
-
override_config,
|
103
|
-
federation_options,
|
104
|
-
flwr_aid,
|
105
|
-
)
|
106
|
-
|
107
|
-
# Create an empty context for the Run
|
108
|
-
context = Context(
|
109
|
-
run_id=run_id,
|
110
|
-
node_id=0,
|
111
|
-
node_config={},
|
112
|
-
state=RecordDict(),
|
113
|
-
run_config={},
|
114
|
-
)
|
115
|
-
|
116
|
-
# Register the context at the LinkState
|
117
|
-
self.linkstate.set_serverapp_context(run_id=run_id, context=context)
|
118
|
-
|
119
|
-
log(INFO, "Created run %s", str(run_id))
|
120
|
-
|
121
|
-
return run_id
|
122
|
-
|
123
|
-
# pylint: disable-next=broad-except
|
124
|
-
except Exception as e:
|
125
|
-
log(ERROR, "Could not start run: %s", str(e))
|
126
|
-
return None
|
127
|
-
|
18
|
+
from flwr.superlink.executor import SimulationEngine
|
128
19
|
|
129
20
|
executor = SimulationEngine()
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Executor for Exec API."""
|
16
|
+
|
17
|
+
|
18
|
+
from .app import load_executor
|
19
|
+
from .deployment import DeploymentEngine
|
20
|
+
from .executor import Executor
|
21
|
+
from .simulation import SimulationEngine
|
22
|
+
|
23
|
+
__all__ = [
|
24
|
+
"DeploymentEngine",
|
25
|
+
"Executor",
|
26
|
+
"SimulationEngine",
|
27
|
+
"load_executor",
|
28
|
+
]
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""
|
15
|
+
"""Function for loading executor."""
|
16
16
|
|
17
17
|
|
18
18
|
import argparse
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Deployment engine executor."""
|
16
|
+
|
17
|
+
|
18
|
+
import hashlib
|
19
|
+
from logging import ERROR, INFO
|
20
|
+
from pathlib import Path
|
21
|
+
from typing import Optional
|
22
|
+
|
23
|
+
from typing_extensions import override
|
24
|
+
|
25
|
+
from flwr.cli.config_utils import get_fab_metadata
|
26
|
+
from flwr.common import ConfigRecord, Context, RecordDict
|
27
|
+
from flwr.common.constant import (
|
28
|
+
SERVERAPPIO_API_DEFAULT_CLIENT_ADDRESS,
|
29
|
+
Status,
|
30
|
+
SubStatus,
|
31
|
+
)
|
32
|
+
from flwr.common.logger import log
|
33
|
+
from flwr.common.typing import Fab, RunStatus, UserConfig
|
34
|
+
from flwr.server.superlink.linkstate import LinkState, LinkStateFactory
|
35
|
+
from flwr.supercore.ffs import Ffs, FfsFactory
|
36
|
+
|
37
|
+
from .executor import Executor
|
38
|
+
|
39
|
+
|
40
|
+
class DeploymentEngine(Executor):
|
41
|
+
"""Deployment engine executor.
|
42
|
+
|
43
|
+
Parameters
|
44
|
+
----------
|
45
|
+
serverappio_api_address: str (default: "127.0.0.1:9091")
|
46
|
+
Address of the SuperLink to connect to.
|
47
|
+
root_certificates: Optional[str] (default: None)
|
48
|
+
Specifies the path to the PEM-encoded root certificate file for
|
49
|
+
establishing secure HTTPS connections.
|
50
|
+
flwr_dir: Optional[str] (default: None)
|
51
|
+
The path containing installed Flower Apps.
|
52
|
+
"""
|
53
|
+
|
54
|
+
def __init__(
|
55
|
+
self,
|
56
|
+
serverappio_api_address: str = SERVERAPPIO_API_DEFAULT_CLIENT_ADDRESS,
|
57
|
+
root_certificates: Optional[str] = None,
|
58
|
+
flwr_dir: Optional[str] = None,
|
59
|
+
) -> None:
|
60
|
+
self.serverappio_api_address = serverappio_api_address
|
61
|
+
if root_certificates is None:
|
62
|
+
self.root_certificates = None
|
63
|
+
self.root_certificates_bytes = None
|
64
|
+
else:
|
65
|
+
self.root_certificates = root_certificates
|
66
|
+
self.root_certificates_bytes = Path(root_certificates).read_bytes()
|
67
|
+
self.flwr_dir = flwr_dir
|
68
|
+
self.linkstate_factory: Optional[LinkStateFactory] = None
|
69
|
+
self.ffs_factory: Optional[FfsFactory] = None
|
70
|
+
|
71
|
+
@override
|
72
|
+
def initialize(
|
73
|
+
self, linkstate_factory: LinkStateFactory, ffs_factory: FfsFactory
|
74
|
+
) -> None:
|
75
|
+
"""Initialize the executor with the necessary factories."""
|
76
|
+
self.linkstate_factory = linkstate_factory
|
77
|
+
self.ffs_factory = ffs_factory
|
78
|
+
|
79
|
+
@property
|
80
|
+
def linkstate(self) -> LinkState:
|
81
|
+
"""Return the LinkState."""
|
82
|
+
if self.linkstate_factory is None:
|
83
|
+
raise RuntimeError("Executor is not initialized.")
|
84
|
+
return self.linkstate_factory.state()
|
85
|
+
|
86
|
+
@property
|
87
|
+
def ffs(self) -> Ffs:
|
88
|
+
"""Return the Flower File Storage (FFS)."""
|
89
|
+
if self.ffs_factory is None:
|
90
|
+
raise RuntimeError("Executor is not initialized.")
|
91
|
+
return self.ffs_factory.ffs()
|
92
|
+
|
93
|
+
@override
|
94
|
+
def set_config(
|
95
|
+
self,
|
96
|
+
config: UserConfig,
|
97
|
+
) -> None:
|
98
|
+
"""Set executor config arguments.
|
99
|
+
|
100
|
+
Parameters
|
101
|
+
----------
|
102
|
+
config : UserConfig
|
103
|
+
A dictionary for configuration values.
|
104
|
+
Supported configuration key/value pairs:
|
105
|
+
- "superlink": str
|
106
|
+
The address of the SuperLink ServerAppIo API.
|
107
|
+
- "root-certificates": str
|
108
|
+
The path to the root certificates.
|
109
|
+
- "flwr-dir": str
|
110
|
+
The path to the Flower directory.
|
111
|
+
"""
|
112
|
+
if not config:
|
113
|
+
return
|
114
|
+
if superlink_address := config.get("superlink"):
|
115
|
+
if not isinstance(superlink_address, str):
|
116
|
+
raise ValueError("The `superlink` value should be of type `str`.")
|
117
|
+
self.serverappio_api_address = superlink_address
|
118
|
+
if root_certificates := config.get("root-certificates"):
|
119
|
+
if not isinstance(root_certificates, str):
|
120
|
+
raise ValueError(
|
121
|
+
"The `root-certificates` value should be of type `str`."
|
122
|
+
)
|
123
|
+
self.root_certificates = root_certificates
|
124
|
+
self.root_certificates_bytes = Path(str(root_certificates)).read_bytes()
|
125
|
+
if flwr_dir := config.get("flwr-dir"):
|
126
|
+
if not isinstance(flwr_dir, str):
|
127
|
+
raise ValueError("The `flwr-dir` value should be of type `str`.")
|
128
|
+
self.flwr_dir = str(flwr_dir)
|
129
|
+
|
130
|
+
def _create_run(
|
131
|
+
self,
|
132
|
+
fab: Fab,
|
133
|
+
override_config: UserConfig,
|
134
|
+
flwr_aid: Optional[str],
|
135
|
+
) -> int:
|
136
|
+
fab_hash = self.ffs.put(fab.content, {})
|
137
|
+
if fab_hash != fab.hash_str:
|
138
|
+
raise RuntimeError(
|
139
|
+
f"FAB ({fab.hash_str}) hash from request doesn't match contents"
|
140
|
+
)
|
141
|
+
fab_id, fab_version = get_fab_metadata(fab.content)
|
142
|
+
|
143
|
+
run_id = self.linkstate.create_run(
|
144
|
+
fab_id, fab_version, fab_hash, override_config, ConfigRecord(), flwr_aid
|
145
|
+
)
|
146
|
+
return run_id
|
147
|
+
|
148
|
+
def _create_context(self, run_id: int) -> None:
|
149
|
+
"""Register a Context for a Run."""
|
150
|
+
# Create an empty context for the Run
|
151
|
+
context = Context(
|
152
|
+
run_id=run_id, node_id=0, node_config={}, state=RecordDict(), run_config={}
|
153
|
+
)
|
154
|
+
|
155
|
+
# Register the context at the LinkState
|
156
|
+
self.linkstate.set_serverapp_context(run_id=run_id, context=context)
|
157
|
+
|
158
|
+
@override
|
159
|
+
def start_run(
|
160
|
+
self,
|
161
|
+
fab_file: bytes,
|
162
|
+
override_config: UserConfig,
|
163
|
+
federation_options: ConfigRecord,
|
164
|
+
flwr_aid: Optional[str],
|
165
|
+
) -> Optional[int]:
|
166
|
+
"""Start run using the Flower Deployment Engine."""
|
167
|
+
run_id = None
|
168
|
+
try:
|
169
|
+
|
170
|
+
# Call SuperLink to create run
|
171
|
+
run_id = self._create_run(
|
172
|
+
Fab(hashlib.sha256(fab_file).hexdigest(), fab_file),
|
173
|
+
override_config,
|
174
|
+
flwr_aid,
|
175
|
+
)
|
176
|
+
|
177
|
+
# Register context for the Run
|
178
|
+
self._create_context(run_id=run_id)
|
179
|
+
log(INFO, "Created run %s", str(run_id))
|
180
|
+
|
181
|
+
return run_id
|
182
|
+
# pylint: disable-next=broad-except
|
183
|
+
except Exception as e:
|
184
|
+
log(ERROR, "Could not start run: %s", str(e))
|
185
|
+
if run_id:
|
186
|
+
run_status = RunStatus(Status.FINISHED, SubStatus.FAILED, str(e))
|
187
|
+
self.linkstate.update_run_status(run_id, new_status=run_status)
|
188
|
+
return None
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Simulation engine executor."""
|
16
|
+
|
17
|
+
|
18
|
+
import hashlib
|
19
|
+
from logging import ERROR, INFO
|
20
|
+
from typing import Optional
|
21
|
+
|
22
|
+
from typing_extensions import override
|
23
|
+
|
24
|
+
from flwr.cli.config_utils import get_fab_metadata
|
25
|
+
from flwr.common import ConfigRecord, Context, RecordDict
|
26
|
+
from flwr.common.logger import log
|
27
|
+
from flwr.common.typing import Fab, UserConfig
|
28
|
+
from flwr.server.superlink.linkstate import LinkState, LinkStateFactory
|
29
|
+
from flwr.supercore.ffs import Ffs, FfsFactory
|
30
|
+
|
31
|
+
from .executor import Executor
|
32
|
+
|
33
|
+
|
34
|
+
class SimulationEngine(Executor):
|
35
|
+
"""Simulation engine executor."""
|
36
|
+
|
37
|
+
def __init__(
|
38
|
+
self,
|
39
|
+
) -> None:
|
40
|
+
self.linkstate_factory: Optional[LinkStateFactory] = None
|
41
|
+
self.ffs_factory: Optional[FfsFactory] = None
|
42
|
+
|
43
|
+
@override
|
44
|
+
def initialize(
|
45
|
+
self, linkstate_factory: LinkStateFactory, ffs_factory: FfsFactory
|
46
|
+
) -> None:
|
47
|
+
"""Initialize the executor with the necessary factories."""
|
48
|
+
self.linkstate_factory = linkstate_factory
|
49
|
+
self.ffs_factory = ffs_factory
|
50
|
+
|
51
|
+
@property
|
52
|
+
def linkstate(self) -> LinkState:
|
53
|
+
"""Return the LinkState."""
|
54
|
+
if self.linkstate_factory is None:
|
55
|
+
raise RuntimeError("Executor is not initialized.")
|
56
|
+
return self.linkstate_factory.state()
|
57
|
+
|
58
|
+
@property
|
59
|
+
def ffs(self) -> Ffs:
|
60
|
+
"""Return the Flower File Storage (FFS)."""
|
61
|
+
if self.ffs_factory is None:
|
62
|
+
raise RuntimeError("Executor is not initialized.")
|
63
|
+
return self.ffs_factory.ffs()
|
64
|
+
|
65
|
+
@override
|
66
|
+
def set_config(
|
67
|
+
self,
|
68
|
+
config: UserConfig,
|
69
|
+
) -> None:
|
70
|
+
"""Set executor config arguments."""
|
71
|
+
|
72
|
+
# pylint: disable=too-many-locals
|
73
|
+
@override
|
74
|
+
def start_run(
|
75
|
+
self,
|
76
|
+
fab_file: bytes,
|
77
|
+
override_config: UserConfig,
|
78
|
+
federation_options: ConfigRecord,
|
79
|
+
flwr_aid: Optional[str],
|
80
|
+
) -> Optional[int]:
|
81
|
+
"""Start run using the Flower Simulation Engine."""
|
82
|
+
try:
|
83
|
+
# Check that num-supernodes is set
|
84
|
+
if "num-supernodes" not in federation_options:
|
85
|
+
raise ValueError(
|
86
|
+
"Federation options doesn't contain key `num-supernodes`."
|
87
|
+
)
|
88
|
+
|
89
|
+
# Create run
|
90
|
+
fab = Fab(hashlib.sha256(fab_file).hexdigest(), fab_file)
|
91
|
+
fab_hash = self.ffs.put(fab.content, {})
|
92
|
+
if fab_hash != fab.hash_str:
|
93
|
+
raise RuntimeError(
|
94
|
+
f"FAB ({fab.hash_str}) hash from request doesn't match contents"
|
95
|
+
)
|
96
|
+
fab_id, fab_version = get_fab_metadata(fab.content)
|
97
|
+
|
98
|
+
run_id = self.linkstate.create_run(
|
99
|
+
fab_id,
|
100
|
+
fab_version,
|
101
|
+
fab_hash,
|
102
|
+
override_config,
|
103
|
+
federation_options,
|
104
|
+
flwr_aid,
|
105
|
+
)
|
106
|
+
|
107
|
+
# Create an empty context for the Run
|
108
|
+
context = Context(
|
109
|
+
run_id=run_id,
|
110
|
+
node_id=0,
|
111
|
+
node_config={},
|
112
|
+
state=RecordDict(),
|
113
|
+
run_config={},
|
114
|
+
)
|
115
|
+
|
116
|
+
# Register the context at the LinkState
|
117
|
+
self.linkstate.set_serverapp_context(run_id=run_id, context=context)
|
118
|
+
|
119
|
+
log(INFO, "Created run %s", str(run_id))
|
120
|
+
|
121
|
+
return run_id
|
122
|
+
|
123
|
+
# pylint: disable-next=broad-except
|
124
|
+
except Exception as e:
|
125
|
+
log(ERROR, "Could not start run: %s", str(e))
|
126
|
+
return None
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Flower SuperLink servicers."""
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Exec API Servicer."""
|
16
|
+
|
17
|
+
|
18
|
+
from .exec_grpc import run_exec_api_grpc
|
19
|
+
|
20
|
+
__all__ = [
|
21
|
+
"run_exec_api_grpc",
|
22
|
+
]
|
@@ -49,7 +49,7 @@ class ExecEventLogInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
49
49
|
return continuation(handler_call_details)
|
50
50
|
|
51
51
|
# One of the method handlers in
|
52
|
-
# `flwr.
|
52
|
+
# `flwr.superlink.servicer.exec.ExecServicer`
|
53
53
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
54
54
|
method_name: str = handler_call_details.method
|
55
55
|
return self._generic_event_log_unary_method_handler(method_handler, method_name)
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""
|
15
|
+
"""Exec API server."""
|
16
16
|
|
17
17
|
|
18
18
|
from logging import INFO
|
@@ -32,12 +32,12 @@ from flwr.server.superlink.linkstate import LinkStateFactory
|
|
32
32
|
from flwr.supercore.ffs import FfsFactory
|
33
33
|
from flwr.supercore.license_plugin import LicensePlugin
|
34
34
|
from flwr.supercore.object_store import ObjectStoreFactory
|
35
|
-
from flwr.superexec.exec_event_log_interceptor import ExecEventLogInterceptor
|
36
|
-
from flwr.superexec.exec_license_interceptor import ExecLicenseInterceptor
|
37
|
-
from flwr.superexec.exec_user_auth_interceptor import ExecUserAuthInterceptor
|
38
35
|
|
36
|
+
from ...executor import Executor
|
37
|
+
from .exec_event_log_interceptor import ExecEventLogInterceptor
|
38
|
+
from .exec_license_interceptor import ExecLicenseInterceptor
|
39
39
|
from .exec_servicer import ExecServicer
|
40
|
-
from .
|
40
|
+
from .exec_user_auth_interceptor import ExecUserAuthInterceptor
|
41
41
|
|
42
42
|
try:
|
43
43
|
from flwr.ee import get_license_plugin
|
@@ -47,7 +47,7 @@ class ExecLicenseInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
47
47
|
return continuation(handler_call_details)
|
48
48
|
|
49
49
|
# One of the method handlers in
|
50
|
-
# `flwr.
|
50
|
+
# `flwr.superlink.servicer.exec.ExecServicer`
|
51
51
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
52
52
|
return self._generic_license_unary_method_handler(method_handler)
|
53
53
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""
|
15
|
+
"""Exec API servicer."""
|
16
16
|
|
17
17
|
|
18
18
|
import time
|
@@ -57,12 +57,12 @@ from flwr.server.superlink.linkstate import LinkState, LinkStateFactory
|
|
57
57
|
from flwr.supercore.ffs import FfsFactory
|
58
58
|
from flwr.supercore.object_store import ObjectStore, ObjectStoreFactory
|
59
59
|
|
60
|
+
from ...executor.executor import Executor
|
60
61
|
from .exec_user_auth_interceptor import shared_account_info
|
61
|
-
from .executor import Executor
|
62
62
|
|
63
63
|
|
64
64
|
class ExecServicer(exec_pb2_grpc.ExecServicer):
|
65
|
-
"""
|
65
|
+
"""Exec API servicer."""
|
66
66
|
|
67
67
|
def __init__( # pylint: disable=R0913, R0917
|
68
68
|
self,
|
@@ -77,7 +77,7 @@ class ExecUserAuthInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
77
77
|
return continuation(handler_call_details)
|
78
78
|
|
79
79
|
# One of the method handlers in
|
80
|
-
# `flwr.
|
80
|
+
# `flwr.superlink.servicer.exec.ExecServicer`
|
81
81
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
82
82
|
return self._generic_auth_unary_method_handler(method_handler)
|
83
83
|
|
@@ -21,7 +21,7 @@ import time
|
|
21
21
|
from collections.abc import Iterator
|
22
22
|
from contextlib import contextmanager
|
23
23
|
from functools import partial
|
24
|
-
from logging import INFO
|
24
|
+
from logging import INFO
|
25
25
|
from pathlib import Path
|
26
26
|
from typing import Callable, Optional, Union, cast
|
27
27
|
|
@@ -38,7 +38,6 @@ from flwr.common.constant import (
|
|
38
38
|
CLIENT_OCTET,
|
39
39
|
CLIENTAPPIO_API_DEFAULT_SERVER_ADDRESS,
|
40
40
|
ISOLATION_MODE_SUBPROCESS,
|
41
|
-
MAX_RETRY_DELAY,
|
42
41
|
SERVER_OCTET,
|
43
42
|
TRANSPORT_TYPE_GRPC_ADAPTER,
|
44
43
|
TRANSPORT_TYPE_GRPC_RERE,
|
@@ -54,7 +53,7 @@ from flwr.common.inflatable_utils import (
|
|
54
53
|
push_object_contents_from_iterable,
|
55
54
|
)
|
56
55
|
from flwr.common.logger import log
|
57
|
-
from flwr.common.retry_invoker import RetryInvoker,
|
56
|
+
from flwr.common.retry_invoker import RetryInvoker, _make_simple_grpc_retry_invoker
|
58
57
|
from flwr.common.telemetry import EventType
|
59
58
|
from flwr.common.typing import Fab, Run, RunNotRunningException, UserConfig
|
60
59
|
from flwr.proto.clientappio_pb2_grpc import add_ClientAppIoServicer_to_server
|
@@ -521,44 +520,14 @@ def _make_fleet_connection_retry_invoker(
|
|
521
520
|
connection_error_type: type[Exception] = RpcError,
|
522
521
|
) -> RetryInvoker:
|
523
522
|
"""Create a retry invoker for fleet connection."""
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
)
|
533
|
-
|
534
|
-
def _on_backoff(retry_state: RetryState) -> None:
|
535
|
-
if retry_state.tries == 1:
|
536
|
-
log(WARN, "Connection attempt failed, retrying...")
|
537
|
-
else:
|
538
|
-
log(
|
539
|
-
WARN,
|
540
|
-
"Connection attempt failed, retrying in %.2f seconds",
|
541
|
-
retry_state.actual_wait,
|
542
|
-
)
|
543
|
-
|
544
|
-
return RetryInvoker(
|
545
|
-
wait_gen_factory=lambda: exponential(max_delay=MAX_RETRY_DELAY),
|
546
|
-
recoverable_exceptions=connection_error_type,
|
547
|
-
max_tries=max_retries + 1 if max_retries is not None else None,
|
548
|
-
max_time=max_wait_time,
|
549
|
-
on_giveup=lambda retry_state: (
|
550
|
-
log(
|
551
|
-
WARN,
|
552
|
-
"Giving up reconnection after %.2f seconds and %s tries.",
|
553
|
-
retry_state.elapsed_time,
|
554
|
-
retry_state.tries,
|
555
|
-
)
|
556
|
-
if retry_state.tries > 1
|
557
|
-
else None
|
558
|
-
),
|
559
|
-
on_success=_on_success,
|
560
|
-
on_backoff=_on_backoff,
|
561
|
-
)
|
523
|
+
retry_invoker = _make_simple_grpc_retry_invoker()
|
524
|
+
retry_invoker.recoverable_exceptions = connection_error_type
|
525
|
+
if max_retries is not None:
|
526
|
+
retry_invoker.max_tries = max_retries + 1
|
527
|
+
if max_wait_time is not None:
|
528
|
+
retry_invoker.max_time = max_wait_time
|
529
|
+
|
530
|
+
return retry_invoker
|
562
531
|
|
563
532
|
|
564
533
|
def run_clientappio_api_grpc(
|
{flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: flwr-nightly
|
3
|
-
Version: 1.21.0.
|
3
|
+
Version: 1.21.0.dev20250801
|
4
4
|
Summary: Flower: A Friendly Federated AI Framework
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: Artificial Intelligence,Federated AI,Federated Analytics,Federated Evaluation,Federated Learning,Flower,Machine Learning
|
{flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/RECORD
RENAMED
@@ -84,7 +84,7 @@ flwr/client/grpc_adapter_client/__init__.py,sha256=RQWP5mFPROLHKgombiRvPXVWSoVrQ
|
|
84
84
|
flwr/client/grpc_adapter_client/connection.py,sha256=JGv02EjSOAG1E5BRUD4lwXc1LLiYJ0OhInvp31qx1cU,4404
|
85
85
|
flwr/client/grpc_rere_client/__init__.py,sha256=i7iS0Lt8B7q0E2L72e4F_YrKm6ClRKnd71PNA6PW2O0,752
|
86
86
|
flwr/client/grpc_rere_client/client_interceptor.py,sha256=zFaVHw6AxeNO-7eCKKb-RxrPa7zbM5Z-2-1Efc4adQY,2451
|
87
|
-
flwr/client/grpc_rere_client/connection.py,sha256=
|
87
|
+
flwr/client/grpc_rere_client/connection.py,sha256=uLcXAJoHHLVm4SVR3oFCpdqHrZJcT_kGqfC1g8reXAM,13008
|
88
88
|
flwr/client/grpc_rere_client/grpc_adapter.py,sha256=dLGB5GriszAmtgvuFGuz_F7rIwpzLfDxhJ7T3Un-Ce0,6694
|
89
89
|
flwr/client/message_handler/__init__.py,sha256=0lyljDVqre3WljiZbPcwCCf8GiIaSVI_yo_ylEyPwSE,719
|
90
90
|
flwr/client/message_handler/message_handler.py,sha256=X9SXX6et97Lw9_DGD93HKsEBGNjXClcFgc_5aLK0oiU,6541
|
@@ -98,13 +98,13 @@ flwr/client/mod/secure_aggregation/secaggplus_mod.py,sha256=aKqjZCrikF73y3E-7h40
|
|
98
98
|
flwr/client/mod/utils.py,sha256=FUgD2TfcWqSeF6jUKZ4i6Ke56U4Nrv85AeVb93s6R9g,1201
|
99
99
|
flwr/client/numpy_client.py,sha256=Qq6ghsIAop2slKqAfgiI5NiHJ4LIxGmrik3Ror4_XVc,9581
|
100
100
|
flwr/client/rest_client/__init__.py,sha256=MBiuK62hj439m9rtwSwI184Hth6Tt5GbmpNMyl3zkZY,735
|
101
|
-
flwr/client/rest_client/connection.py,sha256=
|
101
|
+
flwr/client/rest_client/connection.py,sha256=fyiS1aXTv71jWczx7mSco94LYJTBXgTF-p2PnAk3CL8,15784
|
102
102
|
flwr/client/run_info_store.py,sha256=MaJ3UQ-07hWtK67wnWu0zR29jrk0fsfgJX506dvEOfE,4042
|
103
103
|
flwr/client/typing.py,sha256=Jw3rawDzI_-ZDcRmEQcs5gZModY7oeQlEeltYsdOhlU,1048
|
104
104
|
flwr/clientapp/__init__.py,sha256=zGW4z49Ojzoi1hDiRC7kyhLjijUilc6fqHhtM_ATRVA,719
|
105
105
|
flwr/common/__init__.py,sha256=5GCLVk399Az_rTJHNticRlL0Sl_oPw_j5_LuFKfX7-M,4171
|
106
106
|
flwr/common/address.py,sha256=9JucdTwlc-jpeJkRKeUboZoacUtErwSVtnDR9kAtLqE,4119
|
107
|
-
flwr/common/args.py,sha256
|
107
|
+
flwr/common/args.py,sha256=XFQ5PU0lU7NS1QCiKhhESHVeL8KSjcD3x8h4P3e5qlM,5298
|
108
108
|
flwr/common/auth_plugin/__init__.py,sha256=3rzPkVLn9WyB5n7HLk1XGDw3SLCqRWAU1_CnglcWPfw,970
|
109
109
|
flwr/common/auth_plugin/auth_plugin.py,sha256=kXx5o39vJchaPv28sK9qO6H_UXSWym6zRBbCa7sUwtQ,4825
|
110
110
|
flwr/common/config.py,sha256=glcZDjco-amw1YfQcYTFJ4S1pt9APoexT-mf1QscuHs,13960
|
@@ -140,7 +140,7 @@ flwr/common/record/metricrecord.py,sha256=KOyJjJbvFV6IwBPbgm92FZ_0_hXpMHuwfCi1rh
|
|
140
140
|
flwr/common/record/recorddict.py,sha256=p7hBimFpKM1XKUe6OAkR_7pYGzGL_EwUJUvJ8odZEcY,14986
|
141
141
|
flwr/common/record/typeddict.py,sha256=dDKgUThs2BscYUNcgP82KP8-qfAYXYftDrf2LszAC_o,3599
|
142
142
|
flwr/common/recorddict_compat.py,sha256=D5SqXWkqBddn5b6K_5UoH7aZ11UaN3lDTlzvHx3-rqk,14119
|
143
|
-
flwr/common/retry_invoker.py,sha256=
|
143
|
+
flwr/common/retry_invoker.py,sha256=uQeDcgoTgmFwhJ0mkDE2eNz2acF9eShaqMOO5boGrPQ,15285
|
144
144
|
flwr/common/secure_aggregation/__init__.py,sha256=MgW6uHGhyFLBAYQqa1Vzs5n2Gc0d4yEw1_NmerFir70,731
|
145
145
|
flwr/common/secure_aggregation/crypto/__init__.py,sha256=5E4q4-Fw0CNz4tLah_QHj7m_rDeM4ucHcFlPWB_Na3Q,738
|
146
146
|
flwr/common/secure_aggregation/crypto/shamir.py,sha256=N8pPa5cEksowNoAqfFm5SP3IuxuVi9GGMa3JOtPniQY,3954
|
@@ -230,7 +230,7 @@ flwr/proto/transport_pb2_grpc.py,sha256=vLN3EHtx2aEEMCO4f1Upu-l27BPzd3-5pV-u8wPc
|
|
230
230
|
flwr/proto/transport_pb2_grpc.pyi,sha256=AGXf8RiIiW2J5IKMlm_3qT3AzcDa4F3P5IqUjve_esA,766
|
231
231
|
flwr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
232
232
|
flwr/server/__init__.py,sha256=LQQHiuL2jy7TpNaKastRdGsexlxSt5ZWAQNVqitDnrY,1598
|
233
|
-
flwr/server/app.py,sha256=
|
233
|
+
flwr/server/app.py,sha256=LdEZVa0FzRTMQstBidH1MBXkrXRIH2sqIX-aj7Iah9A,29493
|
234
234
|
flwr/server/client_manager.py,sha256=5jCGavVli7XdupvWWo7ru3PdFTlRU8IGvHFSSoUVLRs,6227
|
235
235
|
flwr/server/client_proxy.py,sha256=sv0E9AldBYOvc3pusqFh-GnyreeMfsXQ1cuTtxTq_wY,2399
|
236
236
|
flwr/server/compat/__init__.py,sha256=0IsttWvY15qO98_1GyzVC-vR1e_ZPXOdu2qUlOkYMPE,886
|
@@ -348,16 +348,21 @@ flwr/supercore/scheduler/__init__.py,sha256=E4GviiNJoZKz1dOao8ZGRHExsiM23GtOrkpM
|
|
348
348
|
flwr/supercore/scheduler/plugin.py,sha256=kIv0JUrHP-ghrcGT-pbporL9A2mUz8PxASw6KgxCRv8,2460
|
349
349
|
flwr/supercore/utils.py,sha256=ebuHMbeA8eXisX0oMPqBK3hk7uVnIE_yiqWVz8YbkpQ,1324
|
350
350
|
flwr/superexec/__init__.py,sha256=YFqER0IJc1XEWfsX6AxZ9LSRq0sawPYrNYki-brvTIc,715
|
351
|
-
flwr/superexec/
|
352
|
-
flwr/superexec/
|
353
|
-
flwr/superexec/exec_event_log_interceptor.py,sha256=bHBpjRDh-GgLxELNP9ofES7hCEAR_M78wuJZ06vXRLg,5942
|
354
|
-
flwr/superexec/exec_grpc.py,sha256=D7xPHEXjW4SXMb9_dWNZhbFFxUeKr8zE67LITZQbHU8,4148
|
355
|
-
flwr/superexec/exec_license_interceptor.py,sha256=rpnQmHE9FR11EJ3Lwd4_ducvlSHj5hS_SHAMbbZwXlk,3328
|
356
|
-
flwr/superexec/exec_servicer.py,sha256=c0nwdFBiS6CbKrRA7ffOpsgASOLeaRV_ICwxDfxNGAg,12498
|
357
|
-
flwr/superexec/exec_user_auth_interceptor.py,sha256=InqJo9QQu2QQYYusxtmb3EtKdvJECQ1xtvwy5DVF-c0,6196
|
358
|
-
flwr/superexec/executor.py,sha256=LaErHRJvNggjWV6FI6eajgKfnwOvSv2UqzFH253yDro,3265
|
359
|
-
flwr/superexec/simulation.py,sha256=62rSLcS-1wnMsMsafSQuIDLs5ZS6Ail1spkZ-alNNTg,4156
|
351
|
+
flwr/superexec/deployment.py,sha256=CEgWfkN_lH6Vci03RjwKLENw2z6kxNvUdVEErPbqYDY,830
|
352
|
+
flwr/superexec/simulation.py,sha256=wR3ERp_UdWJCkkLdJD7Rk5uVpWJtOqHuyhbq7Sm2tGE,830
|
360
353
|
flwr/superlink/__init__.py,sha256=GNSuJ4-N6Z8wun2iZNlXqENt5beUyzC0Gi_tN396bbM,707
|
354
|
+
flwr/superlink/executor/__init__.py,sha256=5ZAe4Nj8DflRFTvhAsQ3nr2b-mvNuBisuxTuMwvWsCs,958
|
355
|
+
flwr/superlink/executor/app.py,sha256=AALlkJKgGTeGOARf8G6TBEmO_WdOpmL4dHYpcGWX-Hc,1474
|
356
|
+
flwr/superlink/executor/deployment.py,sha256=whB1k_DE37SqplisFt0nu190BtoqPKRX9Xz86fqm3FU,6765
|
357
|
+
flwr/superlink/executor/executor.py,sha256=LaErHRJvNggjWV6FI6eajgKfnwOvSv2UqzFH253yDro,3265
|
358
|
+
flwr/superlink/executor/simulation.py,sha256=fLy18Bdsfxpxu41vAtBzTy1QLl0iJAdW7UmicBUnRJQ,4124
|
359
|
+
flwr/superlink/servicer/__init__.py,sha256=ZC-kILcUGeh6IxJsfu24cTzUqIGXmQfEKsGfhsnhBpM,717
|
360
|
+
flwr/superlink/servicer/exec/__init__.py,sha256=_06QLcljT-Ihf_9peAkjMm9y1tEDmDRfic_vfGwJk0o,791
|
361
|
+
flwr/superlink/servicer/exec/exec_event_log_interceptor.py,sha256=8sX0-GKYZwNftRr7hP0fBhy7LLzNzi9F4tcjrQ_a6Zo,5942
|
362
|
+
flwr/superlink/servicer/exec/exec_grpc.py,sha256=7l7LmL2LZTd1Vd5b7M_lOaTO9-otvqgWUKQrgl5CPls,4105
|
363
|
+
flwr/superlink/servicer/exec/exec_license_interceptor.py,sha256=cCK4pMaoEv6_pRs6psKsIuouLRGy9kkChQY3TcQDgg4,3328
|
364
|
+
flwr/superlink/servicer/exec/exec_servicer.py,sha256=89B0fwA3CX_4Dd7151qsHdgyEYQEnOq4hTZloA_zO10,12499
|
365
|
+
flwr/superlink/servicer/exec/exec_user_auth_interceptor.py,sha256=XMWX36JgVqsaIorQuenyIzImslCvg-UCC92yu44wneo,6196
|
361
366
|
flwr/supernode/__init__.py,sha256=KgeCaVvXWrU3rptNR1y0oBp4YtXbAcrnCcJAiOoWkI4,707
|
362
367
|
flwr/supernode/cli/__init__.py,sha256=JuEMr0-s9zv-PEWKuLB9tj1ocNfroSyNJ-oyv7ati9A,887
|
363
368
|
flwr/supernode/cli/flower_supernode.py,sha256=fAkk9zGhoP8Sv05EkdXRiCtirTAzWkSZBqRoaDdgflk,8529
|
@@ -373,8 +378,8 @@ flwr/supernode/scheduler/simple_clientapp_scheduler_plugin.py,sha256=nnNuKhelrAE
|
|
373
378
|
flwr/supernode/servicer/__init__.py,sha256=lucTzre5WPK7G1YLCfaqg3rbFWdNSb7ZTt-ca8gxdEo,717
|
374
379
|
flwr/supernode/servicer/clientappio/__init__.py,sha256=7Oy62Y_oijqF7Dxi6tpcUQyOpLc_QpIRZ83NvwmB0Yg,813
|
375
380
|
flwr/supernode/servicer/clientappio/clientappio_servicer.py,sha256=ClPoKco7Tjj_cxRPhZlQSrOvcGa8sJwGs26LUNZnI3Y,10608
|
376
|
-
flwr/supernode/start_client_internal.py,sha256=
|
377
|
-
flwr_nightly-1.21.0.
|
378
|
-
flwr_nightly-1.21.0.
|
379
|
-
flwr_nightly-1.21.0.
|
380
|
-
flwr_nightly-1.21.0.
|
381
|
+
flwr/supernode/start_client_internal.py,sha256=iqJR8WbCW-8RQIRNwARZYoxhnlaAo5KnluCOEfRoLWM,21020
|
382
|
+
flwr_nightly-1.21.0.dev20250801.dist-info/METADATA,sha256=bK5pwB6ZuUZaeFGcYNCDjT0D5q6NgZvI3WVbzjZhjBg,15966
|
383
|
+
flwr_nightly-1.21.0.dev20250801.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
384
|
+
flwr_nightly-1.21.0.dev20250801.dist-info/entry_points.txt,sha256=jNpDXGBGgs21RqUxelF_jwGaxtqFwm-MQyfz-ZqSjrA,367
|
385
|
+
flwr_nightly-1.21.0.dev20250801.dist-info/RECORD,,
|
File without changes
|
{flwr_nightly-1.21.0.dev20250730.dist-info → flwr_nightly-1.21.0.dev20250801.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|