flwr-nightly 1.10.0.dev20240722__py3-none-any.whl → 1.11.0.dev20240805__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 (66) hide show
  1. flwr/cli/config_utils.py +40 -23
  2. flwr/cli/new/new.py +7 -6
  3. flwr/cli/new/templates/app/README.md.tpl +1 -1
  4. flwr/cli/new/templates/app/code/__init__.py.tpl +1 -1
  5. flwr/cli/new/templates/app/code/{client.hf.py.tpl → client.huggingface.py.tpl} +8 -6
  6. flwr/cli/new/templates/app/code/client.jax.py.tpl +1 -1
  7. flwr/cli/new/templates/app/code/client.mlx.py.tpl +29 -11
  8. flwr/cli/new/templates/app/code/client.numpy.py.tpl +1 -1
  9. flwr/cli/new/templates/app/code/client.pytorch.py.tpl +16 -13
  10. flwr/cli/new/templates/app/code/client.sklearn.py.tpl +3 -3
  11. flwr/cli/new/templates/app/code/client.tensorflow.py.tpl +20 -13
  12. flwr/cli/new/templates/app/code/flwr_tune/app.py.tpl +20 -17
  13. flwr/cli/new/templates/app/code/flwr_tune/client.py.tpl +5 -3
  14. flwr/cli/new/templates/app/code/{server.hf.py.tpl → server.huggingface.py.tpl} +3 -2
  15. flwr/cli/new/templates/app/code/server.jax.py.tpl +3 -2
  16. flwr/cli/new/templates/app/code/server.mlx.py.tpl +3 -2
  17. flwr/cli/new/templates/app/code/server.numpy.py.tpl +3 -2
  18. flwr/cli/new/templates/app/code/server.pytorch.py.tpl +8 -7
  19. flwr/cli/new/templates/app/code/server.sklearn.py.tpl +3 -2
  20. flwr/cli/new/templates/app/code/server.tensorflow.py.tpl +5 -6
  21. flwr/cli/new/templates/app/code/{task.hf.py.tpl → task.huggingface.py.tpl} +14 -2
  22. flwr/cli/new/templates/app/code/task.jax.py.tpl +2 -2
  23. flwr/cli/new/templates/app/code/task.mlx.py.tpl +15 -2
  24. flwr/cli/new/templates/app/code/task.pytorch.py.tpl +26 -21
  25. flwr/cli/new/templates/app/code/task.tensorflow.py.tpl +29 -5
  26. flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +3 -3
  27. flwr/cli/new/templates/app/{pyproject.hf.toml.tpl → pyproject.huggingface.toml.tpl} +4 -4
  28. flwr/cli/new/templates/app/pyproject.jax.toml.tpl +4 -4
  29. flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +11 -11
  30. flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +4 -4
  31. flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +7 -6
  32. flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +5 -5
  33. flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +8 -8
  34. flwr/cli/run/run.py +31 -27
  35. flwr/client/grpc_rere_client/grpc_adapter.py +7 -0
  36. flwr/client/supernode/app.py +12 -43
  37. flwr/common/config.py +6 -1
  38. flwr/common/object_ref.py +84 -21
  39. flwr/proto/driver_pb2.py +22 -21
  40. flwr/proto/driver_pb2.pyi +7 -1
  41. flwr/proto/driver_pb2_grpc.py +35 -0
  42. flwr/proto/driver_pb2_grpc.pyi +14 -0
  43. flwr/proto/exec_pb2.py +16 -12
  44. flwr/proto/exec_pb2.pyi +20 -1
  45. flwr/proto/fleet_pb2.py +28 -27
  46. flwr/proto/fleet_pb2_grpc.py +35 -0
  47. flwr/proto/fleet_pb2_grpc.pyi +14 -0
  48. flwr/proto/run_pb2.py +8 -8
  49. flwr/proto/run_pb2.pyi +4 -1
  50. flwr/server/run_serverapp.py +0 -3
  51. flwr/server/superlink/driver/driver_servicer.py +7 -0
  52. flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +7 -0
  53. flwr/server/superlink/fleet/vce/backend/__init__.py +1 -1
  54. flwr/server/superlink/fleet/vce/vce_api.py +4 -4
  55. flwr/simulation/__init__.py +1 -1
  56. flwr/simulation/run_simulation.py +32 -4
  57. flwr/superexec/app.py +4 -5
  58. flwr/superexec/deployment.py +1 -2
  59. flwr/superexec/exec_servicer.py +3 -1
  60. flwr/superexec/executor.py +3 -0
  61. flwr/superexec/simulation.py +54 -12
  62. {flwr_nightly-1.10.0.dev20240722.dist-info → flwr_nightly-1.11.0.dev20240805.dist-info}/METADATA +1 -1
  63. {flwr_nightly-1.10.0.dev20240722.dist-info → flwr_nightly-1.11.0.dev20240805.dist-info}/RECORD +66 -66
  64. {flwr_nightly-1.10.0.dev20240722.dist-info → flwr_nightly-1.11.0.dev20240805.dist-info}/LICENSE +0 -0
  65. {flwr_nightly-1.10.0.dev20240722.dist-info → flwr_nightly-1.11.0.dev20240805.dist-info}/WHEEL +0 -0
  66. {flwr_nightly-1.10.0.dev20240722.dist-info → flwr_nightly-1.11.0.dev20240805.dist-info}/entry_points.txt +0 -0
