flwr-nightly 1.13.0.dev20241105__py3-none-any.whl → 1.13.0.dev20241107__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.

Files changed (42) hide show
  1. flwr/cli/run/run.py +16 -5
  2. flwr/client/app.py +10 -6
  3. flwr/client/nodestate/__init__.py +25 -0
  4. flwr/client/nodestate/in_memory_nodestate.py +38 -0
  5. flwr/client/nodestate/nodestate.py +30 -0
  6. flwr/client/nodestate/nodestate_factory.py +37 -0
  7. flwr/client/run_info_store.py +1 -0
  8. flwr/common/config.py +10 -0
  9. flwr/common/constant.py +1 -1
  10. flwr/common/context.py +9 -4
  11. flwr/common/object_ref.py +40 -33
  12. flwr/common/serde.py +2 -0
  13. flwr/proto/exec_pb2.py +14 -17
  14. flwr/proto/exec_pb2.pyi +6 -20
  15. flwr/proto/message_pb2.py +8 -8
  16. flwr/proto/message_pb2.pyi +4 -1
  17. flwr/server/app.py +140 -107
  18. flwr/server/driver/driver.py +1 -1
  19. flwr/server/driver/grpc_driver.py +2 -6
  20. flwr/server/driver/inmemory_driver.py +1 -3
  21. flwr/server/run_serverapp.py +5 -2
  22. flwr/server/serverapp/app.py +1 -1
  23. flwr/server/superlink/driver/serverappio_servicer.py +2 -0
  24. flwr/server/superlink/linkstate/in_memory_linkstate.py +15 -16
  25. flwr/server/superlink/linkstate/linkstate.py +18 -1
  26. flwr/server/superlink/linkstate/sqlite_linkstate.py +41 -21
  27. flwr/server/superlink/linkstate/utils.py +14 -30
  28. flwr/server/superlink/simulation/__init__.py +15 -0
  29. flwr/server/superlink/simulation/simulationio_grpc.py +65 -0
  30. flwr/server/superlink/simulation/simulationio_servicer.py +132 -0
  31. flwr/simulation/__init__.py +2 -0
  32. flwr/simulation/run_simulation.py +4 -1
  33. flwr/simulation/simulationio_connection.py +86 -0
  34. flwr/superexec/deployment.py +8 -4
  35. flwr/superexec/exec_servicer.py +2 -2
  36. flwr/superexec/executor.py +4 -3
  37. flwr/superexec/simulation.py +8 -8
  38. {flwr_nightly-1.13.0.dev20241105.dist-info → flwr_nightly-1.13.0.dev20241107.dist-info}/METADATA +1 -1
  39. {flwr_nightly-1.13.0.dev20241105.dist-info → flwr_nightly-1.13.0.dev20241107.dist-info}/RECORD +42 -34
  40. {flwr_nightly-1.13.0.dev20241105.dist-info → flwr_nightly-1.13.0.dev20241107.dist-info}/LICENSE +0 -0
  41. {flwr_nightly-1.13.0.dev20241105.dist-info → flwr_nightly-1.13.0.dev20241107.dist-info}/WHEEL +0 -0
  42. {flwr_nightly-1.13.0.dev20241105.dist-info → flwr_nightly-1.13.0.dev20241107.dist-info}/entry_points.txt +0 -0
flwr/cli/run/run.py CHANGED
@@ -29,10 +29,18 @@ from flwr.cli.config_utils import (
29
29
  validate_federation_in_project_config,
30
30
  validate_project_config,
31
31
  )
32
- from flwr.common.config import flatten_dict, parse_config_args
32
+ from flwr.common.config import (
33
+ flatten_dict,
34
+ parse_config_args,
35
+ user_config_to_configsrecord,
36
+ )
33
37
  from flwr.common.grpc import GRPC_MAX_MESSAGE_LENGTH, create_channel
34
38
  from flwr.common.logger import log
35
- from flwr.common.serde import fab_to_proto, user_config_to_proto
39
+ from flwr.common.serde import (
40
+ configs_record_to_proto,
41
+ fab_to_proto,
42
+ user_config_to_proto,
43
+ )
36
44
  from flwr.common.typing import Fab
