flwr-nightly 1.10.0.dev20240707__py3-none-any.whl → 1.11.0.dev20240724__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 (99) hide show
  1. flwr/cli/build.py +16 -2
  2. flwr/cli/config_utils.py +47 -27
  3. flwr/cli/install.py +17 -1
  4. flwr/cli/new/new.py +32 -21
  5. flwr/cli/new/templates/app/code/{client.hf.py.tpl → client.huggingface.py.tpl} +15 -5
  6. flwr/cli/new/templates/app/code/client.jax.py.tpl +2 -1
  7. flwr/cli/new/templates/app/code/client.mlx.py.tpl +36 -13
  8. flwr/cli/new/templates/app/code/client.numpy.py.tpl +2 -1
  9. flwr/cli/new/templates/app/code/client.pytorch.py.tpl +16 -5
  10. flwr/cli/new/templates/app/code/client.sklearn.py.tpl +6 -3
  11. flwr/cli/new/templates/app/code/client.tensorflow.py.tpl +25 -5
  12. flwr/cli/new/templates/app/code/flwr_tune/app.py.tpl +22 -19
  13. flwr/cli/new/templates/app/code/flwr_tune/client.py.tpl +5 -3
  14. flwr/cli/new/templates/app/code/flwr_tune/server.py.tpl +1 -1
  15. flwr/cli/new/templates/app/code/server.huggingface.py.tpl +23 -0
  16. flwr/cli/new/templates/app/code/server.jax.py.tpl +16 -8
  17. flwr/cli/new/templates/app/code/server.mlx.py.tpl +12 -7
  18. flwr/cli/new/templates/app/code/server.numpy.py.tpl +16 -8
  19. flwr/cli/new/templates/app/code/server.pytorch.py.tpl +15 -13
  20. flwr/cli/new/templates/app/code/server.sklearn.py.tpl +17 -10
  21. flwr/cli/new/templates/app/code/server.tensorflow.py.tpl +16 -13
  22. flwr/cli/new/templates/app/code/{task.hf.py.tpl → task.huggingface.py.tpl} +14 -2
  23. flwr/cli/new/templates/app/code/task.mlx.py.tpl +14 -2
  24. flwr/cli/new/templates/app/code/task.pytorch.py.tpl +14 -3
  25. flwr/cli/new/templates/app/code/task.tensorflow.py.tpl +13 -1
  26. flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +9 -12
  27. flwr/cli/new/templates/app/pyproject.huggingface.toml.tpl +38 -0
  28. flwr/cli/new/templates/app/pyproject.jax.toml.tpl +17 -11
  29. flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +17 -12
  30. flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +12 -12
  31. flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +13 -12
  32. flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +12 -12
  33. flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +15 -12
  34. flwr/cli/run/run.py +133 -54
  35. flwr/client/app.py +56 -24
  36. flwr/client/client_app.py +28 -8
  37. flwr/client/grpc_adapter_client/connection.py +3 -2
  38. flwr/client/grpc_client/connection.py +3 -2
  39. flwr/client/grpc_rere_client/connection.py +17 -6
  40. flwr/client/message_handler/message_handler.py +1 -1
  41. flwr/client/node_state.py +59 -12
  42. flwr/client/node_state_tests.py +4 -3
  43. flwr/client/rest_client/connection.py +19 -8
  44. flwr/client/supernode/app.py +39 -39
  45. flwr/client/typing.py +2 -2
  46. flwr/common/config.py +92 -2
  47. flwr/common/constant.py +3 -0
  48. flwr/common/context.py +24 -9
  49. flwr/common/logger.py +25 -0
  50. flwr/common/object_ref.py +84 -21
  51. flwr/common/serde.py +45 -0
  52. flwr/common/telemetry.py +17 -0
  53. flwr/common/typing.py +5 -0
  54. flwr/proto/common_pb2.py +36 -0
  55. flwr/proto/common_pb2.pyi +121 -0
  56. flwr/proto/common_pb2_grpc.py +4 -0
  57. flwr/proto/common_pb2_grpc.pyi +4 -0
  58. flwr/proto/driver_pb2.py +24 -19
  59. flwr/proto/driver_pb2.pyi +21 -1
  60. flwr/proto/exec_pb2.py +20 -11
  61. flwr/proto/exec_pb2.pyi +41 -1
  62. flwr/proto/run_pb2.py +12 -7
  63. flwr/proto/run_pb2.pyi +22 -1
  64. flwr/proto/task_pb2.py +7 -8
  65. flwr/server/__init__.py +2 -0
  66. flwr/server/compat/legacy_context.py +5 -4
  67. flwr/server/driver/grpc_driver.py +82 -140
  68. flwr/server/run_serverapp.py +40 -18
  69. flwr/server/server_app.py +56 -10
  70. flwr/server/serverapp_components.py +52 -0
  71. flwr/server/superlink/driver/driver_servicer.py +18 -3
  72. flwr/server/superlink/fleet/message_handler/message_handler.py +13 -2
  73. flwr/server/superlink/fleet/vce/backend/__init__.py +1 -1
  74. flwr/server/superlink/fleet/vce/backend/backend.py +4 -4
  75. flwr/server/superlink/fleet/vce/backend/raybackend.py +10 -10
  76. flwr/server/superlink/fleet/vce/vce_api.py +149 -117
  77. flwr/server/superlink/state/in_memory_state.py +11 -3
  78. flwr/server/superlink/state/sqlite_state.py +23 -8
  79. flwr/server/superlink/state/state.py +7 -2
  80. flwr/server/typing.py +2 -0
  81. flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +18 -2
  82. flwr/simulation/__init__.py +1 -1
  83. flwr/simulation/app.py +4 -3
  84. flwr/simulation/ray_transport/ray_actor.py +15 -19
  85. flwr/simulation/ray_transport/ray_client_proxy.py +22 -9
  86. flwr/simulation/run_simulation.py +269 -70
  87. flwr/superexec/app.py +17 -11
  88. flwr/superexec/deployment.py +111 -35
  89. flwr/superexec/exec_grpc.py +5 -1
  90. flwr/superexec/exec_servicer.py +6 -1
  91. flwr/superexec/executor.py +21 -0
  92. flwr/superexec/simulation.py +181 -0
  93. {flwr_nightly-1.10.0.dev20240707.dist-info → flwr_nightly-1.11.0.dev20240724.dist-info}/METADATA +3 -2
  94. {flwr_nightly-1.10.0.dev20240707.dist-info → flwr_nightly-1.11.0.dev20240724.dist-info}/RECORD +97 -91
  95. flwr/cli/new/templates/app/code/server.hf.py.tpl +0 -17
  96. flwr/cli/new/templates/app/pyproject.hf.toml.tpl +0 -37
  97. {flwr_nightly-1.10.0.dev20240707.dist-info → flwr_nightly-1.11.0.dev20240724.dist-info}/LICENSE +0 -0
  98. {flwr_nightly-1.10.0.dev20240707.dist-info → flwr_nightly-1.11.0.dev20240724.dist-info}/WHEEL +0 -0
  99. {flwr_nightly-1.10.0.dev20240707.dist-info → flwr_nightly-1.11.0.dev20240724.dist-info}/entry_points.txt +0 -0
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/common/serde.py CHANGED
@@ -671,3 +671,48 @@ def message_from_taskres(taskres: TaskRes) -> Message:
671
671
  )
