flwr-nightly 1.9.0.dev20240531__py3-none-any.whl → 1.10.0.dev20240619__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 +2 -0
- flwr/cli/build.py +4 -15
- flwr/cli/config_utils.py +64 -7
- flwr/cli/install.py +211 -0
- flwr/cli/new/templates/app/pyproject.hf.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.jax.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +1 -1
- flwr/cli/run/run.py +39 -2
- flwr/cli/utils.py +14 -0
- flwr/client/__init__.py +1 -0
- flwr/client/app.py +153 -103
- flwr/client/client_app.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/client_interceptor.py +1 -1
- flwr/client/grpc_rere_client/connection.py +9 -5
- flwr/client/grpc_rere_client/grpc_adapter.py +133 -0
- flwr/client/mod/__init__.py +4 -4
- flwr/client/rest_client/connection.py +10 -3
- flwr/client/supernode/app.py +155 -31
- flwr/common/__init__.py +12 -12
- flwr/common/config.py +71 -0
- flwr/common/constant.py +15 -0
- flwr/common/object_ref.py +52 -14
- flwr/common/record/__init__.py +1 -1
- flwr/common/telemetry.py +4 -0
- flwr/common/typing.py +9 -0
- flwr/proto/driver_pb2.py +20 -19
- flwr/proto/driver_pb2_grpc.py +35 -0
- flwr/proto/driver_pb2_grpc.pyi +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/proto/fleet_pb2.py +28 -33
- flwr/proto/fleet_pb2.pyi +0 -42
- flwr/proto/fleet_pb2_grpc.py +7 -6
- flwr/proto/fleet_pb2_grpc.pyi +5 -4
- flwr/proto/run_pb2.py +30 -0
- flwr/proto/run_pb2.pyi +52 -0
- flwr/proto/run_pb2_grpc.py +4 -0
- flwr/proto/run_pb2_grpc.pyi +4 -0
- flwr/server/__init__.py +2 -6
- flwr/server/app.py +94 -214
- flwr/server/run_serverapp.py +33 -7
- flwr/server/server_app.py +2 -2
- flwr/server/strategy/__init__.py +2 -2
- flwr/server/superlink/driver/driver_servicer.py +7 -0
- 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/grpc_server.py +4 -0
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +1 -2
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +1 -2
- flwr/server/superlink/fleet/message_handler/message_handler.py +8 -6
- flwr/server/superlink/fleet/rest_rere/rest_api.py +1 -1
- flwr/server/superlink/fleet/vce/vce_api.py +3 -1
- flwr/server/superlink/state/in_memory_state.py +8 -5
- flwr/server/superlink/state/sqlite_state.py +6 -3
- flwr/server/superlink/state/state.py +5 -4
- flwr/simulation/__init__.py +4 -1
- flwr/simulation/run_simulation.py +22 -0
- 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.9.0.dev20240531.dist-info → flwr_nightly-1.10.0.dev20240619.dist-info}/METADATA +1 -1
- {flwr_nightly-1.9.0.dev20240531.dist-info → flwr_nightly-1.10.0.dev20240619.dist-info}/RECORD +80 -56
- {flwr_nightly-1.9.0.dev20240531.dist-info → flwr_nightly-1.10.0.dev20240619.dist-info}/entry_points.txt +1 -2
- {flwr_nightly-1.9.0.dev20240531.dist-info → flwr_nightly-1.10.0.dev20240619.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.9.0.dev20240531.dist-info → flwr_nightly-1.10.0.dev20240619.dist-info}/WHEEL +0 -0
flwr/common/object_ref.py
CHANGED
|
@@ -17,8 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
import ast
|
|
19
19
|
import importlib
|
|
20
|
+
import sys
|
|
20
21
|
from importlib.util import find_spec
|
|
21
|
-
from
|
|
22
|
+
from logging import WARN
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from typing import Any, Optional, Tuple, Type, Union
|
|
25
|
+
|
|
26
|
+
from .logger import log
|
|
22
27
|
|
|
23
28
|
OBJECT_REF_HELP_STR = """
|
|
24
29
|
\n\nThe object reference string should have the form <module>:<attribute>. Valid
|
|
@@ -30,6 +35,7 @@ attribute.
|
|
|
30
35
|
|
|
31
36
|
def validate(
|
|
32
37
|
module_attribute_str: str,
|
|
38
|
+
check_module: bool = True,
|
|
33
39
|
) -> Tuple[bool, Optional[str]]:
|
|
34
40
|
"""Validate object reference.
|
|
35
41
|
|
|
@@ -56,15 +62,18 @@ def validate(
|
|
|
56
62
|
f"Missing attribute in {module_attribute_str}{OBJECT_REF_HELP_STR}",
|
|
57
63
|
)
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
if check_module:
|
|
66
|
+
# Load module
|
|
67
|
+
module = find_spec(module_str)
|
|
68
|
+
if module and module.origin:
|
|
69
|
+
if not _find_attribute_in_module(module.origin, attributes_str):
|
|
70
|
+
return (
|
|
71
|
+
False,
|
|
72
|
+
f"Unable to find attribute {attributes_str} in module {module_str}"
|
|
73
|
+
f"{OBJECT_REF_HELP_STR}",
|
|
74
|
+
)
|
|
75
|
+
return (True, None)
|
|
76
|
+
else:
|
|
68
77
|
return (True, None)
|
|
69
78
|
|
|
70
79
|
return (
|
|
@@ -73,9 +82,10 @@ def validate(
|
|
|
73
82
|
)
|
|
74
83
|
|
|
75
84
|
|
|
76
|
-
def load_app(
|
|
85
|
+
def load_app( # pylint: disable= too-many-branches
|
|
77
86
|
module_attribute_str: str,
|
|
78
87
|
error_type: Type[Exception],
|
|
88
|
+
project_dir: Optional[Union[str, Path]] = None,
|
|
79
89
|
) -> Any:
|
|
80
90
|
"""Return the object specified in a module attribute string.
|
|
81
91
|
|
|
@@ -91,11 +101,39 @@ def load_app(
|
|
|
91
101
|
module_str, _, attributes_str = module_attribute_str.partition(":")
|
|
92
102
|
|
|
93
103
|
try:
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
if module_str not in sys.modules:
|
|
105
|
+
module = importlib.import_module(module_str)
|
|
106
|
+
# Hack: `tabnet` does not work with `importlib.reload`
|
|
107
|
+
elif "tabnet" in sys.modules:
|
|
108
|
+
log(
|
|
109
|
+
WARN,
|
|
110
|
+
"Cannot reload module `%s` from disk due to compatibility issues "
|
|
111
|
+
"with the `tabnet` library. The module will be loaded from the "
|
|
112
|
+
"cache instead. If you experience issues, consider restarting "
|
|
113
|
+
"the application.",
|
|
114
|
+
module_str,
|
|
115
|
+
)
|
|
116
|
+
module = sys.modules[module_str]
|
|
117
|
+
else:
|
|
118
|
+
module = sys.modules[module_str]
|
|
119
|
+
if project_dir is None:
|
|
120
|
+
path: Optional[str] = getattr(module, "__file__", None)
|
|
121
|
+
if path is not None:
|
|
122
|
+
project_dir = str(Path(path).parent)
|
|
123
|
+
else:
|
|
124
|
+
project_dir = str(Path(project_dir).absolute())
|
|
125
|
+
|
|
126
|
+
# Reload cached modules in the project directory
|
|
127
|
+
if project_dir is not None:
|
|
128
|
+
for m in list(sys.modules.values()):
|
|
129
|
+
path = getattr(m, "__file__", None)
|
|
130
|
+
if path is not None and path.startswith(project_dir):
|
|
131
|
+
importlib.reload(m)
|
|
132
|
+
|
|
133
|
+
except ModuleNotFoundError as err:
|
|
96
134
|
raise error_type(
|
|
97
135
|
f"Unable to load module {module_str}{OBJECT_REF_HELP_STR}",
|
|
98
|
-
) from
|
|
136
|
+
) from err
|
|
99
137
|
|
|
100
138
|
# Recursively load attribute
|
|
101
139
|
attribute = module
|
flwr/common/record/__init__.py
CHANGED
flwr/common/telemetry.py
CHANGED
|
@@ -164,6 +164,10 @@ class EventType(str, Enum):
|
|
|
164
164
|
RUN_SUPERNODE_ENTER = auto()
|
|
165
165
|
RUN_SUPERNODE_LEAVE = auto()
|
|
166
166
|
|
|
167
|
+
# SuperExec
|
|
168
|
+
RUN_SUPEREXEC_ENTER = auto()
|
|
169
|
+
RUN_SUPEREXEC_LEAVE = auto()
|
|
170
|
+
|
|
167
171
|
|
|
168
172
|
# Use the ThreadPoolExecutor with max_workers=1 to have a queue
|
|
169
173
|
# and also ensure that telemetry calls are not blocking.
|
flwr/common/typing.py
CHANGED
|
@@ -185,3 +185,12 @@ class ClientMessage:
|
|
|
185
185
|
get_parameters_res: Optional[GetParametersRes] = None
|
|
186
186
|
fit_res: Optional[FitRes] = None
|
|
187
187
|
evaluate_res: Optional[EvaluateRes] = None
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
@dataclass
|
|
191
|
+
class Run:
|
|
192
|
+
"""Run details."""
|
|
193
|
+
|
|
194
|
+
run_id: int
|
|
195
|
+
fab_id: str
|
|
196
|
+
fab_version: str
|
flwr/proto/driver_pb2.py
CHANGED
|
@@ -14,31 +14,32 @@ _sym_db = _symbol_database.Default()
|
|
|
14
14
|
|
|
15
15
|
from flwr.proto import node_pb2 as flwr_dot_proto_dot_node__pb2
|
|
16
16
|
from flwr.proto import task_pb2 as flwr_dot_proto_dot_task__pb2
|
|
17
|
+
from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x66lwr/proto/driver.proto\x12\nflwr.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x15\x66lwr/proto/task.proto\"7\n\x10\x43reateRunRequest\x12\x0e\n\x06\x66\x61\x62_id\x18\x01 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x02 \x01(\t\"#\n\x11\x43reateRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"!\n\x0fGetNodesRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"3\n\x10GetNodesResponse\x12\x1f\n\x05nodes\x18\x01 \x03(\x0b\x32\x10.flwr.proto.Node\"@\n\x12PushTaskInsRequest\x12*\n\rtask_ins_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskIns\"\'\n\x13PushTaskInsResponse\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"F\n\x12PullTaskResRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"A\n\x13PullTaskResResponse\x12*\n\rtask_res_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskRes2\
|
|
20
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x66lwr/proto/driver.proto\x12\nflwr.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x15\x66lwr/proto/task.proto\x1a\x14\x66lwr/proto/run.proto\"7\n\x10\x43reateRunRequest\x12\x0e\n\x06\x66\x61\x62_id\x18\x01 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x02 \x01(\t\"#\n\x11\x43reateRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"!\n\x0fGetNodesRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"3\n\x10GetNodesResponse\x12\x1f\n\x05nodes\x18\x01 \x03(\x0b\x32\x10.flwr.proto.Node\"@\n\x12PushTaskInsRequest\x12*\n\rtask_ins_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskIns\"\'\n\x13PushTaskInsResponse\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"F\n\x12PullTaskResRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"A\n\x13PullTaskResResponse\x12*\n\rtask_res_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskRes2\x84\x03\n\x06\x44river\x12J\n\tCreateRun\x12\x1c.flwr.proto.CreateRunRequest\x1a\x1d.flwr.proto.CreateRunResponse\"\x00\x12G\n\x08GetNodes\x12\x1b.flwr.proto.GetNodesRequest\x1a\x1c.flwr.proto.GetNodesResponse\"\x00\x12P\n\x0bPushTaskIns\x12\x1e.flwr.proto.PushTaskInsRequest\x1a\x1f.flwr.proto.PushTaskInsResponse\"\x00\x12P\n\x0bPullTaskRes\x12\x1e.flwr.proto.PullTaskResRequest\x1a\x1f.flwr.proto.PullTaskResResponse\"\x00\x12\x41\n\x06GetRun\x12\x19.flwr.proto.GetRunRequest\x1a\x1a.flwr.proto.GetRunResponse\"\x00\x62\x06proto3')
|
|
20
21
|
|
|
21
22
|
_globals = globals()
|
|
22
23
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
23
24
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.driver_pb2', _globals)
|
|
24
25
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
25
26
|
DESCRIPTOR._options = None
|
|
26
|
-
_globals['_CREATERUNREQUEST']._serialized_start=
|
|
27
|
-
_globals['_CREATERUNREQUEST']._serialized_end=
|
|
28
|
-
_globals['_CREATERUNRESPONSE']._serialized_start=
|
|
29
|
-
_globals['_CREATERUNRESPONSE']._serialized_end=
|
|
30
|
-
_globals['_GETNODESREQUEST']._serialized_start=
|
|
31
|
-
_globals['_GETNODESREQUEST']._serialized_end=
|
|
32
|
-
_globals['_GETNODESRESPONSE']._serialized_start=
|
|
33
|
-
_globals['_GETNODESRESPONSE']._serialized_end=
|
|
34
|
-
_globals['_PUSHTASKINSREQUEST']._serialized_start=
|
|
35
|
-
_globals['_PUSHTASKINSREQUEST']._serialized_end=
|
|
36
|
-
_globals['_PUSHTASKINSRESPONSE']._serialized_start=
|
|
37
|
-
_globals['_PUSHTASKINSRESPONSE']._serialized_end=
|
|
38
|
-
_globals['_PULLTASKRESREQUEST']._serialized_start=
|
|
39
|
-
_globals['_PULLTASKRESREQUEST']._serialized_end=
|
|
40
|
-
_globals['_PULLTASKRESRESPONSE']._serialized_start=
|
|
41
|
-
_globals['_PULLTASKRESRESPONSE']._serialized_end=
|
|
42
|
-
_globals['_DRIVER']._serialized_start=
|
|
43
|
-
_globals['_DRIVER']._serialized_end=
|
|
27
|
+
_globals['_CREATERUNREQUEST']._serialized_start=107
|
|
28
|
+
_globals['_CREATERUNREQUEST']._serialized_end=162
|
|
29
|
+
_globals['_CREATERUNRESPONSE']._serialized_start=164
|
|
30
|
+
_globals['_CREATERUNRESPONSE']._serialized_end=199
|
|
31
|
+
_globals['_GETNODESREQUEST']._serialized_start=201
|
|
32
|
+
_globals['_GETNODESREQUEST']._serialized_end=234
|
|
33
|
+
_globals['_GETNODESRESPONSE']._serialized_start=236
|
|
34
|
+
_globals['_GETNODESRESPONSE']._serialized_end=287
|
|
35
|
+
_globals['_PUSHTASKINSREQUEST']._serialized_start=289
|
|
36
|
+
_globals['_PUSHTASKINSREQUEST']._serialized_end=353
|
|
37
|
+
_globals['_PUSHTASKINSRESPONSE']._serialized_start=355
|
|
38
|
+
_globals['_PUSHTASKINSRESPONSE']._serialized_end=394
|
|
39
|
+
_globals['_PULLTASKRESREQUEST']._serialized_start=396
|
|
40
|
+
_globals['_PULLTASKRESREQUEST']._serialized_end=466
|
|
41
|
+
_globals['_PULLTASKRESRESPONSE']._serialized_start=468
|
|
42
|
+
_globals['_PULLTASKRESRESPONSE']._serialized_end=533
|
|
43
|
+
_globals['_DRIVER']._serialized_start=536
|
|
44
|
+
_globals['_DRIVER']._serialized_end=924
|
|
44
45
|
# @@protoc_insertion_point(module_scope)
|
flwr/proto/driver_pb2_grpc.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import grpc
|
|
4
4
|
|
|
5
5
|
from flwr.proto import driver_pb2 as flwr_dot_proto_dot_driver__pb2
|
|
6
|
+
from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class DriverStub(object):
|
|
@@ -34,6 +35,11 @@ class DriverStub(object):
|
|
|
34
35
|
request_serializer=flwr_dot_proto_dot_driver__pb2.PullTaskResRequest.SerializeToString,
|
|
35
36
|
response_deserializer=flwr_dot_proto_dot_driver__pb2.PullTaskResResponse.FromString,
|
|
36
37
|
)
|
|
38
|
+
self.GetRun = channel.unary_unary(
|
|
39
|
+
'/flwr.proto.Driver/GetRun',
|
|
40
|
+
request_serializer=flwr_dot_proto_dot_run__pb2.GetRunRequest.SerializeToString,
|
|
41
|
+
response_deserializer=flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
|
|
42
|
+
)
|
|
37
43
|
|
|
38
44
|
|
|
39
45
|
class DriverServicer(object):
|
|
@@ -67,6 +73,13 @@ class DriverServicer(object):
|
|
|
67
73
|
context.set_details('Method not implemented!')
|
|
68
74
|
raise NotImplementedError('Method not implemented!')
|
|
69
75
|
|
|
76
|
+
def GetRun(self, request, context):
|
|
77
|
+
"""Get run details
|
|
78
|
+
"""
|
|
79
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
80
|
+
context.set_details('Method not implemented!')
|
|
81
|
+
raise NotImplementedError('Method not implemented!')
|
|
82
|
+
|
|
70
83
|
|
|
71
84
|
def add_DriverServicer_to_server(servicer, server):
|
|
72
85
|
rpc_method_handlers = {
|
|
@@ -90,6 +103,11 @@ def add_DriverServicer_to_server(servicer, server):
|
|
|
90
103
|
request_deserializer=flwr_dot_proto_dot_driver__pb2.PullTaskResRequest.FromString,
|
|
91
104
|
response_serializer=flwr_dot_proto_dot_driver__pb2.PullTaskResResponse.SerializeToString,
|
|
92
105
|
),
|
|
106
|
+
'GetRun': grpc.unary_unary_rpc_method_handler(
|
|
107
|
+
servicer.GetRun,
|
|
108
|
+
request_deserializer=flwr_dot_proto_dot_run__pb2.GetRunRequest.FromString,
|
|
109
|
+
response_serializer=flwr_dot_proto_dot_run__pb2.GetRunResponse.SerializeToString,
|
|
110
|
+
),
|
|
93
111
|
}
|
|
94
112
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
95
113
|
'flwr.proto.Driver', rpc_method_handlers)
|
|
@@ -167,3 +185,20 @@ class Driver(object):
|
|
|
167
185
|
flwr_dot_proto_dot_driver__pb2.PullTaskResResponse.FromString,
|
|
168
186
|
options, channel_credentials,
|
|
169
187
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
188
|
+
|
|
189
|
+
@staticmethod
|
|
190
|
+
def GetRun(request,
|
|
191
|
+
target,
|
|
192
|
+
options=(),
|
|
193
|
+
channel_credentials=None,
|
|
194
|
+
call_credentials=None,
|
|
195
|
+
insecure=False,
|
|
196
|
+
compression=None,
|
|
197
|
+
wait_for_ready=None,
|
|
198
|
+
timeout=None,
|
|
199
|
+
metadata=None):
|
|
200
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.Driver/GetRun',
|
|
201
|
+
flwr_dot_proto_dot_run__pb2.GetRunRequest.SerializeToString,
|
|
202
|
+
flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
|
|
203
|
+
options, channel_credentials,
|
|
204
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
flwr/proto/driver_pb2_grpc.pyi
CHANGED
|
@@ -4,6 +4,7 @@ isort:skip_file
|
|
|
4
4
|
"""
|
|
5
5
|
import abc
|
|
6
6
|
import flwr.proto.driver_pb2
|
|
7
|
+
import flwr.proto.run_pb2
|
|
7
8
|
import grpc
|
|
8
9
|
|
|
9
10
|
class DriverStub:
|
|
@@ -28,6 +29,11 @@ class DriverStub:
|
|
|
28
29
|
flwr.proto.driver_pb2.PullTaskResResponse]
|
|
29
30
|
"""Get task results"""
|
|
30
31
|
|
|
32
|
+
GetRun: grpc.UnaryUnaryMultiCallable[
|
|
33
|
+
flwr.proto.run_pb2.GetRunRequest,
|
|
34
|
+
flwr.proto.run_pb2.GetRunResponse]
|
|
35
|
+
"""Get run details"""
|
|
36
|
+
|
|
31
37
|
|
|
32
38
|
class DriverServicer(metaclass=abc.ABCMeta):
|
|
33
39
|
@abc.abstractmethod
|
|
@@ -62,5 +68,13 @@ class DriverServicer(metaclass=abc.ABCMeta):
|
|
|
62
68
|
"""Get task results"""
|
|
63
69
|
pass
|
|
64
70
|
|
|
71
|
+
@abc.abstractmethod
|
|
72
|
+
def GetRun(self,
|
|
73
|
+
request: flwr.proto.run_pb2.GetRunRequest,
|
|
74
|
+
context: grpc.ServicerContext,
|
|
75
|
+
) -> flwr.proto.run_pb2.GetRunResponse:
|
|
76
|
+
"""Get run details"""
|
|
77
|
+
pass
|
|
78
|
+
|
|
65
79
|
|
|
66
80
|
def add_DriverServicer_to_server(servicer: DriverServicer, server: grpc.Server) -> None: ...
|
flwr/proto/exec_pb2.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: flwr/proto/exec.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.0
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\"#\n\x0fStartRunRequest\x12\x10\n\x08\x66\x61\x62_file\x18\x01 \x01(\x0c\"\"\n\x10StartRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"#\n\x11StreamLogsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x12\"(\n\x12StreamLogsResponse\x12\x12\n\nlog_output\x18\x01 \x01(\t2\xa0\x01\n\x04\x45xec\x12G\n\x08StartRun\x12\x1b.flwr.proto.StartRunRequest\x1a\x1c.flwr.proto.StartRunResponse\"\x00\x12O\n\nStreamLogs\x12\x1d.flwr.proto.StreamLogsRequest\x1a\x1e.flwr.proto.StreamLogsResponse\"\x00\x30\x01\x62\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.exec_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
_globals['_STARTRUNREQUEST']._serialized_start=37
|
|
25
|
+
_globals['_STARTRUNREQUEST']._serialized_end=72
|
|
26
|
+
_globals['_STARTRUNRESPONSE']._serialized_start=74
|
|
27
|
+
_globals['_STARTRUNRESPONSE']._serialized_end=108
|
|
28
|
+
_globals['_STREAMLOGSREQUEST']._serialized_start=110
|
|
29
|
+
_globals['_STREAMLOGSREQUEST']._serialized_end=145
|
|
30
|
+
_globals['_STREAMLOGSRESPONSE']._serialized_start=147
|
|
31
|
+
_globals['_STREAMLOGSRESPONSE']._serialized_end=187
|
|
32
|
+
_globals['_EXEC']._serialized_start=190
|
|
33
|
+
_globals['_EXEC']._serialized_end=350
|
|
34
|
+
# @@protoc_insertion_point(module_scope)
|
flwr/proto/exec_pb2.pyi
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
@generated by mypy-protobuf. Do not edit manually!
|
|
3
|
+
isort:skip_file
|
|
4
|
+
"""
|
|
5
|
+
import builtins
|
|
6
|
+
import google.protobuf.descriptor
|
|
7
|
+
import google.protobuf.message
|
|
8
|
+
import typing
|
|
9
|
+
import typing_extensions
|
|
10
|
+
|
|
11
|
+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
12
|
+
|
|
13
|
+
class StartRunRequest(google.protobuf.message.Message):
|
|
14
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
15
|
+
FAB_FILE_FIELD_NUMBER: builtins.int
|
|
16
|
+
fab_file: builtins.bytes
|
|
17
|
+
def __init__(self,
|
|
18
|
+
*,
|
|
19
|
+
fab_file: builtins.bytes = ...,
|
|
20
|
+
) -> None: ...
|
|
21
|
+
def ClearField(self, field_name: typing_extensions.Literal["fab_file",b"fab_file"]) -> None: ...
|
|
22
|
+
global___StartRunRequest = StartRunRequest
|
|
23
|
+
|
|
24
|
+
class StartRunResponse(google.protobuf.message.Message):
|
|
25
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
26
|
+
RUN_ID_FIELD_NUMBER: builtins.int
|
|
27
|
+
run_id: builtins.int
|
|
28
|
+
def __init__(self,
|
|
29
|
+
*,
|
|
30
|
+
run_id: builtins.int = ...,
|
|
31
|
+
) -> None: ...
|
|
32
|
+
def ClearField(self, field_name: typing_extensions.Literal["run_id",b"run_id"]) -> None: ...
|
|
33
|
+
global___StartRunResponse = StartRunResponse
|
|
34
|
+
|
|
35
|
+
class StreamLogsRequest(google.protobuf.message.Message):
|
|
36
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
37
|
+
RUN_ID_FIELD_NUMBER: builtins.int
|
|
38
|
+
run_id: builtins.int
|
|
39
|
+
def __init__(self,
|
|
40
|
+
*,
|
|
41
|
+
run_id: builtins.int = ...,
|
|
42
|
+
) -> None: ...
|
|
43
|
+
def ClearField(self, field_name: typing_extensions.Literal["run_id",b"run_id"]) -> None: ...
|
|
44
|
+
global___StreamLogsRequest = StreamLogsRequest
|
|
45
|
+
|
|
46
|
+
class StreamLogsResponse(google.protobuf.message.Message):
|
|
47
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
48
|
+
LOG_OUTPUT_FIELD_NUMBER: builtins.int
|
|
49
|
+
log_output: typing.Text
|
|
50
|
+
def __init__(self,
|
|
51
|
+
*,
|
|
52
|
+
log_output: typing.Text = ...,
|
|
53
|
+
) -> None: ...
|
|
54
|
+
def ClearField(self, field_name: typing_extensions.Literal["log_output",b"log_output"]) -> None: ...
|
|
55
|
+
global___StreamLogsResponse = StreamLogsResponse
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from flwr.proto import exec_pb2 as flwr_dot_proto_dot_exec__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ExecStub(object):
|
|
9
|
+
"""Missing associated documentation comment in .proto file."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, channel):
|
|
12
|
+
"""Constructor.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
channel: A grpc.Channel.
|
|
16
|
+
"""
|
|
17
|
+
self.StartRun = channel.unary_unary(
|
|
18
|
+
'/flwr.proto.Exec/StartRun',
|
|
19
|
+
request_serializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.SerializeToString,
|
|
20
|
+
response_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.FromString,
|
|
21
|
+
)
|
|
22
|
+
self.StreamLogs = channel.unary_stream(
|
|
23
|
+
'/flwr.proto.Exec/StreamLogs',
|
|
24
|
+
request_serializer=flwr_dot_proto_dot_exec__pb2.StreamLogsRequest.SerializeToString,
|
|
25
|
+
response_deserializer=flwr_dot_proto_dot_exec__pb2.StreamLogsResponse.FromString,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ExecServicer(object):
|
|
30
|
+
"""Missing associated documentation comment in .proto file."""
|
|
31
|
+
|
|
32
|
+
def StartRun(self, request, context):
|
|
33
|
+
"""Start run upon request
|
|
34
|
+
"""
|
|
35
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
36
|
+
context.set_details('Method not implemented!')
|
|
37
|
+
raise NotImplementedError('Method not implemented!')
|
|
38
|
+
|
|
39
|
+
def StreamLogs(self, request, context):
|
|
40
|
+
"""Start log stream upon request
|
|
41
|
+
"""
|
|
42
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
43
|
+
context.set_details('Method not implemented!')
|
|
44
|
+
raise NotImplementedError('Method not implemented!')
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def add_ExecServicer_to_server(servicer, server):
|
|
48
|
+
rpc_method_handlers = {
|
|
49
|
+
'StartRun': grpc.unary_unary_rpc_method_handler(
|
|
50
|
+
servicer.StartRun,
|
|
51
|
+
request_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.FromString,
|
|
52
|
+
response_serializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.SerializeToString,
|
|
53
|
+
),
|
|
54
|
+
'StreamLogs': grpc.unary_stream_rpc_method_handler(
|
|
55
|
+
servicer.StreamLogs,
|
|
56
|
+
request_deserializer=flwr_dot_proto_dot_exec__pb2.StreamLogsRequest.FromString,
|
|
57
|
+
response_serializer=flwr_dot_proto_dot_exec__pb2.StreamLogsResponse.SerializeToString,
|
|
58
|
+
),
|
|
59
|
+
}
|
|
60
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
61
|
+
'flwr.proto.Exec', rpc_method_handlers)
|
|
62
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# This class is part of an EXPERIMENTAL API.
|
|
66
|
+
class Exec(object):
|
|
67
|
+
"""Missing associated documentation comment in .proto file."""
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def StartRun(request,
|
|
71
|
+
target,
|
|
72
|
+
options=(),
|
|
73
|
+
channel_credentials=None,
|
|
74
|
+
call_credentials=None,
|
|
75
|
+
insecure=False,
|
|
76
|
+
compression=None,
|
|
77
|
+
wait_for_ready=None,
|
|
78
|
+
timeout=None,
|
|
79
|
+
metadata=None):
|
|
80
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.Exec/StartRun',
|
|
81
|
+
flwr_dot_proto_dot_exec__pb2.StartRunRequest.SerializeToString,
|
|
82
|
+
flwr_dot_proto_dot_exec__pb2.StartRunResponse.FromString,
|
|
83
|
+
options, channel_credentials,
|
|
84
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
85
|
+
|
|
86
|
+
@staticmethod
|
|
87
|
+
def StreamLogs(request,
|
|
88
|
+
target,
|
|
89
|
+
options=(),
|
|
90
|
+
channel_credentials=None,
|
|
91
|
+
call_credentials=None,
|
|
92
|
+
insecure=False,
|
|
93
|
+
compression=None,
|
|
94
|
+
wait_for_ready=None,
|
|
95
|
+
timeout=None,
|
|
96
|
+
metadata=None):
|
|
97
|
+
return grpc.experimental.unary_stream(request, target, '/flwr.proto.Exec/StreamLogs',
|
|
98
|
+
flwr_dot_proto_dot_exec__pb2.StreamLogsRequest.SerializeToString,
|
|
99
|
+
flwr_dot_proto_dot_exec__pb2.StreamLogsResponse.FromString,
|
|
100
|
+
options, channel_credentials,
|
|
101
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
@generated by mypy-protobuf. Do not edit manually!
|
|
3
|
+
isort:skip_file
|
|
4
|
+
"""
|
|
5
|
+
import abc
|
|
6
|
+
import flwr.proto.exec_pb2
|
|
7
|
+
import grpc
|
|
8
|
+
import typing
|
|
9
|
+
|
|
10
|
+
class ExecStub:
|
|
11
|
+
def __init__(self, channel: grpc.Channel) -> None: ...
|
|
12
|
+
StartRun: grpc.UnaryUnaryMultiCallable[
|
|
13
|
+
flwr.proto.exec_pb2.StartRunRequest,
|
|
14
|
+
flwr.proto.exec_pb2.StartRunResponse]
|
|
15
|
+
"""Start run upon request"""
|
|
16
|
+
|
|
17
|
+
StreamLogs: grpc.UnaryStreamMultiCallable[
|
|
18
|
+
flwr.proto.exec_pb2.StreamLogsRequest,
|
|
19
|
+
flwr.proto.exec_pb2.StreamLogsResponse]
|
|
20
|
+
"""Start log stream upon request"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ExecServicer(metaclass=abc.ABCMeta):
|
|
24
|
+
@abc.abstractmethod
|
|
25
|
+
def StartRun(self,
|
|
26
|
+
request: flwr.proto.exec_pb2.StartRunRequest,
|
|
27
|
+
context: grpc.ServicerContext,
|
|
28
|
+
) -> flwr.proto.exec_pb2.StartRunResponse:
|
|
29
|
+
"""Start run upon request"""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@abc.abstractmethod
|
|
33
|
+
def StreamLogs(self,
|
|
34
|
+
request: flwr.proto.exec_pb2.StreamLogsRequest,
|
|
35
|
+
context: grpc.ServicerContext,
|
|
36
|
+
) -> typing.Iterator[flwr.proto.exec_pb2.StreamLogsResponse]:
|
|
37
|
+
"""Start log stream upon request"""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def add_ExecServicer_to_server(servicer: ExecServicer, server: grpc.Server) -> None: ...
|
flwr/proto/fab_pb2.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: flwr/proto/fab.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.0
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x66lwr/proto/fab.proto\x12\nflwr.proto\"$\n\x03\x46\x61\x62\x12\x0c\n\x04hash\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\x0c\"\x1d\n\rGetFabRequest\x12\x0c\n\x04hash\x18\x01 \x01(\t\".\n\x0eGetFabResponse\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fabb\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.fab_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
_globals['_FAB']._serialized_start=36
|
|
25
|
+
_globals['_FAB']._serialized_end=72
|
|
26
|
+
_globals['_GETFABREQUEST']._serialized_start=74
|
|
27
|
+
_globals['_GETFABREQUEST']._serialized_end=103
|
|
28
|
+
_globals['_GETFABRESPONSE']._serialized_start=105
|
|
29
|
+
_globals['_GETFABRESPONSE']._serialized_end=151
|
|
30
|
+
# @@protoc_insertion_point(module_scope)
|
flwr/proto/fab_pb2.pyi
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
@generated by mypy-protobuf. Do not edit manually!
|
|
3
|
+
isort:skip_file
|
|
4
|
+
"""
|
|
5
|
+
import builtins
|
|
6
|
+
import google.protobuf.descriptor
|
|
7
|
+
import google.protobuf.message
|
|
8
|
+
import typing
|
|
9
|
+
import typing_extensions
|
|
10
|
+
|
|
11
|
+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
12
|
+
|
|
13
|
+
class Fab(google.protobuf.message.Message):
|
|
14
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
15
|
+
HASH_FIELD_NUMBER: builtins.int
|
|
16
|
+
CONTENT_FIELD_NUMBER: builtins.int
|
|
17
|
+
hash: typing.Text
|
|
18
|
+
"""This field is the hash of the data field. It is used to identify the data.
|
|
19
|
+
The hash is calculated using the SHA-256 algorithm and is represented as a
|
|
20
|
+
hex string (sha256hex).
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
content: builtins.bytes
|
|
24
|
+
"""This field contains the fab file contents a one bytes blob."""
|
|
25
|
+
|
|
26
|
+
def __init__(self,
|
|
27
|
+
*,
|
|
28
|
+
hash: typing.Text = ...,
|
|
29
|
+
content: builtins.bytes = ...,
|
|
30
|
+
) -> None: ...
|
|
31
|
+
def ClearField(self, field_name: typing_extensions.Literal["content",b"content","hash",b"hash"]) -> None: ...
|
|
32
|
+
global___Fab = Fab
|
|
33
|
+
|
|
34
|
+
class GetFabRequest(google.protobuf.message.Message):
|
|
35
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
36
|
+
HASH_FIELD_NUMBER: builtins.int
|
|
37
|
+
hash: typing.Text
|
|
38
|
+
def __init__(self,
|
|
39
|
+
*,
|
|
40
|
+
hash: typing.Text = ...,
|
|
41
|
+
) -> None: ...
|
|
42
|
+
def ClearField(self, field_name: typing_extensions.Literal["hash",b"hash"]) -> None: ...
|
|
43
|
+
global___GetFabRequest = GetFabRequest
|
|
44
|
+
|
|
45
|
+
class GetFabResponse(google.protobuf.message.Message):
|
|
46
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
47
|
+
FAB_FIELD_NUMBER: builtins.int
|
|
48
|
+
@property
|
|
49
|
+
def fab(self) -> global___Fab: ...
|
|
50
|
+
def __init__(self,
|
|
51
|
+
*,
|
|
52
|
+
fab: typing.Optional[global___Fab] = ...,
|
|
53
|
+
) -> None: ...
|
|
54
|
+
def HasField(self, field_name: typing_extensions.Literal["fab",b"fab"]) -> builtins.bool: ...
|
|
55
|
+
def ClearField(self, field_name: typing_extensions.Literal["fab",b"fab"]) -> None: ...
|
|
56
|
+
global___GetFabResponse = GetFabResponse
|