flwr-nightly 1.10.0.dev20240612__py3-none-any.whl → 1.10.0.dev20240624__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/cli/app.py +3 -0
- flwr/cli/build.py +6 -8
- flwr/cli/config_utils.py +53 -3
- flwr/cli/install.py +35 -20
- flwr/cli/new/new.py +104 -28
- flwr/cli/new/templates/app/README.flowertune.md.tpl +56 -0
- flwr/cli/new/templates/app/code/flwr_tune/__init__.py +15 -0
- flwr/cli/new/templates/app/code/flwr_tune/app.py.tpl +86 -0
- flwr/cli/new/templates/app/code/flwr_tune/client.py.tpl +124 -0
- flwr/cli/new/templates/app/code/flwr_tune/config.yaml.tpl +34 -0
- flwr/cli/new/templates/app/code/flwr_tune/dataset.py.tpl +57 -0
- flwr/cli/new/templates/app/code/flwr_tune/models.py.tpl +59 -0
- flwr/cli/new/templates/app/code/flwr_tune/server.py.tpl +48 -0
- flwr/cli/new/templates/app/code/flwr_tune/static_config.yaml.tpl +11 -0
- flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +42 -0
- flwr/cli/run/run.py +46 -2
- flwr/client/__init__.py +1 -1
- flwr/client/app.py +22 -10
- flwr/client/client_app.py +1 -1
- flwr/client/dpfedavg_numpy_client.py +1 -1
- flwr/client/grpc_adapter_client/__init__.py +15 -0
- flwr/client/grpc_adapter_client/connection.py +94 -0
- flwr/client/grpc_client/connection.py +5 -1
- flwr/client/grpc_rere_client/__init__.py +1 -1
- flwr/client/grpc_rere_client/connection.py +9 -2
- flwr/client/grpc_rere_client/grpc_adapter.py +133 -0
- flwr/client/message_handler/__init__.py +1 -1
- flwr/client/message_handler/message_handler.py +1 -1
- flwr/client/mod/__init__.py +4 -4
- flwr/client/mod/secure_aggregation/__init__.py +1 -1
- flwr/client/mod/utils.py +1 -1
- flwr/client/rest_client/__init__.py +1 -1
- flwr/client/rest_client/connection.py +10 -2
- flwr/client/supernode/app.py +141 -41
- flwr/common/__init__.py +12 -12
- flwr/common/address.py +1 -1
- flwr/common/config.py +73 -0
- flwr/common/constant.py +16 -1
- flwr/common/date.py +1 -1
- flwr/common/dp.py +1 -1
- flwr/common/grpc.py +1 -1
- flwr/common/object_ref.py +39 -5
- flwr/common/record/__init__.py +1 -1
- flwr/common/secure_aggregation/__init__.py +1 -1
- flwr/common/secure_aggregation/crypto/__init__.py +1 -1
- flwr/common/secure_aggregation/crypto/shamir.py +1 -1
- flwr/common/secure_aggregation/crypto/symmetric_encryption.py +1 -1
- flwr/common/secure_aggregation/ndarrays_arithmetic.py +1 -1
- flwr/common/secure_aggregation/quantization.py +1 -1
- flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
- flwr/common/secure_aggregation/secaggplus_utils.py +1 -1
- flwr/common/telemetry.py +4 -0
- flwr/common/typing.py +9 -0
- flwr/common/version.py +14 -0
- flwr/proto/exec_pb2.py +34 -0
- flwr/proto/exec_pb2.pyi +55 -0
- flwr/proto/exec_pb2_grpc.py +101 -0
- flwr/proto/exec_pb2_grpc.pyi +41 -0
- flwr/proto/fab_pb2.py +30 -0
- flwr/proto/fab_pb2.pyi +56 -0
- flwr/proto/fab_pb2_grpc.py +4 -0
- flwr/proto/fab_pb2_grpc.pyi +4 -0
- flwr/server/__init__.py +2 -2
- flwr/server/app.py +62 -25
- flwr/server/compat/app.py +1 -1
- flwr/server/compat/app_utils.py +1 -1
- flwr/server/compat/driver_client_proxy.py +1 -1
- flwr/server/driver/driver.py +6 -0
- flwr/server/driver/grpc_driver.py +85 -63
- flwr/server/driver/inmemory_driver.py +28 -26
- flwr/server/run_serverapp.py +65 -20
- flwr/server/strategy/__init__.py +2 -2
- flwr/server/strategy/bulyan.py +1 -1
- flwr/server/strategy/dpfedavg_adaptive.py +1 -1
- flwr/server/strategy/dpfedavg_fixed.py +1 -1
- flwr/server/strategy/fedadagrad.py +1 -1
- flwr/server/strategy/fedadam.py +1 -1
- flwr/server/strategy/fedavg_android.py +1 -1
- flwr/server/strategy/fedavgm.py +1 -1
- flwr/server/strategy/fedmedian.py +1 -1
- flwr/server/strategy/fedopt.py +1 -1
- flwr/server/strategy/fedprox.py +1 -1
- flwr/server/strategy/fedxgb_bagging.py +1 -1
- flwr/server/strategy/fedxgb_cyclic.py +1 -1
- flwr/server/strategy/fedxgb_nn_avg.py +1 -1
- flwr/server/strategy/fedyogi.py +1 -1
- flwr/server/strategy/krum.py +1 -1
- flwr/server/strategy/qfedavg.py +1 -1
- flwr/server/superlink/driver/__init__.py +1 -1
- flwr/server/superlink/driver/driver_grpc.py +1 -1
- flwr/server/superlink/driver/driver_servicer.py +15 -3
- flwr/server/superlink/fleet/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_adapter/__init__.py +15 -0
- flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +131 -0
- flwr/server/superlink/fleet/grpc_bidi/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +5 -1
- flwr/server/superlink/fleet/grpc_rere/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +1 -1
- flwr/server/superlink/fleet/message_handler/__init__.py +1 -1
- flwr/server/superlink/fleet/message_handler/message_handler.py +4 -4
- flwr/server/superlink/fleet/rest_rere/__init__.py +1 -1
- flwr/server/superlink/fleet/rest_rere/rest_api.py +1 -1
- flwr/server/superlink/fleet/vce/backend/raybackend.py +44 -25
- flwr/server/superlink/fleet/vce/vce_api.py +3 -1
- flwr/server/superlink/state/__init__.py +1 -1
- flwr/server/superlink/state/in_memory_state.py +9 -6
- flwr/server/superlink/state/sqlite_state.py +7 -4
- flwr/server/superlink/state/state.py +6 -5
- flwr/server/superlink/state/state_factory.py +11 -2
- flwr/server/utils/__init__.py +1 -1
- flwr/server/utils/tensorboard.py +1 -1
- flwr/simulation/__init__.py +5 -2
- flwr/simulation/app.py +1 -1
- flwr/simulation/ray_transport/__init__.py +1 -1
- flwr/simulation/ray_transport/ray_actor.py +0 -6
- flwr/simulation/ray_transport/ray_client_proxy.py +1 -1
- flwr/simulation/run_simulation.py +63 -22
- flwr/superexec/__init__.py +21 -0
- flwr/superexec/app.py +178 -0
- flwr/superexec/exec_grpc.py +51 -0
- flwr/superexec/exec_servicer.py +65 -0
- flwr/superexec/executor.py +54 -0
- {flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/METADATA +2 -1
- {flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/RECORD +130 -101
- {flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/entry_points.txt +1 -0
- {flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/WHEEL +0 -0
flwr/superexec/app.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Copyright 2024 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 SuperExec app."""
|
|
16
|
+
|
|
17
|
+
import argparse
|
|
18
|
+
import sys
|
|
19
|
+
from logging import INFO, WARN
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Optional, Tuple
|
|
22
|
+
|
|
23
|
+
import grpc
|
|
24
|
+
|
|
25
|
+
from flwr.common import EventType, event, log
|
|
26
|
+
from flwr.common.address import parse_address
|
|
27
|
+
from flwr.common.constant import SUPEREXEC_DEFAULT_ADDRESS
|
|
28
|
+
from flwr.common.exit_handlers import register_exit_handlers
|
|
29
|
+
from flwr.common.object_ref import load_app, validate
|
|
30
|
+
|
|
31
|
+
from .exec_grpc import run_superexec_api_grpc
|
|
32
|
+
from .executor import Executor
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def run_superexec() -> None:
|
|
36
|
+
"""Run Flower SuperExec."""
|
|
37
|
+
log(INFO, "Starting Flower SuperExec")
|
|
38
|
+
|
|
39
|
+
event(EventType.RUN_SUPEREXEC_ENTER)
|
|
40
|
+
|
|
41
|
+
args = _parse_args_run_superexec().parse_args()
|
|
42
|
+
|
|
43
|
+
# Parse IP address
|
|
44
|
+
parsed_address = parse_address(args.address)
|
|
45
|
+
if not parsed_address:
|
|
46
|
+
sys.exit(f"SuperExec IP address ({args.address}) cannot be parsed.")
|
|
47
|
+
host, port, is_v6 = parsed_address
|
|
48
|
+
address = f"[{host}]:{port}" if is_v6 else f"{host}:{port}"
|
|
49
|
+
|
|
50
|
+
# Obtain certificates
|
|
51
|
+
certificates = _try_obtain_certificates(args)
|
|
52
|
+
|
|
53
|
+
# Start SuperExec API
|
|
54
|
+
superexec_server: grpc.Server = run_superexec_api_grpc(
|
|
55
|
+
address=address,
|
|
56
|
+
executor=_load_executor(args),
|
|
57
|
+
certificates=certificates,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
grpc_servers = [superexec_server]
|
|
61
|
+
|
|
62
|
+
# Graceful shutdown
|
|
63
|
+
register_exit_handlers(
|
|
64
|
+
event_type=EventType.RUN_SUPEREXEC_LEAVE,
|
|
65
|
+
grpc_servers=grpc_servers,
|
|
66
|
+
bckg_threads=None,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
superexec_server.wait_for_termination()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _parse_args_run_superexec() -> argparse.ArgumentParser:
|
|
73
|
+
"""Parse command line arguments for SuperExec."""
|
|
74
|
+
parser = argparse.ArgumentParser(
|
|
75
|
+
description="Start a Flower SuperExec",
|
|
76
|
+
)
|
|
77
|
+
parser.add_argument(
|
|
78
|
+
"executor",
|
|
79
|
+
help="For example: `deployment:exec` or `project.package.module:wrapper.exec`.",
|
|
80
|
+
)
|
|
81
|
+
parser.add_argument(
|
|
82
|
+
"--address",
|
|
83
|
+
help="SuperExec (gRPC) server address (IPv4, IPv6, or a domain name)",
|
|
84
|
+
default=SUPEREXEC_DEFAULT_ADDRESS,
|
|
85
|
+
)
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
"--executor-dir",
|
|
88
|
+
help="The directory for the executor.",
|
|
89
|
+
default=".",
|
|
90
|
+
)
|
|
91
|
+
parser.add_argument(
|
|
92
|
+
"--insecure",
|
|
93
|
+
action="store_true",
|
|
94
|
+
help="Run the SuperExec without HTTPS, regardless of whether certificate "
|
|
95
|
+
"paths are provided. By default, the server runs with HTTPS enabled. "
|
|
96
|
+
"Use this flag only if you understand the risks.",
|
|
97
|
+
)
|
|
98
|
+
parser.add_argument(
|
|
99
|
+
"--ssl-certfile",
|
|
100
|
+
help="SuperExec server SSL certificate file (as a path str) "
|
|
101
|
+
"to create a secure connection.",
|
|
102
|
+
type=str,
|
|
103
|
+
default=None,
|
|
104
|
+
)
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"--ssl-keyfile",
|
|
107
|
+
help="SuperExec server SSL private key file (as a path str) "
|
|
108
|
+
"to create a secure connection.",
|
|
109
|
+
type=str,
|
|
110
|
+
)
|
|
111
|
+
parser.add_argument(
|
|
112
|
+
"--ssl-ca-certfile",
|
|
113
|
+
help="SuperExec server SSL CA certificate file (as a path str) "
|
|
114
|
+
"to create a secure connection.",
|
|
115
|
+
type=str,
|
|
116
|
+
)
|
|
117
|
+
return parser
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _try_obtain_certificates(
|
|
121
|
+
args: argparse.Namespace,
|
|
122
|
+
) -> Optional[Tuple[bytes, bytes, bytes]]:
|
|
123
|
+
# Obtain certificates
|
|
124
|
+
if args.insecure:
|
|
125
|
+
log(WARN, "Option `--insecure` was set. Starting insecure HTTP server.")
|
|
126
|
+
return None
|
|
127
|
+
# Check if certificates are provided
|
|
128
|
+
if args.ssl_certfile and args.ssl_keyfile and args.ssl_ca_certfile:
|
|
129
|
+
if not Path.is_file(args.ssl_ca_certfile):
|
|
130
|
+
sys.exit("Path argument `--ssl-ca-certfile` does not point to a file.")
|
|
131
|
+
if not Path.is_file(args.ssl_certfile):
|
|
132
|
+
sys.exit("Path argument `--ssl-certfile` does not point to a file.")
|
|
133
|
+
if not Path.is_file(args.ssl_keyfile):
|
|
134
|
+
sys.exit("Path argument `--ssl-keyfile` does not point to a file.")
|
|
135
|
+
certificates = (
|
|
136
|
+
Path(args.ssl_ca_certfile).read_bytes(), # CA certificate
|
|
137
|
+
Path(args.ssl_certfile).read_bytes(), # server certificate
|
|
138
|
+
Path(args.ssl_keyfile).read_bytes(), # server private key
|
|
139
|
+
)
|
|
140
|
+
return certificates
|
|
141
|
+
if args.ssl_certfile or args.ssl_keyfile or args.ssl_ca_certfile:
|
|
142
|
+
sys.exit(
|
|
143
|
+
"You need to provide valid file paths to `--ssl-certfile`, "
|
|
144
|
+
"`--ssl-keyfile`, and `—-ssl-ca-certfile` to create a secure "
|
|
145
|
+
"connection in SuperExec server (gRPC-rere)."
|
|
146
|
+
)
|
|
147
|
+
sys.exit(
|
|
148
|
+
"Certificates are required unless running in insecure mode. "
|
|
149
|
+
"Please provide certificate paths to `--ssl-certfile`, "
|
|
150
|
+
"`--ssl-keyfile`, and `—-ssl-ca-certfile` or run the server "
|
|
151
|
+
"in insecure mode using '--insecure' if you understand the risks."
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _load_executor(
|
|
156
|
+
args: argparse.Namespace,
|
|
157
|
+
) -> Executor:
|
|
158
|
+
"""Get the executor plugin."""
|
|
159
|
+
if args.executor_dir is not None:
|
|
160
|
+
sys.path.insert(0, args.executor_dir)
|
|
161
|
+
|
|
162
|
+
executor_ref: str = args.executor
|
|
163
|
+
valid, error_msg = validate(executor_ref)
|
|
164
|
+
if not valid and error_msg:
|
|
165
|
+
raise LoadExecutorError(error_msg) from None
|
|
166
|
+
|
|
167
|
+
executor = load_app(executor_ref, LoadExecutorError, args.executor_dir)
|
|
168
|
+
|
|
169
|
+
if not isinstance(executor, Executor):
|
|
170
|
+
raise LoadExecutorError(
|
|
171
|
+
f"Attribute {executor_ref} is not of type {Executor}",
|
|
172
|
+
) from None
|
|
173
|
+
|
|
174
|
+
return executor
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class LoadExecutorError(Exception):
|
|
178
|
+
"""Error when trying to load `Executor`."""
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
"""SuperExec gRPC API."""
|
|
16
|
+
|
|
17
|
+
from logging import INFO
|
|
18
|
+
from typing import Optional, Tuple
|
|
19
|
+
|
|
20
|
+
import grpc
|
|
21
|
+
|
|
22
|
+
from flwr.common import GRPC_MAX_MESSAGE_LENGTH
|
|
23
|
+
from flwr.common.logger import log
|
|
24
|
+
from flwr.proto.exec_pb2_grpc import add_ExecServicer_to_server
|
|
25
|
+
from flwr.server.superlink.fleet.grpc_bidi.grpc_server import generic_create_grpc_server
|
|
26
|
+
|
|
27
|
+
from .exec_servicer import ExecServicer
|
|
28
|
+
from .executor import Executor
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def run_superexec_api_grpc(
|
|
32
|
+
address: str,
|
|
33
|
+
executor: Executor,
|
|
34
|
+
certificates: Optional[Tuple[bytes, bytes, bytes]],
|
|
35
|
+
) -> grpc.Server:
|
|
36
|
+
"""Run SuperExec API (gRPC, request-response)."""
|
|
37
|
+
exec_servicer: grpc.Server = ExecServicer(
|
|
38
|
+
executor=executor,
|
|
39
|
+
)
|
|
40
|
+
superexec_add_servicer_to_server_fn = add_ExecServicer_to_server
|
|
41
|
+
superexec_grpc_server = generic_create_grpc_server(
|
|
42
|
+
servicer_and_add_fn=(exec_servicer, superexec_add_servicer_to_server_fn),
|
|
43
|
+
server_address=address,
|
|
44
|
+
max_message_length=GRPC_MAX_MESSAGE_LENGTH,
|
|
45
|
+
certificates=certificates,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
log(INFO, "Flower ECE: Starting SuperExec API (gRPC-rere) on %s", address)
|
|
49
|
+
superexec_grpc_server.start()
|
|
50
|
+
|
|
51
|
+
return superexec_grpc_server
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
"""SuperExec API servicer."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
from logging import ERROR, INFO
|
|
19
|
+
from typing import Any, Dict, Generator
|
|
20
|
+
|
|
21
|
+
import grpc
|
|
22
|
+
|
|
23
|
+
from flwr.common.logger import log
|
|
24
|
+
from flwr.proto import exec_pb2_grpc # pylint: disable=E0611
|
|
25
|
+
from flwr.proto.exec_pb2 import ( # pylint: disable=E0611
|
|
26
|
+
StartRunRequest,
|
|
27
|
+
StartRunResponse,
|
|
28
|
+
StreamLogsRequest,
|
|
29
|
+
StreamLogsResponse,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
from .executor import Executor, RunTracker
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ExecServicer(exec_pb2_grpc.ExecServicer):
|
|
36
|
+
"""SuperExec API servicer."""
|
|
37
|
+
|
|
38
|
+
def __init__(self, executor: Executor) -> None:
|
|
39
|
+
self.executor = executor
|
|
40
|
+
self.runs: Dict[int, RunTracker] = {}
|
|
41
|
+
|
|
42
|
+
def StartRun(
|
|
43
|
+
self, request: StartRunRequest, context: grpc.ServicerContext
|
|
44
|
+
) -> StartRunResponse:
|
|
45
|
+
"""Create run ID."""
|
|
46
|
+
log(INFO, "ExecServicer.StartRun")
|
|
47
|
+
|
|
48
|
+
run = self.executor.start_run(request.fab_file)
|
|
49
|
+
|
|
50
|
+
if run is None:
|
|
51
|
+
log(ERROR, "Executor failed to start run")
|
|
52
|
+
return StartRunResponse()
|
|
53
|
+
|
|
54
|
+
self.runs[run.run_id] = run
|
|
55
|
+
|
|
56
|
+
return StartRunResponse(run_id=run.run_id)
|
|
57
|
+
|
|
58
|
+
def StreamLogs(
|
|
59
|
+
self, request: StreamLogsRequest, context: grpc.ServicerContext
|
|
60
|
+
) -> Generator[StreamLogsResponse, Any, None]:
|
|
61
|
+
"""Get logs."""
|
|
62
|
+
logs = ["a", "b", "c"]
|
|
63
|
+
while context.is_active():
|
|
64
|
+
for i in range(len(logs)): # pylint: disable=C0200
|
|
65
|
+
yield StreamLogsResponse(log_output=logs[i])
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
"""Execute and monitor a Flower run."""
|
|
16
|
+
|
|
17
|
+
from abc import ABC, abstractmethod
|
|
18
|
+
from dataclasses import dataclass
|
|
19
|
+
from subprocess import Popen
|
|
20
|
+
from typing import Optional
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class RunTracker:
|
|
25
|
+
"""Track a Flower run (composed of a run_id and the associated process)."""
|
|
26
|
+
|
|
27
|
+
run_id: int
|
|
28
|
+
proc: Popen # type: ignore
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Executor(ABC):
|
|
32
|
+
"""Execute and monitor a Flower run."""
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def start_run(
|
|
36
|
+
self,
|
|
37
|
+
fab_file: bytes,
|
|
38
|
+
) -> Optional[RunTracker]:
|
|
39
|
+
"""Start a run using the given Flower FAB ID and version.
|
|
40
|
+
|
|
41
|
+
This method creates a new run on the SuperLink, returns its run_id
|
|
42
|
+
and also starts the run execution.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
fab_file : bytes
|
|
47
|
+
The Flower App Bundle file bytes.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
run_id : Optional[RunTracker]
|
|
52
|
+
The run_id and the associated process of the run created by the SuperLink,
|
|
53
|
+
or `None` if it fails.
|
|
54
|
+
"""
|
{flwr_nightly-1.10.0.dev20240612.dist-info → flwr_nightly-1.10.0.dev20240624.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flwr-nightly
|
|
3
|
-
Version: 1.10.0.
|
|
3
|
+
Version: 1.10.0.dev20240624
|
|
4
4
|
Summary: Flower: A Friendly Federated Learning Framework
|
|
5
5
|
Home-page: https://flower.ai
|
|
6
6
|
License: Apache-2.0
|
|
@@ -204,6 +204,7 @@ Other [examples](https://github.com/adap/flower/tree/main/examples):
|
|
|
204
204
|
- [Flower with KaplanMeierFitter from the lifelines library](https://github.com/adap/flower/tree/main/examples/federated-kaplan-meier-fitter)
|
|
205
205
|
- [Sample Level Privacy with Opacus](https://github.com/adap/flower/tree/main/examples/opacus)
|
|
206
206
|
- [Sample Level Privacy with TensorFlow-Privacy](https://github.com/adap/flower/tree/main/examples/tensorflow-privacy)
|
|
207
|
+
- [Flower with a Tabular Dataset](https://github.com/adap/flower/tree/main/examples/fl-tabular)
|
|
207
208
|
|
|
208
209
|
## Community
|
|
209
210
|
|