37
45
  from flwr.proto.exec_pb2 import StartRunRequest # pylint: disable=E0611
38
46
  from flwr.proto.exec_pb2_grpc import ExecStub
@@ -94,6 +102,7 @@ def run(
94
102
  _run_without_exec_api(app, federation_config, config_overrides, federation)
95
103
 
96
104
 
105
+ # pylint: disable-next=too-many-locals
97
106
  def _run_with_exec_api(
98
107
  app: Path,
99
108
  federation_config: dict[str, Any],
@@ -118,12 +127,14 @@ def _run_with_exec_api(
118
127
  content = Path(fab_path).read_bytes()
119
128
  fab = Fab(fab_hash, content)
120
129
 
130
+ # Construct a `ConfigsRecord` out of a flattened `UserConfig`
131
+ fed_conf = flatten_dict(federation_config.get("options", {}))
132
+ c_record = user_config_to_configsrecord(fed_conf)
133
+
121
134
  req = StartRunRequest(
122
135
  fab=fab_to_proto(fab),
123
136
  override_config=user_config_to_proto(parse_config_args(config_overrides)),
124
- federation_config=user_config_to_proto(
125
- flatten_dict(federation_config.get("options"))
126
- ),
137
+ federation_options=configs_record_to_proto(c_record),
127
138
  )
128
139
  res = stub.StartRun(req)
129
140
 
flwr/client/app.py CHANGED
@@ -32,6 +32,7 @@ from flwr.cli.config_utils import get_fab_metadata
32
32
  from flwr.cli.install import install_from_fab
33
33
  from flwr.client.client import Client
34
34
  from flwr.client.client_app import ClientApp, LoadClientAppError
35
+ from flwr.client.nodestate.nodestate_factory import NodeStateFactory
35
36
  from flwr.client.typing import ClientFnExt
36
37
  from flwr.common import GRPC_MAX_MESSAGE_LENGTH, Context, EventType, Message, event
37
38
  from flwr.common.address import parse_address
@@ -365,6 +366,8 @@ def start_client_internal(
365
366
 
366
367
  # DeprecatedRunInfoStore gets initialized when the first connection is established
367
368
  run_info_store: Optional[DeprecatedRunInfoStore] = None
369
+ state_factory = NodeStateFactory()
370
+ state = state_factory.state()
368
371
 
369
372
  runs: dict[int, Run] = {}
370
373
 
@@ -396,13 +399,14 @@ def start_client_internal(
396
399
  )
397
400
  else:
398
401
  # Call create_node fn to register node
399
- node_id: Optional[int] = ( # pylint: disable=assignment-from-none
400
- create_node()
401
- ) # pylint: disable=not-callable
402
- if node_id is None:
403
- raise ValueError("Node registration failed")
402
+ # and store node_id in state
403
+ if (node_id := create_node()) is None:
404
+ raise ValueError(
405
+ "Failed to register SuperNode with the SuperLink"
406
+ )
407
+ state.set_node_id(node_id)
404
408
  run_info_store = DeprecatedRunInfoStore(
405
- node_id=node_id,
409
+ node_id=state.get_node_id(),
406
410
  node_config=node_config,
407
411
  )
408
412
 
@@ -0,0 +1,25 @@
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 NodeState."""
16
+
17
+ from .in_memory_nodestate import InMemoryNodeState as InMemoryNodeState
18
+ from .nodestate import NodeState as NodeState
19
+ from .nodestate_factory import NodeStateFactory as NodeStateFactory
20
+
21
+ __all__ = [
22
+ "InMemoryNodeState",
23
+ "NodeState",
24
+ "NodeStateFactory",
25
+ ]
@@ -0,0 +1,38 @@
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
+ """In-memory NodeState implementation."""
16
+
17
+
18
+ from typing import Optional
19
+
20
+ from flwr.client.nodestate.nodestate import NodeState
21
+
22
+
23
+ class InMemoryNodeState(NodeState):
24
+ """In-memory NodeState implementation."""
25
+
26
+ def __init__(self) -> None:
27
+ # Store node_id
28
+ self.node_id: Optional[int] = None
29
+
30
+ def set_node_id(self, node_id: Optional[int]) -> None:
31
+ """Set the node ID."""
32
+ self.node_id = node_id
33
+
34
+ def get_node_id(self) -> int:
35
+ """Get the node ID."""
36
+ if self.node_id is None:
37
+ raise ValueError("Node ID not set")
38
+ return self.node_id
@@ -0,0 +1,30 @@
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
+ """Abstract base class NodeState."""
16
+
17
+ import abc
18
+ from typing import Optional
19
+
20
+
21
+ class NodeState(abc.ABC):
22
+ """Abstract NodeState."""
23
+
24
+ @abc.abstractmethod
25
+ def set_node_id(self, node_id: Optional[int]) -> None:
26
+ """Set the node ID."""
27
+
28
+ @abc.abstractmethod
29
+ def get_node_id(self) -> int:
30
+ """Get the node ID."""
@@ -0,0 +1,37 @@
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
+ """Factory class that creates NodeState instances."""
16
+
17
+ import threading
18
+ from typing import Optional
19
+
20
+ from .in_memory_nodestate import InMemoryNodeState
21
+ from .nodestate import NodeState
22
+
23
+
24
+ class NodeStateFactory:
25
+ """Factory class that creates NodeState instances."""
26
+
27
+ def __init__(self) -> None:
28
+ self.state_instance: Optional[NodeState] = None
29
+ self.lock = threading.RLock()
30
+
31
+ def state(self) -> NodeState:
32
+ """Return a State instance and create it, if necessary."""
33
+ # Lock access to NodeStateFactory to prevent returning different instances
34
+ with self.lock:
35
+ if self.state_instance is None:
36
+ self.state_instance = InMemoryNodeState()
37
+ return self.state_instance
@@ -83,6 +83,7 @@ class DeprecatedRunInfoStore:
83
83
  self.run_infos[run_id] = RunInfo(
84
84
  initial_run_config=initial_run_config,
85
85
  context=Context(
86
+ run_id=run_id,
86
87
  node_id=self.node_id,
87
88
  node_config=self.node_config,
88
89
  state=RecordSet(),
flwr/common/config.py CHANGED
@@ -22,6 +22,7 @@ from typing import Any, Optional, Union, cast, get_args
22
22
  import tomli
23
23
 
24
24
  from flwr.cli.config_utils import get_fab_config, validate_fields
25
+ from flwr.common import ConfigsRecord
25
26
  from flwr.common.constant import (
26
27
  APP_DIR,
27
28
  FAB_CONFIG_FILE,
@@ -229,3 +230,12 @@ def get_metadata_from_config(config: dict[str, Any]) -> tuple[str, str]:
229
230
  config["project"]["version"],
230
231
  f"{config['tool']['flwr']['app']['publisher']}/{config['project']['name']}",
231
232
  )
233
+
234
+
235
+ def user_config_to_configsrecord(config: UserConfig) -> ConfigsRecord:
236
+ """Construct a `ConfigsRecord` out of a `UserConfig`."""
237
+ c_record = ConfigsRecord()
238
+ for k, v in config.items():
239
+ c_record[k] = v
240
+
241
+ return c_record
flwr/common/constant.py CHANGED
@@ -48,6 +48,7 @@ FLEET_API_GRPC_BIDI_DEFAULT_ADDRESS = (
48
48
  )
49
49
  FLEET_API_REST_DEFAULT_ADDRESS = "0.0.0.0:9095"
50
50
  EXEC_API_DEFAULT_ADDRESS = "0.0.0.0:9093"
51
+ SIMULATIONIO_API_DEFAULT_ADDRESS = "0.0.0.0:9096"
51
52
 
52
53
  # Constants for ping
53
54
  PING_DEFAULT_INTERVAL = 30
@@ -133,7 +134,6 @@ class ErrorCode:
133
134
  UNKNOWN = 0
134
135
  LOAD_CLIENT_APP_EXCEPTION = 1
135
136
  CLIENT_APP_RAISED_EXCEPTION = 2
136
- NODE_UNAVAILABLE = 3
137
137
 
138
138
  def __new__(cls) -> ErrorCode:
139
139
  """Prevent instantiation."""
flwr/common/context.py CHANGED
@@ -27,36 +27,41 @@ class Context:
27
27
 
28
28
  Parameters
29
29
  ----------
30
+ run_id : int
31
+ The ID that identifies the run.
30
32
  node_id : int
31
33
  The ID that identifies the node.
32
34
  node_config : UserConfig
33
35
  A config (key/value mapping) unique to the node and independent of the
34
36
  `run_config`. This config persists across all runs this node participates in.
35
37
  state : RecordSet
36
- Holds records added by the entity in a given run and that will stay local.
38
+ Holds records added by the entity in a given `run_id` and that will stay local.
37
39
  This means that the data it holds will never leave the system it's running from.
38
40
  This can be used as an intermediate storage or scratchpad when
39
41
  executing mods. It can also be used as a memory to access
40
42
  at different points during the lifecycle of this entity (e.g. across
41
43
  multiple rounds)
42
44
  run_config : UserConfig
43
- A config (key/value mapping) held by the entity in a given run and that will
44
- stay local. It can be used at any point during the lifecycle of this entity
45
+ A config (key/value mapping) held by the entity in a given `run_id` and that
46
+ will stay local. It can be used at any point during the lifecycle of this entity
45
47
  (e.g. across multiple rounds)
46
48
  """
47
49
 
50
+ run_id: int
48
51
  node_id: int
49
52
  node_config: UserConfig
50
53
  state: RecordSet
51
54
  run_config: UserConfig
52
55
 
53
- def __init__( # pylint: disable=too-many-arguments
56
+ def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
54
57
  self,
58
+ run_id: int,
55
59
  node_id: int,
56
60
  node_config: UserConfig,
57
61
  state: RecordSet,
58
62
  run_config: UserConfig,
59
63
  ) -> None:
64
+ self.run_id = run_id
60
65
  self.node_id = node_id
61
66
  self.node_config = node_config
62
67
  self.state = state
flwr/common/object_ref.py CHANGED
@@ -55,8 +55,8 @@ def validate(
55
55
  specified attribute within it.
56
56
  project_dir : Optional[Union[str, Path]] (default: None)
57
57
  The directory containing the module. If None, the current working directory
58
- is used. If `check_module` is True, the `project_dir` will be inserted into
59
- the system path, and the previously inserted `project_dir` will be removed.
58
+ is used. If `check_module` is True, the `project_dir` will be temporarily
59
+ inserted into the system path and then removed after the validation is complete.
60
60
 
61
61
  Returns
62
62
  -------
@@ -66,8 +66,8 @@ def validate(
66
66
 
67
67
  Note
68
68
  ----
69
- This function will modify `sys.path` by inserting the provided `project_dir`
70
- and removing the previously inserted `project_dir`.
69
+ This function will temporarily modify `sys.path` by inserting the provided
70
+ `project_dir`, which will be removed after the validation is complete.
71
71
  """
72
72
  module_str, _, attributes_str = module_attribute_str.partition(":")
73
73
  if not module_str:
@@ -82,11 +82,19 @@ def validate(
82
82
  )
83
83
 
84
84
  if check_module:
85
+ if project_dir is None:
86
+ project_dir = Path.cwd()
87
+ project_dir = Path(project_dir).absolute()
85
88
  # Set the system path
86
- _set_sys_path(project_dir)
89
+ sys.path.insert(0, str(project_dir))
87
90
 
88
91
  # Load module
89
92
  module = find_spec(module_str)
93
+
94
+ # Unset the system path
95
+ sys.path.remove(str(project_dir))
96
+
97
+ # Check if the module and the attribute exist
90
98
  if module and module.origin:
91
99
  if not _find_attribute_in_module(module.origin, attributes_str):
92
100
  return (
@@ -133,8 +141,10 @@ def load_app( # pylint: disable= too-many-branches
133
141
 
134
142
  Note
135
143
  ----
136
- This function will modify `sys.path` by inserting the provided `project_dir`
137
- and removing the previously inserted `project_dir`.
144
+ - This function will unload all modules in the previously provided `project_dir`,
145
+ if it is invoked again.
146
+ - This function will modify `sys.path` by inserting the provided `project_dir`
147
+ and removing the previously inserted `project_dir`.
138
148
  """
139
149
  valid, error_msg = validate(module_attribute_str, check_module=False)
140
150
  if not valid and error_msg:
@@ -143,33 +153,21 @@ def load_app( # pylint: disable= too-many-branches
143
153
  module_str, _, attributes_str = module_attribute_str.partition(":")
144
154
 
145
155
  try:
156
+ if _current_sys_path:
157
+ # Hack: `tabnet` does not work with reloading
158
+ if "tabnet" in sys.modules:
159
+ log(
160
+ WARN,
161
+ "Cannot reload module `%s` from disk due to compatibility issues "
162
+ "with the `tabnet` library. The module will be loaded from the "
163
+ "cache instead. If you experience issues, consider restarting "
164
+ "the application.",
165
+ module_str,
166
+ )
167
+ else:
168
+ _unload_modules(Path(_current_sys_path))
146
169
  _set_sys_path(project_dir)
147
-
148
- if module_str not in sys.modules:
149
- module = importlib.import_module(module_str)
150
- # Hack: `tabnet` does not work with `importlib.reload`
151
- elif "tabnet" in sys.modules:
152
- log(
153
- WARN,
154
- "Cannot reload module `%s` from disk due to compatibility issues "
155
- "with the `tabnet` library. The module will be loaded from the "
156
- "cache instead. If you experience issues, consider restarting "
157
- "the application.",
158
- module_str,
159
- )
160
- module = sys.modules[module_str]
161
- else:
162
- module = sys.modules[module_str]
163
-
164
- if project_dir is None:
165
- project_dir = Path.cwd()
166
-
167
- # Reload cached modules in the project directory
168
- for m in list(sys.modules.values()):
169
- path: Optional[str] = getattr(m, "__file__", None)
170
- if path is not None and path.startswith(str(project_dir)):
171
- importlib.reload(m)
172
-
170
+ module = importlib.import_module(module_str)
173
171
  except ModuleNotFoundError as err:
174
172
  raise error_type(
175
173
  f"Unable to load module {module_str}{OBJECT_REF_HELP_STR}",
@@ -189,6 +187,15 @@ def load_app( # pylint: disable= too-many-branches
189
187
  return attribute
190
188
 
191
189
 
190
+ def _unload_modules(project_dir: Path) -> None:
191
+ """Unload modules from the project directory."""
192
+ dir_str = str(project_dir.absolute())
193
+ for name, m in list(sys.modules.items()):
194
+ path: Optional[str] = getattr(m, "__file__", None)
195
+ if path is not None and path.startswith(dir_str):
196
+ del sys.modules[name]
197
+
198
+
192
199
  def _set_sys_path(directory: Optional[Union[str, Path]]) -> None:
193
200
  """Set the system path."""
194
201
  if directory is None:
flwr/common/serde.py CHANGED
@@ -840,6 +840,7 @@ def message_from_proto(message_proto: ProtoMessage) -> Message:
840
840
  def context_to_proto(context: Context) -> ProtoContext:
841
841
  """Serialize `Context` to ProtoBuf."""
842
842
  proto = ProtoContext(
843
+ run_id=context.run_id,
843
844
  node_id=context.node_id,
844
845
  node_config=user_config_to_proto(context.node_config),
845
846
  state=recordset_to_proto(context.state),
@@ -851,6 +852,7 @@ def context_to_proto(context: Context) -> ProtoContext:
851
852
  def context_from_proto(context_proto: ProtoContext) -> Context:
852
853
  """Deserialize `Context` from ProtoBuf."""
853
854
  context = Context(
855
+ run_id=context_proto.run_id,
854
856
  node_id=context_proto.node_id,
855
857
  node_config=user_config_from_proto(context_proto.node_config),
856
858
  state=recordset_from_proto(context_proto.state),
flwr/proto/exec_pb2.py CHANGED
@@ -14,9 +14,10 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
  from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
16
16
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
17
+ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
17
18
 
18
19
 
19
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xdf\x02\n\x0fStartRunRequest\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fab\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\x12L\n\x11\x66\x65\x64\x65ration_config\x18\x03 \x03(\x0b\x32\x31.flwr.proto.StartRunRequest.FederationConfigEntry\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\x1aK\n\x15\x46\x65\x64\x65rationConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"\"\n\x10StartRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"<\n\x11StreamLogsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x17\n\x0f\x61\x66ter_timestamp\x18\x02 \x01(\x01\"B\n\x12StreamLogsResponse\x12\x12\n\nlog_output\x18\x01 \x01(\t\x12\x18\n\x10latest_timestamp\x18\x02 \x01(\x01\x32\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')
20
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1a\x66lwr/proto/recordset.proto\"\xfb\x01\n\x0fStartRunRequest\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fab\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\x12\x35\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecord\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"\"\n\x10StartRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"<\n\x11StreamLogsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x17\n\x0f\x61\x66ter_timestamp\x18\x02 \x01(\x01\"B\n\x12StreamLogsResponse\x12\x12\n\nlog_output\x18\x01 \x01(\t\x12\x18\n\x10latest_timestamp\x18\x02 \x01(\x01\x32\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')
20
21
 
21
22
  _globals = globals()
22
23
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -25,20 +26,16 @@ if _descriptor._USE_C_DESCRIPTORS == False:
25
26
  DESCRIPTOR._options = None
26
27
  _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._options = None
27
28
  _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
28
- _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._options = None
29
- _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_options = b'8\001'
30
- _globals['_STARTRUNREQUEST']._serialized_start=88
31
- _globals['_STARTRUNREQUEST']._serialized_end=439
32
- _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=289
33
- _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=362
34
- _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_start=364
35
- _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_end=439
36
- _globals['_STARTRUNRESPONSE']._serialized_start=441
37
- _globals['_STARTRUNRESPONSE']._serialized_end=475
38
- _globals['_STREAMLOGSREQUEST']._serialized_start=477
39
- _globals['_STREAMLOGSREQUEST']._serialized_end=537
40
- _globals['_STREAMLOGSRESPONSE']._serialized_start=539
41
- _globals['_STREAMLOGSRESPONSE']._serialized_end=605
42
- _globals['_EXEC']._serialized_start=608
43
- _globals['_EXEC']._serialized_end=768
29
+ _globals['_STARTRUNREQUEST']._serialized_start=116
30
+ _globals['_STARTRUNREQUEST']._serialized_end=367
31
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=294
32
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=367
33
+ _globals['_STARTRUNRESPONSE']._serialized_start=369
34
+ _globals['_STARTRUNRESPONSE']._serialized_end=403
35
+ _globals['_STREAMLOGSREQUEST']._serialized_start=405
36
+ _globals['_STREAMLOGSREQUEST']._serialized_end=465
37
+ _globals['_STREAMLOGSRESPONSE']._serialized_start=467
38
+ _globals['_STREAMLOGSRESPONSE']._serialized_end=533
39
+ _globals['_EXEC']._serialized_start=536
40
+ _globals['_EXEC']._serialized_end=696
44
41
  # @@protoc_insertion_point(module_scope)
flwr/proto/exec_pb2.pyi CHANGED
@@ -4,6 +4,7 @@ isort:skip_file
4
4
  """
5
5
  import builtins
6
6
  import flwr.proto.fab_pb2
7
+ import flwr.proto.recordset_pb2
7
8
  import flwr.proto.transport_pb2
8
9
  import google.protobuf.descriptor
9
10
  import google.protobuf.internal.containers
@@ -30,38 +31,23 @@ class StartRunRequest(google.protobuf.message.Message):
30
31
  def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
31
32
  def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
32
33
 
33
- class FederationConfigEntry(google.protobuf.message.Message):
34
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
35
- KEY_FIELD_NUMBER: builtins.int
36
- VALUE_FIELD_NUMBER: builtins.int
37
- key: typing.Text
38
- @property
39
- def value(self) -> flwr.proto.transport_pb2.Scalar: ...
40
- def __init__(self,
41
- *,
42
- key: typing.Text = ...,
43
- value: typing.Optional[flwr.proto.transport_pb2.Scalar] = ...,
44
- ) -> None: ...
45
- def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
46
- def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
47
-
48
34
  FAB_FIELD_NUMBER: builtins.int
49
35
  OVERRIDE_CONFIG_FIELD_NUMBER: builtins.int
50
- FEDERATION_CONFIG_FIELD_NUMBER: builtins.int
36
+ FEDERATION_OPTIONS_FIELD_NUMBER: builtins.int
51
37
  @property
52
38
  def fab(self) -> flwr.proto.fab_pb2.Fab: ...
53
39
  @property
54
40
  def override_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
55
41
  @property
56
- def federation_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
42
+ def federation_options(self) -> flwr.proto.recordset_pb2.ConfigsRecord: ...
57
43
  def __init__(self,
58
44
  *,
59
45
  fab: typing.Optional[flwr.proto.fab_pb2.Fab] = ...,
60
46
  override_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
61
- federation_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
47
+ federation_options: typing.Optional[flwr.proto.recordset_pb2.ConfigsRecord] = ...,
62
48
  ) -> None: ...
63
- def HasField(self, field_name: typing_extensions.Literal["fab",b"fab"]) -> builtins.bool: ...
64
- def ClearField(self, field_name: typing_extensions.Literal["fab",b"fab","federation_config",b"federation_config","override_config",b"override_config"]) -> None: ...
49
+ def HasField(self, field_name: typing_extensions.Literal["fab",b"fab","federation_options",b"federation_options"]) -> builtins.bool: ...
50
+ def ClearField(self, field_name: typing_extensions.Literal["fab",b"fab","federation_options",b"federation_options","override_config",b"override_config"]) -> None: ...
65
51
  global___StartRunRequest = StartRunRequest
66
52
 
67
53
  class StartRunResponse(google.protobuf.message.Message):
flwr/proto/message_pb2.py CHANGED
@@ -17,7 +17,7 @@ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
17
17
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
18
18
 
19
19
 
20
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x66lwr/proto/message.proto\x12\nflwr.proto\x1a\x16\x66lwr/proto/error.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x1a\x66lwr/proto/transport.proto\"{\n\x07Message\x12&\n\x08metadata\x18\x01 \x01(\x0b\x32\x14.flwr.proto.Metadata\x12&\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RecordSet\x12 \n\x05\x65rror\x18\x03 \x01(\x0b\x32\x11.flwr.proto.Error\"\xbf\x02\n\x07\x43ontext\x12\x0f\n\x07node_id\x18\x01 \x01(\x04\x12\x38\n\x0bnode_config\x18\x02 \x03(\x0b\x32#.flwr.proto.Context.NodeConfigEntry\x12$\n\x05state\x18\x03 \x01(\x0b\x32\x15.flwr.proto.RecordSet\x12\x36\n\nrun_config\x18\x04 \x03(\x0b\x32\".flwr.proto.Context.RunConfigEntry\x1a\x45\n\x0fNodeConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\x1a\x44\n\x0eRunConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"\xbb\x01\n\x08Metadata\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x12\n\nmessage_id\x18\x02 \x01(\t\x12\x13\n\x0bsrc_node_id\x18\x03 \x01(\x04\x12\x13\n\x0b\x64st_node_id\x18\x04 \x01(\x04\x12\x18\n\x10reply_to_message\x18\x05 \x01(\t\x12\x10\n\x08group_id\x18\x06 \x01(\t\x12\x0b\n\x03ttl\x18\x07 \x01(\x01\x12\x14\n\x0cmessage_type\x18\x08 \x01(\t\x12\x12\n\ncreated_at\x18\t \x01(\x01\x62\x06proto3')
20
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x66lwr/proto/message.proto\x12\nflwr.proto\x1a\x16\x66lwr/proto/error.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x1a\x66lwr/proto/transport.proto\"{\n\x07Message\x12&\n\x08metadata\x18\x01 \x01(\x0b\x32\x14.flwr.proto.Metadata\x12&\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RecordSet\x12 \n\x05\x65rror\x18\x03 \x01(\x0b\x32\x11.flwr.proto.Error\"\xcf\x02\n\x07\x43ontext\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x0f\n\x07node_id\x18\x02 \x01(\x04\x12\x38\n\x0bnode_config\x18\x03 \x03(\x0b\x32#.flwr.proto.Context.NodeConfigEntry\x12$\n\x05state\x18\x04 \x01(\x0b\x32\x15.flwr.proto.RecordSet\x12\x36\n\nrun_config\x18\x05 \x03(\x0b\x32\".flwr.proto.Context.RunConfigEntry\x1a\x45\n\x0fNodeConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\x1a\x44\n\x0eRunConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"\xbb\x01\n\x08Metadata\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x12\n\nmessage_id\x18\x02 \x01(\t\x12\x13\n\x0bsrc_node_id\x18\x03 \x01(\x04\x12\x13\n\x0b\x64st_node_id\x18\x04 \x01(\x04\x12\x18\n\x10reply_to_message\x18\x05 \x01(\t\x12\x10\n\x08group_id\x18\x06 \x01(\t\x12\x0b\n\x03ttl\x18\x07 \x01(\x01\x12\x14\n\x0cmessage_type\x18\x08 \x01(\t\x12\x12\n\ncreated_at\x18\t \x01(\x01\x62\x06proto3')
21
21
 
22
22
  _globals = globals()
23
23
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -31,11 +31,11 @@ if _descriptor._USE_C_DESCRIPTORS == False:
31
31
  _globals['_MESSAGE']._serialized_start=120
32
32
  _globals['_MESSAGE']._serialized_end=243
33
33
  _globals['_CONTEXT']._serialized_start=246
34
- _globals['_CONTEXT']._serialized_end=565
35
- _globals['_CONTEXT_NODECONFIGENTRY']._serialized_start=426
36
- _globals['_CONTEXT_NODECONFIGENTRY']._serialized_end=495
37
- _globals['_CONTEXT_RUNCONFIGENTRY']._serialized_start=497
38
- _globals['_CONTEXT_RUNCONFIGENTRY']._serialized_end=565
39
- _globals['_METADATA']._serialized_start=568
40
- _globals['_METADATA']._serialized_end=755
34
+ _globals['_CONTEXT']._serialized_end=581
35
+ _globals['_CONTEXT_NODECONFIGENTRY']._serialized_start=442
36
+ _globals['_CONTEXT_NODECONFIGENTRY']._serialized_end=511
37
+ _globals['_CONTEXT_RUNCONFIGENTRY']._serialized_start=513
38
+ _globals['_CONTEXT_RUNCONFIGENTRY']._serialized_end=581
39
+ _globals['_METADATA']._serialized_start=584
40
+ _globals['_METADATA']._serialized_end=771
41
41
  # @@protoc_insertion_point(module_scope)
@@ -67,10 +67,12 @@ class Context(google.protobuf.message.Message):
67
67
  def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
68
68
  def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
69
69
 
70
+ RUN_ID_FIELD_NUMBER: builtins.int
70
71
  NODE_ID_FIELD_NUMBER: builtins.int
71
72
  NODE_CONFIG_FIELD_NUMBER: builtins.int
72
73
  STATE_FIELD_NUMBER: builtins.int
73
74
  RUN_CONFIG_FIELD_NUMBER: builtins.int
75
+ run_id: builtins.int
74
76
  node_id: builtins.int
75
77
  @property
76
78
  def node_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
@@ -80,13 +82,14 @@ class Context(google.protobuf.message.Message):
80
82
  def run_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
81
83
  def __init__(self,
82
84
  *,
85
+ run_id: builtins.int = ...,
83
86
  node_id: builtins.int = ...,
84
87
  node_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
85
88
  state: typing.Optional[flwr.proto.recordset_pb2.RecordSet] = ...,
86
89
  run_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
87
90
  ) -> None: ...
88
91
  def HasField(self, field_name: typing_extensions.Literal["state",b"state"]) -> builtins.bool: ...
89
- def ClearField(self, field_name: typing_extensions.Literal["node_config",b"node_config","node_id",b"node_id","run_config",b"run_config","state",b"state"]) -> None: ...
92
+ def ClearField(self, field_name: typing_extensions.Literal["node_config",b"node_config","node_id",b"node_id","run_config",b"run_config","run_id",b"run_id","state",b"state"]) -> None: ...
90
93
  global___Context = Context
91
94
 
92
95
  class Metadata(google.protobuf.message.Message):