672
672
  message.metadata.created_at = taskres.task.created_at
673
673
  return message
674
+
675
+
676
+ # === User configs ===
677
+
678
+
679
+ def user_config_to_proto(user_config: typing.UserConfig) -> Any:
680
+ """Serialize `UserConfig` to ProtoBuf."""
681
+ proto = {}
682
+ for key, value in user_config.items():
683
+ proto[key] = user_config_value_to_proto(value)
684
+ return proto
685
+
686
+
687
+ def user_config_from_proto(proto: Any) -> typing.UserConfig:
688
+ """Deserialize `UserConfig` from ProtoBuf."""
689
+ metrics = {}
690
+ for key, value in proto.items():
691
+ metrics[key] = user_config_value_from_proto(value)
692
+ return metrics
693
+
694
+
695
+ def user_config_value_to_proto(user_config_value: typing.UserConfigValue) -> Scalar:
696
+ """Serialize `UserConfigValue` to ProtoBuf."""
697
+ if isinstance(user_config_value, bool):
698
+ return Scalar(bool=user_config_value)
699
+
700
+ if isinstance(user_config_value, float):
701
+ return Scalar(double=user_config_value)
702
+
703
+ if isinstance(user_config_value, int):
704
+ return Scalar(sint64=user_config_value)
705
+
706
+ if isinstance(user_config_value, str):
707
+ return Scalar(string=user_config_value)
708
+
709
+ raise ValueError(
710
+ f"Accepted types: {bool, float, int, str} (but not {type(user_config_value)})"
711
+ )
712
+
713
+
714
+ def user_config_value_from_proto(scalar_msg: Scalar) -> typing.UserConfigValue:
715
+ """Deserialize `UserConfigValue` from ProtoBuf."""
716
+ scalar_field = scalar_msg.WhichOneof("scalar")
717
+ scalar = getattr(scalar_msg, cast(str, scalar_field))
718
+ return cast(typing.UserConfigValue, scalar)
flwr/common/telemetry.py CHANGED
@@ -64,6 +64,18 @@ def _get_home() -> Path:
64
64
  return Path().home()