@@ -62,8 +62,8 @@ def run_supernode() -> None:
62
62
  root_certificates = _get_certificates(args)
63
63
  load_fn = _get_load_client_app_fn(
64
64
  default_app_ref=getattr(args, "client-app"),
65
- dir_arg=args.dir,
66
- flwr_dir_arg=args.flwr_dir,
65
+ project_dir=args.dir,
66
+ flwr_dir=args.flwr_dir,
67
67
  multi_app=True,
68
68
  )
69
69
  authentication_keys = _try_setup_client_authentication(args)
@@ -100,7 +100,7 @@ def run_client_app() -> None:
100
100
  root_certificates = _get_certificates(args)
101
101
  load_fn = _get_load_client_app_fn(
102
102
  default_app_ref=getattr(args, "client-app"),
103
- dir_arg=args.dir,
103
+ project_dir=args.dir,
104
104
  multi_app=False,
105
105
  )
106
106
  authentication_keys = _try_setup_client_authentication(args)
@@ -176,9 +176,9 @@ def _get_certificates(args: argparse.Namespace) -> Optional[bytes]:
176
176
 
177
177
  def _get_load_client_app_fn(
178
178
  default_app_ref: str,
179
- dir_arg: str,
179
+ project_dir: str,
180
180
  multi_app: bool,
181
- flwr_dir_arg: Optional[str] = None,
181
+ flwr_dir: Optional[str] = None,
182
182
  ) -> Callable[[str, str], ClientApp]:
183
183
  """Get the load_client_app_fn function.
184
184
 
@@ -189,38 +189,21 @@ def _get_load_client_app_fn(
189
189
  If `multi_app` is False, it ignores `fab_id` and `fab_version` and
190
190
  loads a default ClientApp.
191
191
  """
192
- # Find the Flower directory containing Flower Apps (only for multi-app)
193
- if not multi_app:
194
- flwr_dir = Path("")
195
- else:
196
- if flwr_dir_arg is None:
197
- flwr_dir = get_flwr_dir()
198
- else:
199
- flwr_dir = Path(flwr_dir_arg).absolute()
200
-
201
- inserted_path = None
202
-
203
192
  if not multi_app:
204
193
  log(
205
194
  DEBUG,
206
195
  "Flower SuperNode will load and validate ClientApp `%s`",
207
196
  default_app_ref,
208
197
  )
209
- # Insert sys.path
210
- dir_path = Path(dir_arg).absolute()
211
- sys.path.insert(0, str(dir_path))
212
- inserted_path = str(dir_path)
213
198
 
214
- valid, error_msg = validate(default_app_ref)
199
+ valid, error_msg = validate(default_app_ref, project_dir=project_dir)
215
200
  if not valid and error_msg:
216
201
  raise LoadClientAppError(error_msg) from None
217
202
 
218
203
  def _load(fab_id: str, fab_version: str) -> ClientApp:
204
+ runtime_project_dir = Path(project_dir).absolute()
219
205
  # If multi-app feature is disabled
220
206
  if not multi_app:
221
- # Get sys path to be inserted
222
- dir_path = Path(dir_arg).absolute()
223
-
224
207
  # Set app reference
225
208
  client_app_ref = default_app_ref
226
209
  # If multi-app feature is enabled but the fab id is not specified
@@ -231,43 +214,29 @@ def _get_load_client_app_fn(
231
214
  ) from None
232
215
 
233
216
  log(WARN, "FAB ID is not provided; the default ClientApp will be loaded.")
234
- # Get sys path to be inserted
235
- dir_path = Path(dir_arg).absolute()
236
217
 
237
218
  # Set app reference
238
219
  client_app_ref = default_app_ref
239
220
  # If multi-app feature is enabled
240
221
  else:
241
222
  try:
242
- project_dir = get_project_dir(fab_id, fab_version, flwr_dir)
243
- config = get_project_config(project_dir)
223
+ runtime_project_dir = get_project_dir(
224
+ fab_id, fab_version, get_flwr_dir(flwr_dir)
225
+ )
226
+ config = get_project_config(runtime_project_dir)
244
227
  except Exception as e:
245
228
  raise LoadClientAppError("Failed to load ClientApp") from e
246
229
 
247
- # Get sys path to be inserted
248
- dir_path = Path(project_dir).absolute()
249
-
250
230
  # Set app reference
251
231
  client_app_ref = config["tool"]["flwr"]["app"]["components"]["clientapp"]
252
232
 
253
- # Set sys.path
254
- nonlocal inserted_path
255
- if inserted_path != str(dir_path):
256
- # Remove the previously inserted path
257
- if inserted_path is not None:
258
- sys.path.remove(inserted_path)
259
- # Insert the new path
260
- sys.path.insert(0, str(dir_path))
261
-
262
- inserted_path = str(dir_path)
263
-
264
233
  # Load ClientApp
265
234
  log(
266
235
  DEBUG,
267
236
  "Loading ClientApp `%s`",
268
237
  client_app_ref,
269
238
  )
270
- client_app = load_app(client_app_ref, LoadClientAppError, dir_path)
239
+ client_app = load_app(client_app_ref, LoadClientAppError, runtime_project_dir)
271
240
 
272
241
  if not isinstance(client_app, ClientApp):