65
65
 
66
66
 
67
+ def _get_partner_id() -> str:
68
+ """Get partner ID."""
69
+ partner_id = os.getenv("FLWR_TELEMETRY_PARTNER_ID")
70
+ if not partner_id:
71
+ return "unavailable"
72
+ try:
73
+ uuid.UUID(partner_id)
74
+ except ValueError:
75
+ partner_id = "invalid"
76
+ return partner_id
77
+
78
+
67
79
  def _get_source_id() -> str:
68
80
  """Get existing or new source ID."""
69
81
  source_id = "unavailable"
@@ -177,6 +189,7 @@ state: Dict[str, Union[Optional[str], Optional[ThreadPoolExecutor]]] = {
177
189
  "executor": None,
178
190
  "source": None,
179
191
  "cluster": None,
192
+ "partner": None,
180
193
  }
181
194
 
182
195
 
@@ -202,11 +215,15 @@ def create_event(event_type: EventType, event_details: Optional[Dict[str, Any]])
202
215
  if state["cluster"] is None:
203
216
  state["cluster"] = str(uuid.uuid4())
204
217
 
218
+ if state["partner"] is None:
219
+ state["partner"] = _get_partner_id()
220
+
205
221
  if event_details is None:
206
222
  event_details = {}
207
223
 
208
224
  date = datetime.datetime.now(tz=datetime.timezone.utc).isoformat()