273
242
  raise LoadClientAppError(
flwr/common/config.py CHANGED
@@ -113,8 +113,13 @@ def get_fused_config(run: Run, flwr_dir: Optional[Path]) -> UserConfig:
113
113
  return get_fused_config_from_dir(project_dir, run.override_config)
114
114
 
115
115
 
116
- def flatten_dict(raw_dict: Dict[str, Any], parent_key: str = "") -> UserConfig:
116
+ def flatten_dict(
117
+ raw_dict: Optional[Dict[str, Any]], parent_key: str = ""
118
+ ) -> UserConfig:
117
119
  """Flatten dict by joining nested keys with a given separator."""
120
+ if raw_dict is None:
121
+ return {}
122
+
118
123
  items: List[Tuple[str, UserConfigValue]] = []
119
124
  separator: str = "."
120
125
  for k, v in raw_dict.items():
flwr/common/object_ref.py CHANGED
@@ -33,22 +33,41 @@ attribute.
33
33
  """
34
34
 
35
35
 
36
+ _current_sys_path: Optional[str] = None
37
+
38
+
36
39
  def validate(
37
40
  module_attribute_str: str,
38
41
  check_module: bool = True,
42
+ project_dir: Optional[Union[str, Path]] = None,
39
43
  ) -> Tuple[bool, Optional[str]]:
40
44
  """Validate object reference.
41
45
 
42
- The object reference string should have the form <module>:<attribute>. Valid
43
- examples include `client:app` and `project.package.module:wrapper.app`. It must
44
- refer to a module on the PYTHONPATH and the module needs to have the specified
45
- attribute.
46
+ Parameters
47
+ ----------
48
+ module_attribute_str : str
49
+ The reference to the object. It should have the form `<module>:<attribute>`.
50
+ Valid examples include `client:app` and `project.package.module:wrapper.app`.
51
+ It must refer to a module on the PYTHONPATH or in the provided `project_dir`
52
+ and the module needs to have the specified attribute.
53
+ check_module : bool (default: True)
54
+ Flag indicating whether to verify the existence of the module and the
55
+ specified attribute within it.
56
+ project_dir : Optional[Union[str, Path]] (default: None)
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.
46
60
 
47
61
  Returns
48
62
  -------
49
63
  Tuple[bool, Optional[str]]
50
64
  A boolean indicating whether an object reference is valid and
51
65
  the reason why it might not be.
66
+
67
+ Note
68
+ ----
69
+ This function will modify `sys.path` by inserting the provided `project_dir`
70
+ and removing the previously inserted `project_dir`.
52
71
  """
53
72
  module_str, _, attributes_str = module_attribute_str.partition(":")
54
73
  if not module_str:
@@ -63,6 +82,9 @@ def validate(
63
82
  )
64
83
 
65
84
  if check_module:
85
+ # Set the system path
86
+ _set_sys_path(project_dir)
87
+
66
88
  # Load module
67
89
  module = find_spec(module_str)
68
90
  if module and module.origin:
@@ -89,18 +111,40 @@ def load_app( # pylint: disable= too-many-branches
89
111
  ) -> Any:
90
112
  """Return the object specified in a module attribute string.
91
113
 
92
- The module/attribute string should have the form <module>:<attribute>. Valid
93
- examples include `client:app` and `project.package.module:wrapper.app`. It must
94
- refer to a module on the PYTHONPATH, the module needs to have the specified
95
- attribute.
114
+ Parameters
115
+ ----------
116
+ module_attribute_str : str
117
+ The reference to the object. It should have the form `<module>:<attribute>`.
118
+ Valid examples include `client:app` and `project.package.module:wrapper.app`.
119
+ It must refer to a module on the PYTHONPATH or in the provided `project_dir`
120
+ and the module needs to have the specified attribute.
121
+ error_type : Type[Exception]
122
+ The type of exception to be raised if the provided `module_attribute_str` is
123
+ in an invalid format.
124
+ project_dir : Optional[Union[str, Path]], optional (default=None)
125
+ The directory containing the module. If None, the current working directory
126
+ is used. The `project_dir` will be inserted into the system path, and the
127
+ previously inserted `project_dir` will be removed.
128
+
129
+ Returns
130
+ -------
131
+ Any
132
+ The object specified by the module attribute string.
133
+
134
+ Note
135
+ ----
136
+ This function will modify `sys.path` by inserting the provided `project_dir`
137
+ and removing the previously inserted `project_dir`.
96
138
  """
97
- valid, error_msg = validate(module_attribute_str)
139
+ valid, error_msg = validate(module_attribute_str, check_module=False)
98
140
  if not valid and error_msg:
99
141
  raise error_type(error_msg) from None
100
142
 
101
143
  module_str, _, attributes_str = module_attribute_str.partition(":")
102
144
 
103
145
  try:
146
+ _set_sys_path(project_dir)
147
+
104
148
  if module_str not in sys.modules:
105
149
  module = importlib.import_module(module_str)
106
150
  # Hack: `tabnet` does not work with `importlib.reload`
@@ -116,19 +160,15 @@ def load_app( # pylint: disable= too-many-branches
116
160
  module = sys.modules[module_str]
117
161
  else:
118
162
  module = sys.modules[module_str]
163
+
119
164
  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())
165
+ project_dir = Path.cwd()
125
166
 
126
167
  # 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)
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)
132
172
 
133
173
  except ModuleNotFoundError as err:
134
174
  raise error_type(
@@ -140,15 +180,38 @@ def load_app( # pylint: disable= too-many-branches
140
180
  try:
141
181
  for attribute_str in attributes_str.split("."):
142
182
  attribute = getattr(attribute, attribute_str)
143
- except AttributeError:
183
+ except AttributeError as err:
144
184
  raise error_type(
145
185
  f"Unable to load attribute {attributes_str} from module {module_str}"
146
186
  f"{OBJECT_REF_HELP_STR}",
147
- ) from None
187
+ ) from err
148
188
 
149
189
  return attribute
150
190
 
151
191
 
192
+ def _set_sys_path(directory: Optional[Union[str, Path]]) -> None:
193
+ """Set the system path."""
194
+ if directory is None:
195
+ directory = Path.cwd()
196
+ else:
197
+ directory = Path(directory).absolute()
198
+
199
+ # If the directory has already been added to `sys.path`, return
200
+ if str(directory) in sys.path:
201
+ return
202
+
203
+ # Remove the old path if it exists and is not `""`.
204
+ global _current_sys_path # pylint: disable=global-statement
205
+ if _current_sys_path is not None:
206
+ sys.path.remove(_current_sys_path)
207
+
208
+ # Add the new path to sys.path
209
+ sys.path.insert(0, str(directory))
210
+
211
+ # Update the current_sys_path
212
+ _current_sys_path = str(directory)
213
+
214
+
152
215
  def _find_attribute_in_module(file_path: str, attribute_name: str) -> bool:
153
216
  """Check if attribute_name exists in module's abstract symbolic tree."""
154
217
  with open(file_path, encoding="utf-8") as file:
flwr/proto/driver_pb2.py CHANGED
@@ -15,10 +15,11 @@ _sym_db = _symbol_database.Default()
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
17
  from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
18
+ from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
18
19
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
19
20
 
20
21
 
21
- 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\x1a\x1a\x66lwr/proto/transport.proto\"\xcd\x01\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\x12I\n\x0foverride_config\x18\x03 \x03(\x0b\x32\x30.flwr.proto.CreateRunRequest.OverrideConfigEntry\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\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')
22
+ 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\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xeb\x01\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\x12I\n\x0foverride_config\x18\x03 \x03(\x0b\x32\x30.flwr.proto.CreateRunRequest.OverrideConfigEntry\x12\x1c\n\x03\x66\x61\x62\x18\x04 \x01(\x0b\x32\x0f.flwr.proto.Fab\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\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\xc7\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\x12\x41\n\x06GetFab\x12\x19.flwr.proto.GetFabRequest\x1a\x1a.flwr.proto.GetFabResponse\"\x00\x62\x06proto3')
22
23
 
23
24
  _globals = globals()
24
25
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -27,24 +28,24 @@ if _descriptor._USE_C_DESCRIPTORS == False:
27
28
  DESCRIPTOR._options = None
28
29
  _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._options = None
29
30
  _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
30
- _globals['_CREATERUNREQUEST']._serialized_start=136
31
- _globals['_CREATERUNREQUEST']._serialized_end=341
32
- _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=268
33
- _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=341
34
- _globals['_CREATERUNRESPONSE']._serialized_start=343
35
- _globals['_CREATERUNRESPONSE']._serialized_end=378
36
- _globals['_GETNODESREQUEST']._serialized_start=380
37
- _globals['_GETNODESREQUEST']._serialized_end=413
38
- _globals['_GETNODESRESPONSE']._serialized_start=415
39
- _globals['_GETNODESRESPONSE']._serialized_end=466
40
- _globals['_PUSHTASKINSREQUEST']._serialized_start=468
41
- _globals['_PUSHTASKINSREQUEST']._serialized_end=532
42
- _globals['_PUSHTASKINSRESPONSE']._serialized_start=534
43
- _globals['_PUSHTASKINSRESPONSE']._serialized_end=573
44
- _globals['_PULLTASKRESREQUEST']._serialized_start=575
45
- _globals['_PULLTASKRESREQUEST']._serialized_end=645
46
- _globals['_PULLTASKRESRESPONSE']._serialized_start=647
47
- _globals['_PULLTASKRESRESPONSE']._serialized_end=712
48
- _globals['_DRIVER']._serialized_start=715
49
- _globals['_DRIVER']._serialized_end=1103
31
+ _globals['_CREATERUNREQUEST']._serialized_start=158
32
+ _globals['_CREATERUNREQUEST']._serialized_end=393
33
+ _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=320
34
+ _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=393
35
+ _globals['_CREATERUNRESPONSE']._serialized_start=395
36
+ _globals['_CREATERUNRESPONSE']._serialized_end=430
37
+ _globals['_GETNODESREQUEST']._serialized_start=432
38
+ _globals['_GETNODESREQUEST']._serialized_end=465
39
+ _globals['_GETNODESRESPONSE']._serialized_start=467
40
+ _globals['_GETNODESRESPONSE']._serialized_end=518
41
+ _globals['_PUSHTASKINSREQUEST']._serialized_start=520
42
+ _globals['_PUSHTASKINSREQUEST']._serialized_end=584
43
+ _globals['_PUSHTASKINSRESPONSE']._serialized_start=586
44
+ _globals['_PUSHTASKINSRESPONSE']._serialized_end=625
45
+ _globals['_PULLTASKRESREQUEST']._serialized_start=627
46
+ _globals['_PULLTASKRESREQUEST']._serialized_end=697
47
+ _globals['_PULLTASKRESRESPONSE']._serialized_start=699
48
+ _globals['_PULLTASKRESRESPONSE']._serialized_end=764
49
+ _globals['_DRIVER']._serialized_start=767
50
+ _globals['_DRIVER']._serialized_end=1222
50
51
  # @@protoc_insertion_point(module_scope)
flwr/proto/driver_pb2.pyi CHANGED
@@ -3,6 +3,7 @@
3
3
  isort:skip_file
4
4
  """
5
5
  import builtins
6
+ import flwr.proto.fab_pb2
6
7
  import flwr.proto.node_pb2
7
8
  import flwr.proto.task_pb2
8
9
  import flwr.proto.transport_pb2
@@ -35,17 +36,22 @@ class CreateRunRequest(google.protobuf.message.Message):
35
36
  FAB_ID_FIELD_NUMBER: builtins.int
36
37
  FAB_VERSION_FIELD_NUMBER: builtins.int
37
38
  OVERRIDE_CONFIG_FIELD_NUMBER: builtins.int
39
+ FAB_FIELD_NUMBER: builtins.int
38
40
  fab_id: typing.Text
39
41
  fab_version: typing.Text
40
42
  @property
41
43
  def override_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
44
+ @property
45
+ def fab(self) -> flwr.proto.fab_pb2.Fab: ...
42
46
  def __init__(self,
43
47
  *,
44
48
  fab_id: typing.Text = ...,
45
49
  fab_version: typing.Text = ...,
46
50
  override_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
51
+ fab: typing.Optional[flwr.proto.fab_pb2.Fab] = ...,
47
52
  ) -> None: ...
48
- def ClearField(self, field_name: typing_extensions.Literal["fab_id",b"fab_id","fab_version",b"fab_version","override_config",b"override_config"]) -> None: ...
53
+ def HasField(self, field_name: typing_extensions.Literal["fab",b"fab"]) -> builtins.bool: ...
54
+ def ClearField(self, field_name: typing_extensions.Literal["fab",b"fab","fab_id",b"fab_id","fab_version",b"fab_version","override_config",b"override_config"]) -> None: ...
49
55
  global___CreateRunRequest = CreateRunRequest
50
56
 
51
57
  class CreateRunResponse(google.protobuf.message.Message):
@@ -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 fab_pb2 as flwr_dot_proto_dot_fab__pb2
6
7
  from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
7
8
 
8
9
 
@@ -40,6 +41,11 @@ class DriverStub(object):
40
41
  request_serializer=flwr_dot_proto_dot_run__pb2.GetRunRequest.SerializeToString,
41
42
  response_deserializer=flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
42
43
  )
44
+ self.GetFab = channel.unary_unary(
45
+ '/flwr.proto.Driver/GetFab',
46
+ request_serializer=flwr_dot_proto_dot_fab__pb2.GetFabRequest.SerializeToString,
47
+ response_deserializer=flwr_dot_proto_dot_fab__pb2.GetFabResponse.FromString,
48
+ )
43
49
 
44
50
 
45
51
  class DriverServicer(object):
@@ -80,6 +86,13 @@ class DriverServicer(object):
80
86
  context.set_details('Method not implemented!')
81
87
  raise NotImplementedError('Method not implemented!')
82
88
 
89
+ def GetFab(self, request, context):
90
+ """Get FAB
91
+ """
92
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
93
+ context.set_details('Method not implemented!')
94
+ raise NotImplementedError('Method not implemented!')
95
+
83
96
 
84
97
  def add_DriverServicer_to_server(servicer, server):
85
98
  rpc_method_handlers = {
@@ -108,6 +121,11 @@ def add_DriverServicer_to_server(servicer, server):
108
121
  request_deserializer=flwr_dot_proto_dot_run__pb2.GetRunRequest.FromString,
109
122
  response_serializer=flwr_dot_proto_dot_run__pb2.GetRunResponse.SerializeToString,
110
123
  ),
124
+ 'GetFab': grpc.unary_unary_rpc_method_handler(
125
+ servicer.GetFab,
126
+ request_deserializer=flwr_dot_proto_dot_fab__pb2.GetFabRequest.FromString,
127
+ response_serializer=flwr_dot_proto_dot_fab__pb2.GetFabResponse.SerializeToString,
128
+ ),
111
129
  }
112
130
  generic_handler = grpc.method_handlers_generic_handler(
113
131
  'flwr.proto.Driver', rpc_method_handlers)
@@ -202,3 +220,20 @@ class Driver(object):
202
220
  flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
203
221
  options, channel_credentials,
204
222
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
223
+
224
+ @staticmethod
225
+ def GetFab(request,
226
+ target,
227
+ options=(),
228
+ channel_credentials=None,
229
+ call_credentials=None,
230
+ insecure=False,
231
+ compression=None,
232
+ wait_for_ready=None,
233
+ timeout=None,
234
+ metadata=None):
235
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.Driver/GetFab',
236
+ flwr_dot_proto_dot_fab__pb2.GetFabRequest.SerializeToString,
237
+ flwr_dot_proto_dot_fab__pb2.GetFabResponse.FromString,
238
+ options, channel_credentials,
239
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -4,6 +4,7 @@ isort:skip_file
4
4
  """
5
5
  import abc
6
6
  import flwr.proto.driver_pb2
7
+ import flwr.proto.fab_pb2
7
8
  import flwr.proto.run_pb2
8
9
  import grpc
9
10
 
@@ -34,6 +35,11 @@ class DriverStub:
34
35
  flwr.proto.run_pb2.GetRunResponse]
35
36
  """Get run details"""
36
37
 
38
+ GetFab: grpc.UnaryUnaryMultiCallable[
39
+ flwr.proto.fab_pb2.GetFabRequest,
40
+ flwr.proto.fab_pb2.GetFabResponse]
41
+ """Get FAB"""
42
+
37
43
 
38
44
  class DriverServicer(metaclass=abc.ABCMeta):
39
45
  @abc.abstractmethod
@@ -76,5 +82,13 @@ class DriverServicer(metaclass=abc.ABCMeta):
76
82
  """Get run details"""
77
83
  pass
78
84
 
85
+ @abc.abstractmethod
86
+ def GetFab(self,
87
+ request: flwr.proto.fab_pb2.GetFabRequest,
88
+ context: grpc.ServicerContext,
89
+ ) -> flwr.proto.fab_pb2.GetFabResponse:
90
+ """Get FAB"""
91
+ pass
92
+
79
93
 
80
94
  def add_DriverServicer_to_server(servicer: DriverServicer, server: grpc.Server) -> None: ...
flwr/proto/exec_pb2.py CHANGED
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
15
15
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
16
16
 
17
17
 
18
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xb8\x01\n\x0fStartRunRequest\x12\x10\n\x08\x66\x61\x62_file\x18\x01 \x01(\x0c\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\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(\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
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xd3\x02\n\x0fStartRunRequest\x12\x10\n\x08\x66\x61\x62_file\x18\x01 \x01(\x0c\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(\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')
19
19
 
20
20
  _globals = globals()
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -24,16 +24,20 @@ if _descriptor._USE_C_DESCRIPTORS == False:
24
24
  DESCRIPTOR._options = None
25
25
  _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._options = None
26
26
  _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
27
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._options = None
28
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_options = b'8\001'
27
29
  _globals['_STARTRUNREQUEST']._serialized_start=66
28
- _globals['_STARTRUNREQUEST']._serialized_end=250
29
- _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=177
30
- _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=250
31
- _globals['_STARTRUNRESPONSE']._serialized_start=252
32
- _globals['_STARTRUNRESPONSE']._serialized_end=286
33
- _globals['_STREAMLOGSREQUEST']._serialized_start=288
34
- _globals['_STREAMLOGSREQUEST']._serialized_end=323
35
- _globals['_STREAMLOGSRESPONSE']._serialized_start=325
36
- _globals['_STREAMLOGSRESPONSE']._serialized_end=365
37
- _globals['_EXEC']._serialized_start=368
38
- _globals['_EXEC']._serialized_end=528
30
+ _globals['_STARTRUNREQUEST']._serialized_end=405
31
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=255
32
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=328
33
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_start=330
34
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_end=405
35
+ _globals['_STARTRUNRESPONSE']._serialized_start=407
36
+ _globals['_STARTRUNRESPONSE']._serialized_end=441
37
+ _globals['_STREAMLOGSREQUEST']._serialized_start=443
38
+ _globals['_STREAMLOGSREQUEST']._serialized_end=478
39
+ _globals['_STREAMLOGSRESPONSE']._serialized_start=480
40
+ _globals['_STREAMLOGSRESPONSE']._serialized_end=520
41
+ _globals['_EXEC']._serialized_start=523
42
+ _globals['_EXEC']._serialized_end=683
39
43
  # @@protoc_insertion_point(module_scope)
flwr/proto/exec_pb2.pyi CHANGED
@@ -29,17 +29,36 @@ class StartRunRequest(google.protobuf.message.Message):
29
29
  def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
30
30
  def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
31
31
 
32
+ class FederationConfigEntry(google.protobuf.message.Message):
33
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
34
+ KEY_FIELD_NUMBER: builtins.int
35
+ VALUE_FIELD_NUMBER: builtins.int
36
+ key: typing.Text
37
+ @property
38
+ def value(self) -> flwr.proto.transport_pb2.Scalar: ...
39
+ def __init__(self,
40
+ *,
41
+ key: typing.Text = ...,
42
+ value: typing.Optional[flwr.proto.transport_pb2.Scalar] = ...,
43
+ ) -> None: ...
44
+ def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
45
+ def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
46
+
32
47
  FAB_FILE_FIELD_NUMBER: builtins.int
33
48
  OVERRIDE_CONFIG_FIELD_NUMBER: builtins.int
49
+ FEDERATION_CONFIG_FIELD_NUMBER: builtins.int
34
50
  fab_file: builtins.bytes
35
51
  @property
36
52
  def override_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
53
+ @property
54
+ def federation_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
37
55
  def __init__(self,
38
56
  *,
39
57
  fab_file: builtins.bytes = ...,
40
58
  override_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
59
+ federation_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
41
60
  ) -> None: ...
42
- def ClearField(self, field_name: typing_extensions.Literal["fab_file",b"fab_file","override_config",b"override_config"]) -> None: ...
61
+ def ClearField(self, field_name: typing_extensions.Literal["fab_file",b"fab_file","federation_config",b"federation_config","override_config",b"override_config"]) -> None: ...
43
62
  global___StartRunRequest = StartRunRequest
44
63
 
45
64
  class StartRunResponse(google.protobuf.message.Message):