209
225
  context = {
226
+ "partner": state["partner"],
210
227
  "source": state["source"],
211
228
  "cluster": state["cluster"],
212
229
  "date": date,
flwr/common/typing.py CHANGED
@@ -60,6 +60,10 @@ MetricsAggregationFn = Callable[[List[Tuple[int, Metrics]]], Metrics]
60
60
  Config = Dict[str, Scalar]
61
61
  Properties = Dict[str, Scalar]
62
62
 
63
+ # Value type for user configs
64
+ UserConfigValue = Union[bool, float, int, str]
65
+ UserConfig = Dict[str, UserConfigValue]
66
+
63
67
 
64
68
  class Code(Enum):
65
69
  """Client status codes."""
@@ -194,3 +198,4 @@ class Run:
194
198
  run_id: int
195
199
  fab_id: str
196
200
  fab_version: str
201
+ override_config: UserConfig
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: flwr/proto/common.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\x17\x66lwr/proto/common.proto\x12\nflwr.proto\"\x1a\n\nDoubleList\x12\x0c\n\x04vals\x18\x01 \x03(\x01\"\x1a\n\nSint64List\x12\x0c\n\x04vals\x18\x01 \x03(\x12\"\x18\n\x08\x42oolList\x12\x0c\n\x04vals\x18\x01 \x03(\x08\"\x1a\n\nStringList\x12\x0c\n\x04vals\x18\x01 \x03(\t\"\x19\n\tBytesList\x12\x0c\n\x04vals\x18\x01 \x03(\x0c\"\xd9\x02\n\x12\x43onfigsRecordValue\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x12)\n\tbool_list\x18\x17 \x01(\x0b\x32\x14.flwr.proto.BoolListH\x00\x12-\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x16.flwr.proto.StringListH\x00\x12+\n\nbytes_list\x18\x19 \x01(\x0b\x32\x15.flwr.proto.BytesListH\x00\x42\x07\n\x05valueb\x06proto3')
18
+
19
+ _globals = globals()
20
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.common_pb2', _globals)
22
+ if _descriptor._USE_C_DESCRIPTORS == False:
23
+ DESCRIPTOR._options = None
24
+ _globals['_DOUBLELIST']._serialized_start=39
25
+ _globals['_DOUBLELIST']._serialized_end=65
26
+ _globals['_SINT64LIST']._serialized_start=67
27
+ _globals['_SINT64LIST']._serialized_end=93
28
+ _globals['_BOOLLIST']._serialized_start=95
29
+ _globals['_BOOLLIST']._serialized_end=119
30
+ _globals['_STRINGLIST']._serialized_start=121
31
+ _globals['_STRINGLIST']._serialized_end=147
32
+ _globals['_BYTESLIST']._serialized_start=149
33
+ _globals['_BYTESLIST']._serialized_end=174
34
+ _globals['_CONFIGSRECORDVALUE']._serialized_start=177
35
+ _globals['_CONFIGSRECORDVALUE']._serialized_end=522
36
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,121 @@
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.internal.containers
8
+ import google.protobuf.message
9
+ import typing
10
+ import typing_extensions
11
+
12
+ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
13
+
14
+ class DoubleList(google.protobuf.message.Message):
15
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
16
+ VALS_FIELD_NUMBER: builtins.int
17
+ @property
18
+ def vals(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.float]: ...
19
+ def __init__(self,
20
+ *,
21
+ vals: typing.Optional[typing.Iterable[builtins.float]] = ...,
22
+ ) -> None: ...
23
+ def ClearField(self, field_name: typing_extensions.Literal["vals",b"vals"]) -> None: ...
24
+ global___DoubleList = DoubleList
25
+
26
+ class Sint64List(google.protobuf.message.Message):
27
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
28
+ VALS_FIELD_NUMBER: builtins.int
29
+ @property
30
+ def vals(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ...
31
+ def __init__(self,
32
+ *,
33
+ vals: typing.Optional[typing.Iterable[builtins.int]] = ...,
34
+ ) -> None: ...
35
+ def ClearField(self, field_name: typing_extensions.Literal["vals",b"vals"]) -> None: ...
36
+ global___Sint64List = Sint64List
37
+
38
+ class BoolList(google.protobuf.message.Message):
39
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
40
+ VALS_FIELD_NUMBER: builtins.int
41
+ @property
42
+ def vals(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bool]: ...
43
+ def __init__(self,
44
+ *,
45
+ vals: typing.Optional[typing.Iterable[builtins.bool]] = ...,
46
+ ) -> None: ...
47
+ def ClearField(self, field_name: typing_extensions.Literal["vals",b"vals"]) -> None: ...
48
+ global___BoolList = BoolList
49
+
50
+ class StringList(google.protobuf.message.Message):
51
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
52
+ VALS_FIELD_NUMBER: builtins.int
53
+ @property
54
+ def vals(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ...
55
+ def __init__(self,
56
+ *,
57
+ vals: typing.Optional[typing.Iterable[typing.Text]] = ...,
58
+ ) -> None: ...
59
+ def ClearField(self, field_name: typing_extensions.Literal["vals",b"vals"]) -> None: ...
60
+ global___StringList = StringList
61
+
62
+ class BytesList(google.protobuf.message.Message):
63
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
64
+ VALS_FIELD_NUMBER: builtins.int
65
+ @property
66
+ def vals(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: ...
67
+ def __init__(self,
68
+ *,
69
+ vals: typing.Optional[typing.Iterable[builtins.bytes]] = ...,
70
+ ) -> None: ...
71
+ def ClearField(self, field_name: typing_extensions.Literal["vals",b"vals"]) -> None: ...
72
+ global___BytesList = BytesList
73
+
74
+ class ConfigsRecordValue(google.protobuf.message.Message):
75
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
76
+ DOUBLE_FIELD_NUMBER: builtins.int
77
+ SINT64_FIELD_NUMBER: builtins.int
78
+ BOOL_FIELD_NUMBER: builtins.int
79
+ STRING_FIELD_NUMBER: builtins.int
80
+ BYTES_FIELD_NUMBER: builtins.int
81
+ DOUBLE_LIST_FIELD_NUMBER: builtins.int
82
+ SINT64_LIST_FIELD_NUMBER: builtins.int
83
+ BOOL_LIST_FIELD_NUMBER: builtins.int
84
+ STRING_LIST_FIELD_NUMBER: builtins.int
85
+ BYTES_LIST_FIELD_NUMBER: builtins.int
86
+ double: builtins.float
87
+ """Single element"""
88
+
89
+ sint64: builtins.int
90
+ bool: builtins.bool
91
+ string: typing.Text
92
+ bytes: builtins.bytes
93
+ @property
94
+ def double_list(self) -> global___DoubleList:
95
+ """List types"""
96
+ pass
97
+ @property
98
+ def sint64_list(self) -> global___Sint64List: ...
99
+ @property
100
+ def bool_list(self) -> global___BoolList: ...
101
+ @property
102
+ def string_list(self) -> global___StringList: ...
103
+ @property
104
+ def bytes_list(self) -> global___BytesList: ...
105
+ def __init__(self,
106
+ *,
107
+ double: builtins.float = ...,
108
+ sint64: builtins.int = ...,
109
+ bool: builtins.bool = ...,
110
+ string: typing.Text = ...,
111
+ bytes: builtins.bytes = ...,
112
+ double_list: typing.Optional[global___DoubleList] = ...,
113
+ sint64_list: typing.Optional[global___Sint64List] = ...,
114
+ bool_list: typing.Optional[global___BoolList] = ...,
115
+ string_list: typing.Optional[global___StringList] = ...,
116
+ bytes_list: typing.Optional[global___BytesList] = ...,
117
+ ) -> None: ...
118
+ def HasField(self, field_name: typing_extensions.Literal["bool",b"bool","bool_list",b"bool_list","bytes",b"bytes","bytes_list",b"bytes_list","double",b"double","double_list",b"double_list","sint64",b"sint64","sint64_list",b"sint64_list","string",b"string","string_list",b"string_list","value",b"value"]) -> builtins.bool: ...
119
+ def ClearField(self, field_name: typing_extensions.Literal["bool",b"bool","bool_list",b"bool_list","bytes",b"bytes","bytes_list",b"bytes_list","double",b"double","double_list",b"double_list","sint64",b"sint64","sint64_list",b"sint64_list","string",b"string","string_list",b"string_list","value",b"value"]) -> None: ...
120
+ def WhichOneof(self, oneof_group: typing_extensions.Literal["value",b"value"]) -> typing.Optional[typing_extensions.Literal["double","sint64","bool","string","bytes","double_list","sint64_list","bool_list","string_list","bytes_list"]]: ...
121
+ global___ConfigsRecordValue = ConfigsRecordValue
@@ -0,0 +1,4 @@
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
+
@@ -0,0 +1,4 @@
1
+ """
2
+ @generated by mypy-protobuf. Do not edit manually!
3
+ isort:skip_file
4
+ """
flwr/proto/driver_pb2.py CHANGED
@@ -15,31 +15,36 @@ _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 transport_pb2 as flwr_dot_proto_dot_transport__pb2
18
19
 
19
20
 
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')
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')
21
22
 
22
23
  _globals = globals()
23
24
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
24
25
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.driver_pb2', _globals)
25
26
  if _descriptor._USE_C_DESCRIPTORS == False:
26
27
  DESCRIPTOR._options = None
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
28
+ _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._options = None
29
+ _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
45
50
  # @@protoc_insertion_point(module_scope)
flwr/proto/driver_pb2.pyi CHANGED
@@ -5,6 +5,7 @@ isort:skip_file
5
5
  import builtins
6
6
  import flwr.proto.node_pb2
7
7
  import flwr.proto.task_pb2
8
+ import flwr.proto.transport_pb2
8
9
  import google.protobuf.descriptor
9
10
  import google.protobuf.internal.containers
10
11
  import google.protobuf.message
@@ -16,16 +17,35 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
16
17
  class CreateRunRequest(google.protobuf.message.Message):
17
18
  """CreateRun"""
18
19
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
20
+ class OverrideConfigEntry(google.protobuf.message.Message):
21
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
22
+ KEY_FIELD_NUMBER: builtins.int
23
+ VALUE_FIELD_NUMBER: builtins.int
24
+ key: typing.Text
25
+ @property
26
+ def value(self) -> flwr.proto.transport_pb2.Scalar: ...
27
+ def __init__(self,
28
+ *,
29
+ key: typing.Text = ...,
30
+ value: typing.Optional[flwr.proto.transport_pb2.Scalar] = ...,
31
+ ) -> None: ...
32
+ def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
33
+ def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
34
+
19
35
  FAB_ID_FIELD_NUMBER: builtins.int
20
36
  FAB_VERSION_FIELD_NUMBER: builtins.int
37
+ OVERRIDE_CONFIG_FIELD_NUMBER: builtins.int
21
38
  fab_id: typing.Text
22
39
  fab_version: typing.Text
40
+ @property
41
+ def override_config(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, flwr.proto.transport_pb2.Scalar]: ...
23
42
  def __init__(self,
24
43
  *,
25
44
  fab_id: typing.Text = ...,
26
45
  fab_version: typing.Text = ...,
46
+ override_config: typing.Optional[typing.Mapping[typing.Text, flwr.proto.transport_pb2.Scalar]] = ...,
27
47
  ) -> None: ...
28
- def ClearField(self, field_name: typing_extensions.Literal["fab_id",b"fab_id","fab_version",b"fab_version"]) -> 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: ...
29
49
  global___CreateRunRequest = CreateRunRequest
30
50
 
31
51
  class CreateRunResponse(google.protobuf.message.Message):
flwr/proto/exec_pb2.py CHANGED
@@ -12,23 +12,32 @@ from google.protobuf.internal import builder as _builder
12
12
  _sym_db = _symbol_database.Default()
13
13
 
14
14
 
15
+ from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
15
16
 
16
17
 
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
+ 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')
18
19
 
19
20
  _globals = globals()
20
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
22
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.exec_pb2', _globals)
22
23
  if _descriptor._USE_C_DESCRIPTORS == False:
23
24
  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
25
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._options = None
26
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
27
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._options = None
28
+ _globals['_STARTRUNREQUEST_FEDERATIONCONFIGENTRY']._serialized_options = b'8\001'
29
+ _globals['_STARTRUNREQUEST']._serialized_start=66
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
34
43
  # @@protoc_insertion_point(module_scope)