flwr-nightly 1.23.0.dev20251017__py3-none-any.whl → 1.23.0.dev20251021__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flwr-nightly might be problematic. Click here for more details.

flwr/cli/app.py CHANGED
@@ -28,9 +28,9 @@ from .new import new
28
28
  from .pull import pull
29
29
  from .run import run
30
30
  from .stop import stop
31
- from .supernode import create as supernode_create
32
- from .supernode import delete as supernode_delete
33
31
  from .supernode import ls as supernode_list
32
+ from .supernode import register as supernode_register
33
+ from .supernode import unregister as supernode_unregister
34
34
 
35
35
  app = typer.Typer(
36
36
  help=typer.style(
@@ -55,8 +55,8 @@ app.command()(pull)
55
55
 
56
56
  # Create supernode command group
57
57
  supernode_app = typer.Typer(help="Manage SuperNodes")
58
- supernode_app.command()(supernode_create)
59
- supernode_app.command()(supernode_delete)
58
+ supernode_app.command()(supernode_register)
59
+ supernode_app.command()(supernode_unregister)
60
60
  # Make it appear as "list"
61
61
  supernode_app.command("list")(supernode_list)
62
62
  # Hide "ls" command (left as alias)
flwr/cli/ls.py CHANGED
@@ -220,14 +220,14 @@ def _to_table(run_list: list[_RunListType]) -> Table:
220
220
 
221
221
  # Add columns
222
222
  table.add_column(
223
- Text("Run ID", justify="center"), style="bright_white", no_wrap=True
223
+ Text("Run ID", justify="center"), style="bright_black", no_wrap=True
224
224
  )
225
- table.add_column(Text("FAB", justify="center"), style="dim white")
225
+ table.add_column(Text("FAB", justify="center"), style="bright_black")
226
226
  table.add_column(Text("Status", justify="center"))
227
227
  table.add_column(Text("Elapsed", justify="center"), style="blue")
228
- table.add_column(Text("Created At", justify="center"), style="dim white")
229
- table.add_column(Text("Running At", justify="center"), style="dim white")
230
- table.add_column(Text("Finished At", justify="center"), style="dim white")
228
+ table.add_column(Text("Created At", justify="center"), style="bright_black")
229
+ table.add_column(Text("Running At", justify="center"), style="bright_black")
230
+ table.add_column(Text("Finished At", justify="center"), style="bright_black")
231
231
 
232
232
  for row in run_list:
233
233
  (
@@ -14,12 +14,12 @@
14
14
  # ==============================================================================
15
15
  """Flower command line interface `supernode` command."""
16
16
 
17
- from .create import create as create
18
- from .delete import delete as delete
19
17
  from .ls import ls as ls
18
+ from .register import register as register
19
+ from .unregister import unregister as unregister
20
20
 
21
21
  __all__ = [
22
- "create",
23
- "delete",
24
22
  "ls",
23
+ "register",
24
+ "unregister",
25
25
  ]
flwr/cli/supernode/ls.py CHANGED
@@ -32,12 +32,12 @@ from flwr.cli.config_utils import (
32
32
  process_loaded_project_config,
33
33
  validate_federation_in_project_config,
34
34
  )
35
- from flwr.common.constant import FAB_CONFIG_FILE, CliOutputFormat
35
+ from flwr.common.constant import FAB_CONFIG_FILE, NOOP_FLWR_AID, CliOutputFormat
36
36
  from flwr.common.date import format_timedelta, isoformat8601_utc
37
37
  from flwr.common.logger import print_json_error, redirect_output, restore_output
38
38
  from flwr.proto.control_pb2 import ( # pylint: disable=E0611
39
- ListNodesCliRequest,
40
- ListNodesCliResponse,
39
+ ListNodesRequest,
40
+ ListNodesResponse,
41
41
  )
42
42
  from flwr.proto.control_pb2_grpc import ControlStub
43
43
  from flwr.proto.node_pb2 import NodeInfo # pylint: disable=E0611
@@ -73,13 +73,6 @@ def ls( # pylint: disable=R0914, R0913, R0917
73
73
  help="Enable verbose output",
74
74
  ),
75
75
  ] = False,
76
- dry_run: Annotated[
77
- bool,
78
- typer.Option(
79
- "--dry-run",
80
- help="Simulate the command without contacting any SuperNodes",
81
- ),
82
- ] = False,
83
76
  ) -> None:
84
77
  """List SuperNodes in the federation."""
85
78
  # Resolve command used (list or ls)
@@ -105,7 +98,7 @@ def ls( # pylint: disable=R0914, R0913, R0917
105
98
  channel = init_channel(app, federation_config, auth_plugin)
106
99
  stub = ControlStub(channel)
107
100
  typer.echo("📄 Listing all nodes...")
108
- formatted_nodes = _list_nodes(stub, dry_run=dry_run)
101
+ formatted_nodes = _list_nodes(stub)
109
102
  restore_output()
110
103
  if output_format == CliOutputFormat.JSON:
111
104
  Console().print_json(_to_json(formatted_nodes, verbose=verbose))
@@ -132,12 +125,10 @@ def ls( # pylint: disable=R0914, R0913, R0917
132
125
  captured_output.close()
133
126
 
134
127
 
135
- def _list_nodes(stub: ControlStub, dry_run: bool) -> list[_NodeListType]:
128
+ def _list_nodes(stub: ControlStub) -> list[_NodeListType]:
136
129
  """List all nodes."""
137
130
  with flwr_cli_grpc_exc_handler():
138
- res: ListNodesCliResponse = stub.ListNodesCli(
139
- ListNodesCliRequest(dry_run=dry_run)
140
- )
131
+ res: ListNodesResponse = stub.ListNodes(ListNodesRequest())
141
132
 
142
133
  return _format_nodes(list(res.nodes_info), res.now)
143
134
 
@@ -153,7 +144,9 @@ def _format_nodes(
153
144
 
154
145
  formatted_nodes: list[_NodeListType] = []
155
146
  # Add rows
156
- for node in sorted(nodes_info, key=lambda x: datetime.fromisoformat(x.created_at)):
147
+ for node in sorted(
148
+ nodes_info, key=lambda x: datetime.fromisoformat(x.registered_at)
149
+ ):
157
150
 
158
151
  # Calculate elapsed times
159
152
  elapsed_time_activated = timedelta()
@@ -168,10 +161,10 @@ def _format_nodes(
168
161
  node.node_id,
169
162
  node.owner_aid,
170
163
  node.status,
171
- _format_datetime(node.created_at),
164
+ _format_datetime(node.registered_at),
172
165
  _format_datetime(node.last_activated_at),
173
166
  _format_datetime(node.last_deactivated_at),
174
- _format_datetime(node.deleted_at),
167
+ _format_datetime(node.unregistered_at),
175
168
  format_timedelta(elapsed_time_activated),
176
169
  )
177
170
  )
@@ -185,12 +178,12 @@ def _to_table(nodes_info: list[_NodeListType], verbose: bool) -> Table:
185
178
 
186
179
  # Add columns
187
180
  table.add_column(
188
- Text("Node ID", justify="center"), style="bright_white", no_wrap=True
181
+ Text("Node ID", justify="center"), style="bright_black", no_wrap=True
189
182
  )
190
- table.add_column(Text("Owner", justify="center"), style="dim white")
183
+ table.add_column(Text("Owner", justify="center"))
191
184
  table.add_column(Text("Status", justify="center"))
192
185
  table.add_column(Text("Elapsed", justify="center"))
193
- table.add_column(Text("Status Changed @", justify="center"), style="dim white")
186
+ table.add_column(Text("Status Changed @", justify="center"), style="bright_black")
194
187
 
195
188
  for row in nodes_info:
196
189
  (
@@ -200,7 +193,7 @@ def _to_table(nodes_info: list[_NodeListType], verbose: bool) -> Table:
200
193
  _,
201
194
  last_activated_at,
202
195
  last_deactivated_at,
203
- deleted_at,
196
+ unregistered_at,
204
197
  elapse_activated,
205
198
  ) = row
206
199
 
@@ -210,12 +203,12 @@ def _to_table(nodes_info: list[_NodeListType], verbose: bool) -> Table:
210
203
  elif status == "offline":
211
204
  status_style = "bright_yellow"
212
205
  time_at = last_deactivated_at
213
- elif status == "deleted":
206
+ elif status == "unregistered":
214
207
  if not verbose:
215
208
  continue
216
209
  status_style = "red"
217
- time_at = deleted_at
218
- elif status == "created":
210
+ time_at = unregistered_at
211
+ elif status == "registered":
219
212
  status_style = "blue"
220
213
  time_at = "N/A"
221
214
  else:
@@ -223,7 +216,7 @@ def _to_table(nodes_info: list[_NodeListType], verbose: bool) -> Table:
223
216
 
224
217
  formatted_row = (
225
218
  f"[bold]{node_id}[/bold]",
226
- f"{owner_aid}",
219
+ f"{owner_aid}" if owner_aid != NOOP_FLWR_AID else f"[dim]{owner_aid}[/dim]",
227
220
  f"[{status_style}]{status}",
228
221
  f"[cyan]{elapse_activated}[/cyan]" if status == "online" else "",
229
222
  time_at,
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Flower command line interface `supernode create` command."""
15
+ """Flower command line interface `supernode register` command."""
16
16
 
17
17
 
18
18
  import io
@@ -36,8 +36,8 @@ from flwr.common.constant import FAB_CONFIG_FILE, CliOutputFormat
36
36
  from flwr.common.exit import ExitCode, flwr_exit
37
37
  from flwr.common.logger import print_json_error, redirect_output, restore_output
38
38
  from flwr.proto.control_pb2 import ( # pylint: disable=E0611
39
- CreateNodeCliRequest,
40
- CreateNodeCliResponse,
39
+ RegisterNodeRequest,
40
+ RegisterNodeResponse,
41
41
  )
42
42
  from flwr.proto.control_pb2_grpc import ControlStub
43
43
  from flwr.supercore.primitives.asymmetric import public_key_to_bytes, uses_nist_ec_curve
@@ -45,7 +45,7 @@ from flwr.supercore.primitives.asymmetric import public_key_to_bytes, uses_nist_
45
45
  from ..utils import flwr_cli_grpc_exc_handler, init_channel, load_cli_auth_plugin
46
46
 
47
47
 
48
- def create( # pylint: disable=R0914
48
+ def register( # pylint: disable=R0914
49
49
  public_key: Annotated[
50
50
  Path,
51
51
  typer.Argument(
@@ -90,7 +90,7 @@ def create( # pylint: disable=R0914
90
90
  federation, federation_config = validate_federation_in_project_config(
91
91
  federation, config
92
92
  )
93
- exit_if_no_address(federation_config, "supernode create")
93
+ exit_if_no_address(federation_config, "supernode register")
94
94
 
95
95
  channel = None
96
96
  try:
@@ -98,7 +98,7 @@ def create( # pylint: disable=R0914
98
98
  channel = init_channel(app, federation_config, auth_plugin)
99
99
  stub = ControlStub(channel) # pylint: disable=unused-variable # noqa: F841
100
100
 
101
- _create_node(
101
+ _register_node(
102
102
  stub=stub, public_key=public_key_bytes, output_format=output_format
103
103
  )
104
104
 
@@ -130,15 +130,16 @@ def create( # pylint: disable=R0914
130
130
  captured_output.close()
131
131
 
132
132
 
133
- def _create_node(stub: ControlStub, public_key: bytes, output_format: str) -> None:
134
- """Create a node."""
133
+ def _register_node(stub: ControlStub, public_key: bytes, output_format: str) -> None:
134
+ """Register a node."""
135
135
  with flwr_cli_grpc_exc_handler():
136
- response: CreateNodeCliResponse = stub.CreateNodeCli(
137
- request=CreateNodeCliRequest(public_key=public_key)
136
+ response: RegisterNodeResponse = stub.RegisterNode(
137
+ request=RegisterNodeRequest(public_key=public_key)
138
138
  )
139
139
  if response.node_id:
140
140
  typer.secho(
141
- f"✅ Node {response.node_id} created successfully.", fg=typer.colors.GREEN
141
+ f"✅ SuperNode {response.node_id} registered successfully.",
142
+ fg=typer.colors.GREEN,
142
143
  )
143
144
  if output_format == CliOutputFormat.JSON:
144
145
  run_output = json.dumps(
@@ -150,7 +151,7 @@ def _create_node(stub: ControlStub, public_key: bytes, output_format: str) -> No
150
151
  restore_output()
151
152
  Console().print_json(run_output)
152
153
  else:
153
- typer.secho("❌ Node couldn't be created.", fg=typer.colors.RED)
154
+ typer.secho("❌ SuperNode couldn't be registered.", fg=typer.colors.RED)
154
155
 
155
156
 
156
157
  def try_load_public_key(public_key_path: Path) -> bytes:
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Flower command line interface `supernode delete` command."""
15
+ """Flower command line interface `supernode unregister` command."""
16
16
 
17
17
 
18
18
  import io
@@ -31,13 +31,13 @@ from flwr.cli.config_utils import (
31
31
  )
32
32
  from flwr.common.constant import FAB_CONFIG_FILE, CliOutputFormat
33
33
  from flwr.common.logger import print_json_error, redirect_output, restore_output
34
- from flwr.proto.control_pb2 import DeleteNodeCliRequest # pylint: disable=E0611
34
+ from flwr.proto.control_pb2 import UnregisterNodeRequest # pylint: disable=E0611
35
35
  from flwr.proto.control_pb2_grpc import ControlStub
36
36
 
37
37
  from ..utils import flwr_cli_grpc_exc_handler, init_channel, load_cli_auth_plugin
38
38
 
39
39
 
40
- def delete( # pylint: disable=R0914
40
+ def unregister( # pylint: disable=R0914
41
41
  node_id: Annotated[
42
42
  int,
43
43
  typer.Argument(
@@ -61,7 +61,7 @@ def delete( # pylint: disable=R0914
61
61
  ),
62
62
  ] = CliOutputFormat.DEFAULT,
63
63
  ) -> None:
64
- """Remove a SuperNode from the federation."""
64
+ """Unregister a SuperNode from the federation."""
65
65
  suppress_output = output_format == CliOutputFormat.JSON
66
66
  captured_output = io.StringIO()
67
67
 
@@ -78,7 +78,7 @@ def delete( # pylint: disable=R0914
78
78
  federation, federation_config = validate_federation_in_project_config(
79
79
  federation, config
80
80
  )
81
- exit_if_no_address(federation_config, "supernode remove")
81
+ exit_if_no_address(federation_config, "supernode unregister")
82
82
 
83
83
  channel = None
84
84
  try:
@@ -86,7 +86,7 @@ def delete( # pylint: disable=R0914
86
86
  channel = init_channel(app, federation_config, auth_plugin)
87
87
  stub = ControlStub(channel) # pylint: disable=unused-variable # noqa: F841
88
88
 
89
- _delete_node(stub=stub, node_id=node_id, output_format=output_format)
89
+ _unregister_node(stub=stub, node_id=node_id, output_format=output_format)
90
90
 
91
91
  except ValueError as err:
92
92
  typer.secho(
@@ -116,15 +116,17 @@ def delete( # pylint: disable=R0914
116
116
  captured_output.close()
117
117
 
118
118
 
119
- def _delete_node(
119
+ def _unregister_node(
120
120
  stub: ControlStub,
121
121
  node_id: int,
122
122
  output_format: str,
123
123
  ) -> None:
124
- """Delete a SuperNode from the federation."""
124
+ """Unregister a SuperNode from the federation."""
125
125
  with flwr_cli_grpc_exc_handler():
126
- stub.DeleteNodeCli(request=DeleteNodeCliRequest(node_id=node_id))
127
- typer.secho(f"✅ SuperNode {node_id} deleted successfully.", fg=typer.colors.GREEN)
126
+ stub.UnregisterNode(request=UnregisterNodeRequest(node_id=node_id))
127
+ typer.secho(
128
+ f"✅ SuperNode {node_id} unregistered successfully.", fg=typer.colors.GREEN
129
+ )
128
130
  if output_format == CliOutputFormat.JSON:
129
131
  run_output = json.dumps(
130
132
  {
flwr/common/constant.py CHANGED
@@ -17,6 +17,8 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
+ import os
21
+
20
22
  TRANSPORT_TYPE_GRPC_BIDI = "grpc-bidi"
21
23
  TRANSPORT_TYPE_GRPC_RERE = "grpc-rere"
22
24
  TRANSPORT_TYPE_GRPC_ADAPTER = "grpc-adapter"
@@ -135,7 +137,9 @@ GC_THRESHOLD = 200_000_000 # 200 MB
135
137
  # Constants for Inflatable
136
138
  HEAD_BODY_DIVIDER = b"\x00"
137
139
  HEAD_VALUE_DIVIDER = " "
138
- MAX_ARRAY_CHUNK_SIZE = 20_971_520 # 20 MB
140
+ FLWR_PRIVATE_MAX_ARRAY_CHUNK_SIZE = int(
141
+ os.getenv("FLWR_PRIVATE_MAX_ARRAY_CHUNK_SIZE", "5242880")
142
+ ) # 5 MB
139
143
 
140
144
  # Constants for serialization
141
145
  INT64_MAX_VALUE = 9223372036854775807 # (1 << 63) - 1
@@ -144,8 +148,12 @@ INT64_MAX_VALUE = 9223372036854775807 # (1 << 63) - 1
144
148
  FLWR_APP_TOKEN_LENGTH = 128 # Length of the token used
145
149
 
146
150
  # Constants for object pushing and pulling
147
- MAX_CONCURRENT_PUSHES = 8 # Default maximum number of concurrent pushes
148
- MAX_CONCURRENT_PULLS = 8 # Default maximum number of concurrent pulls
151
+ FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES = int(
152
+ os.getenv("FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES", "2")
153
+ ) # Default maximum number of concurrent pushes
154
+ FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS = int(
155
+ os.getenv("FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS", "2")
156
+ ) # Default maximum number of concurrent pulls
149
157
  PULL_MAX_TIME = 7200 # Default maximum time to wait for pulling objects
150
158
  PULL_MAX_TRIES_PER_OBJECT = 500 # Default maximum number of tries to pull an object
151
159
  PULL_INITIAL_BACKOFF = 1 # Initial backoff time for pulling objects
@@ -299,5 +307,5 @@ class ExecPluginType:
299
307
 
300
308
 
301
309
  # Constants for No-op auth plugins
302
- NOOP_FLWR_AID = "sys_noauth"
310
+ NOOP_FLWR_AID = "<none>"
303
311
  NOOP_ACCOUNT_NAME = "sys_noauth"
@@ -43,6 +43,7 @@ class ExitCode:
43
43
  SUPERNODE_REST_ADDRESS_INVALID = 300
44
44
  # SUPERNODE_NODE_AUTH_KEYS_REQUIRED = 301 --- DELETED ---
45
45
  SUPERNODE_NODE_AUTH_KEY_INVALID = 302
46
+ SUPERNODE_STARTED_WITHOUT_TLS_BUT_NODE_AUTH_ENABLED = 303
46
47
 
47
48
  # SuperExec-specific exit codes (400-499)
48
49
  SUPEREXEC_INVALID_PLUGIN_CONFIG = 400
@@ -110,6 +111,10 @@ EXIT_CODE_HELP = {
110
111
  "Please ensure that the file path points to a valid private key "
111
112
  "file and try again."
112
113
  ),
114
+ ExitCode.SUPERNODE_STARTED_WITHOUT_TLS_BUT_NODE_AUTH_ENABLED: (
115
+ "The private key for SuperNode authentication was provided, but TLS is not "
116
+ "enabled. Node authentication can only be used when TLS is enabled."
117
+ ),
113
118
  # SuperExec-specific exit codes (400-499)
114
119
  ExitCode.SUPEREXEC_INVALID_PLUGIN_CONFIG: (
115
120
  "The YAML configuration for the SuperExec plugin is invalid."
@@ -25,10 +25,10 @@ from typing import Callable, Optional, TypeVar
25
25
  from flwr.proto.message_pb2 import ObjectTree # pylint: disable=E0611
26
26
 
27
27
  from .constant import (
28
+ FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS,
29
+ FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES,
28
30
  HEAD_BODY_DIVIDER,
29
31
  HEAD_VALUE_DIVIDER,
30
- MAX_CONCURRENT_PULLS,
31
- MAX_CONCURRENT_PUSHES,
32
32
  PULL_BACKOFF_CAP,
33
33
  PULL_INITIAL_BACKOFF,
34
34
  PULL_MAX_TIME,
@@ -118,7 +118,7 @@ def push_objects(
118
118
  *,
119
119
  object_ids_to_push: Optional[set[str]] = None,
120
120
  keep_objects: bool = False,
121
- max_concurrent_pushes: int = MAX_CONCURRENT_PUSHES,
121
+ max_concurrent_pushes: int = FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES,
122
122
  ) -> None:
123
123
  """Push multiple objects to the servicer.
124
124
 
@@ -137,7 +137,7 @@ def push_objects(
137
137
  If `True`, the original objects will be kept in the `objects` dictionary
138
138
  after pushing. If `False`, they will be removed from the dictionary to avoid
139
139
  high memory usage.
140
- max_concurrent_pushes : int (default: MAX_CONCURRENT_PUSHES)
140
+ max_concurrent_pushes : int (default: FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES)
141
141
  The maximum number of concurrent pushes to perform.
142
142
  """
143
143
  lock = threading.Lock()
@@ -168,7 +168,7 @@ def push_object_contents_from_iterable(
168
168
  object_contents: Iterable[tuple[str, bytes]],
169
169
  push_object_fn: Callable[[str, bytes], None],
170
170
  *,
171
- max_concurrent_pushes: int = MAX_CONCURRENT_PUSHES,
171
+ max_concurrent_pushes: int = FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES,
172
172
  ) -> None:
173
173
  """Push multiple object contents to the servicer.
174
174
 
@@ -181,7 +181,7 @@ def push_object_contents_from_iterable(
181
181
  A function that takes an object ID and its content as bytes, and pushes
182
182
  it to the servicer. This function should raise `ObjectIdNotPreregisteredError`
183
183
  if the object ID is not pre-registered.
184
- max_concurrent_pushes : int (default: MAX_CONCURRENT_PUSHES)
184
+ max_concurrent_pushes : int (default: FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PUSHES)
185
185
  The maximum number of concurrent pushes to perform.
186
186
  """
187
187
 
@@ -210,7 +210,7 @@ def pull_objects( # pylint: disable=too-many-arguments,too-many-locals
210
210
  object_ids: list[str],
211
211
  pull_object_fn: Callable[[str], bytes],
212
212
  *,
213
- max_concurrent_pulls: int = MAX_CONCURRENT_PULLS,
213
+ max_concurrent_pulls: int = FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS,
214
214
  max_time: Optional[float] = PULL_MAX_TIME,
215
215
  max_tries_per_object: Optional[int] = PULL_MAX_TRIES_PER_OBJECT,
216
216
  initial_backoff: float = PULL_INITIAL_BACKOFF,
@@ -227,7 +227,7 @@ def pull_objects( # pylint: disable=too-many-arguments,too-many-locals
227
227
  The function should raise `ObjectUnavailableError` if the object is not yet
228
228
  available, or `ObjectIdNotPreregisteredError` if the object ID is not
229
229
  pre-registered.
230
- max_concurrent_pulls : int (default: MAX_CONCURRENT_PULLS)
230
+ max_concurrent_pulls : int (default: FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS)
231
231
  The maximum number of concurrent pulls to perform.
232
232
  max_time : Optional[float] (default: PULL_MAX_TIME)
233
233
  The maximum time to wait for all pulls to complete. If `None`, waits
@@ -442,7 +442,7 @@ def pull_and_inflate_object_from_tree( # pylint: disable=R0913
442
442
  confirm_object_received_fn: Callable[[str], None],
443
443
  *,
444
444
  return_type: type[T] = InflatableObject, # type: ignore
445
- max_concurrent_pulls: int = MAX_CONCURRENT_PULLS,
445
+ max_concurrent_pulls: int = FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS,
446
446
  max_time: Optional[float] = PULL_MAX_TIME,
447
447
  max_tries_per_object: Optional[int] = PULL_MAX_TRIES_PER_OBJECT,
448
448
  initial_backoff: float = PULL_INITIAL_BACKOFF,
@@ -460,7 +460,7 @@ def pull_and_inflate_object_from_tree( # pylint: disable=R0913
460
460
  A function to confirm that the object has been received.
461
461
  return_type : type[T] (default: InflatableObject)
462
462
  The type of the object to return. Must be a subclass of `InflatableObject`.
463
- max_concurrent_pulls : int (default: MAX_CONCURRENT_PULLS)
463
+ max_concurrent_pulls : int (default: FLWR_PRIVATE_MAX_CONCURRENT_OBJ_PULLS)
464
464
  The maximum number of concurrent pulls to perform.
465
465
  max_time : Optional[float] (default: PULL_MAX_TIME)
466
466
  The maximum time to wait for all pulls to complete. If `None`, waits
@@ -25,7 +25,7 @@ from typing import TYPE_CHECKING, Any, cast, overload
25
25
 
26
26
  import numpy as np
27
27
 
28
- from ..constant import MAX_ARRAY_CHUNK_SIZE, SType
28
+ from ..constant import FLWR_PRIVATE_MAX_ARRAY_CHUNK_SIZE, SType
29
29
  from ..inflatable import (
30
30
  InflatableObject,
31
31
  add_header_to_object_body,
@@ -272,8 +272,8 @@ class Array(InflatableObject):
272
272
  chunks: list[tuple[str, InflatableObject]] = []
273
273
  # memoryview allows for zero-copy slicing
274
274
  data_view = memoryview(self.data)
275
- for start in range(0, len(data_view), MAX_ARRAY_CHUNK_SIZE):
276
- end = min(start + MAX_ARRAY_CHUNK_SIZE, len(data_view))
275
+ for start in range(0, len(data_view), FLWR_PRIVATE_MAX_ARRAY_CHUNK_SIZE):
276
+ end = min(start + FLWR_PRIVATE_MAX_ARRAY_CHUNK_SIZE, len(data_view))
277
277
  ac = ArrayChunk(data_view[start:end])
278
278
  chunks.append((ac.object_id, ac))
279
279
 
flwr/proto/control_pb2.py CHANGED
@@ -19,7 +19,7 @@ from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
19
19
  from flwr.proto import node_pb2 as flwr_dot_proto_dot_node__pb2
20
20
 
21
21
 
22
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x66lwr/proto/control.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1b\x66lwr/proto/recorddict.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x15\x66lwr/proto/node.proto\"\xfa\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\x34\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x18.flwr.proto.ConfigRecord\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\"2\n\x10StartRunResponse\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"<\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\"1\n\x0fListRunsRequest\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"\x9d\x01\n\x10ListRunsResponse\x12;\n\x08run_dict\x18\x01 \x03(\x0b\x32).flwr.proto.ListRunsResponse.RunDictEntry\x12\x0b\n\x03now\x18\x02 \x01(\t\x1a?\n\x0cRunDictEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\x1e\n\x05value\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run:\x02\x38\x01\"\x18\n\x16GetLoginDetailsRequest\"\x8b\x01\n\x17GetLoginDetailsResponse\x12\x12\n\nauthn_type\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65vice_code\x18\x02 \x01(\t\x12!\n\x19verification_uri_complete\x18\x03 \x01(\t\x12\x12\n\nexpires_in\x18\x04 \x01(\x03\x12\x10\n\x08interval\x18\x05 \x01(\x03\"+\n\x14GetAuthTokensRequest\x12\x13\n\x0b\x64\x65vice_code\x18\x01 \x01(\t\"D\n\x15GetAuthTokensResponse\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\" \n\x0eStopRunRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"\"\n\x0fStopRunResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"&\n\x14PullArtifactsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"1\n\x15PullArtifactsResponse\x12\x10\n\x03url\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x06\n\x04_url\"*\n\x14\x43reateNodeCliRequest\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\"9\n\x15\x43reateNodeCliResponse\x12\x14\n\x07node_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\n\n\x08_node_id\"\'\n\x14\x44\x65leteNodeCliRequest\x12\x0f\n\x07node_id\x18\x01 \x01(\x04\"\x17\n\x15\x44\x65leteNodeCliResponse\"&\n\x13ListNodesCliRequest\x12\x0f\n\x07\x64ry_run\x18\x01 \x01(\x08\"M\n\x14ListNodesCliResponse\x12(\n\nnodes_info\x18\x01 \x03(\x0b\x32\x14.flwr.proto.NodeInfo\x12\x0b\n\x03now\x18\x02 \x01(\t2\xc5\x06\n\x07\x43ontrol\x12G\n\x08StartRun\x12\x1b.flwr.proto.StartRunRequest\x1a\x1c.flwr.proto.StartRunResponse\"\x00\x12\x44\n\x07StopRun\x12\x1a.flwr.proto.StopRunRequest\x1a\x1b.flwr.proto.StopRunResponse\"\x00\x12O\n\nStreamLogs\x12\x1d.flwr.proto.StreamLogsRequest\x1a\x1e.flwr.proto.StreamLogsResponse\"\x00\x30\x01\x12G\n\x08ListRuns\x12\x1b.flwr.proto.ListRunsRequest\x1a\x1c.flwr.proto.ListRunsResponse\"\x00\x12\\\n\x0fGetLoginDetails\x12\".flwr.proto.GetLoginDetailsRequest\x1a#.flwr.proto.GetLoginDetailsResponse\"\x00\x12V\n\rGetAuthTokens\x12 .flwr.proto.GetAuthTokensRequest\x1a!.flwr.proto.GetAuthTokensResponse\"\x00\x12V\n\rPullArtifacts\x12 .flwr.proto.PullArtifactsRequest\x1a!.flwr.proto.PullArtifactsResponse\"\x00\x12V\n\rCreateNodeCli\x12 .flwr.proto.CreateNodeCliRequest\x1a!.flwr.proto.CreateNodeCliResponse\"\x00\x12V\n\rDeleteNodeCli\x12 .flwr.proto.DeleteNodeCliRequest\x1a!.flwr.proto.DeleteNodeCliResponse\"\x00\x12S\n\x0cListNodesCli\x12\x1f.flwr.proto.ListNodesCliRequest\x1a .flwr.proto.ListNodesCliResponse\"\x00\x62\x06proto3')
22
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x66lwr/proto/control.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1b\x66lwr/proto/recorddict.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x15\x66lwr/proto/node.proto\"\xfa\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\x34\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x18.flwr.proto.ConfigRecord\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\"2\n\x10StartRunResponse\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"<\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\"1\n\x0fListRunsRequest\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"\x9d\x01\n\x10ListRunsResponse\x12;\n\x08run_dict\x18\x01 \x03(\x0b\x32).flwr.proto.ListRunsResponse.RunDictEntry\x12\x0b\n\x03now\x18\x02 \x01(\t\x1a?\n\x0cRunDictEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\x1e\n\x05value\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run:\x02\x38\x01\"\x18\n\x16GetLoginDetailsRequest\"\x8b\x01\n\x17GetLoginDetailsResponse\x12\x12\n\nauthn_type\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65vice_code\x18\x02 \x01(\t\x12!\n\x19verification_uri_complete\x18\x03 \x01(\t\x12\x12\n\nexpires_in\x18\x04 \x01(\x03\x12\x10\n\x08interval\x18\x05 \x01(\x03\"+\n\x14GetAuthTokensRequest\x12\x13\n\x0b\x64\x65vice_code\x18\x01 \x01(\t\"D\n\x15GetAuthTokensResponse\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\" \n\x0eStopRunRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"\"\n\x0fStopRunResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"&\n\x14PullArtifactsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"1\n\x15PullArtifactsResponse\x12\x10\n\x03url\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x06\n\x04_url\")\n\x13RegisterNodeRequest\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\"8\n\x14RegisterNodeResponse\x12\x14\n\x07node_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\n\n\x08_node_id\"(\n\x15UnregisterNodeRequest\x12\x0f\n\x07node_id\x18\x01 \x01(\x04\"\x18\n\x16UnregisterNodeResponse\"\x12\n\x10ListNodesRequest\"J\n\x11ListNodesResponse\x12(\n\nnodes_info\x18\x01 \x03(\x0b\x32\x14.flwr.proto.NodeInfo\x12\x0b\n\x03now\x18\x02 \x01(\t2\xbc\x06\n\x07\x43ontrol\x12G\n\x08StartRun\x12\x1b.flwr.proto.StartRunRequest\x1a\x1c.flwr.proto.StartRunResponse\"\x00\x12\x44\n\x07StopRun\x12\x1a.flwr.proto.StopRunRequest\x1a\x1b.flwr.proto.StopRunResponse\"\x00\x12O\n\nStreamLogs\x12\x1d.flwr.proto.StreamLogsRequest\x1a\x1e.flwr.proto.StreamLogsResponse\"\x00\x30\x01\x12G\n\x08ListRuns\x12\x1b.flwr.proto.ListRunsRequest\x1a\x1c.flwr.proto.ListRunsResponse\"\x00\x12\\\n\x0fGetLoginDetails\x12\".flwr.proto.GetLoginDetailsRequest\x1a#.flwr.proto.GetLoginDetailsResponse\"\x00\x12V\n\rGetAuthTokens\x12 .flwr.proto.GetAuthTokensRequest\x1a!.flwr.proto.GetAuthTokensResponse\"\x00\x12V\n\rPullArtifacts\x12 .flwr.proto.PullArtifactsRequest\x1a!.flwr.proto.PullArtifactsResponse\"\x00\x12S\n\x0cRegisterNode\x12\x1f.flwr.proto.RegisterNodeRequest\x1a .flwr.proto.RegisterNodeResponse\"\x00\x12Y\n\x0eUnregisterNode\x12!.flwr.proto.UnregisterNodeRequest\x1a\".flwr.proto.UnregisterNodeResponse\"\x00\x12J\n\tListNodes\x12\x1c.flwr.proto.ListNodesRequest\x1a\x1d.flwr.proto.ListNodesResponse\"\x00\x62\x06proto3')
23
23
 
24
24
  _globals = globals()
25
25
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -62,18 +62,18 @@ if _descriptor._USE_C_DESCRIPTORS == False:
62
62
  _globals['_PULLARTIFACTSREQUEST']._serialized_end=1201
63
63
  _globals['_PULLARTIFACTSRESPONSE']._serialized_start=1203
64
64
  _globals['_PULLARTIFACTSRESPONSE']._serialized_end=1252
65
- _globals['_CREATENODECLIREQUEST']._serialized_start=1254
66
- _globals['_CREATENODECLIREQUEST']._serialized_end=1296
67
- _globals['_CREATENODECLIRESPONSE']._serialized_start=1298
68
- _globals['_CREATENODECLIRESPONSE']._serialized_end=1355
69
- _globals['_DELETENODECLIREQUEST']._serialized_start=1357
70
- _globals['_DELETENODECLIREQUEST']._serialized_end=1396
71
- _globals['_DELETENODECLIRESPONSE']._serialized_start=1398
72
- _globals['_DELETENODECLIRESPONSE']._serialized_end=1421
73
- _globals['_LISTNODESCLIREQUEST']._serialized_start=1423
74
- _globals['_LISTNODESCLIREQUEST']._serialized_end=1461
75
- _globals['_LISTNODESCLIRESPONSE']._serialized_start=1463
76
- _globals['_LISTNODESCLIRESPONSE']._serialized_end=1540
77
- _globals['_CONTROL']._serialized_start=1543
78
- _globals['_CONTROL']._serialized_end=2380
65
+ _globals['_REGISTERNODEREQUEST']._serialized_start=1254
66
+ _globals['_REGISTERNODEREQUEST']._serialized_end=1295
67
+ _globals['_REGISTERNODERESPONSE']._serialized_start=1297
68
+ _globals['_REGISTERNODERESPONSE']._serialized_end=1353
69
+ _globals['_UNREGISTERNODEREQUEST']._serialized_start=1355
70
+ _globals['_UNREGISTERNODEREQUEST']._serialized_end=1395
71
+ _globals['_UNREGISTERNODERESPONSE']._serialized_start=1397
72
+ _globals['_UNREGISTERNODERESPONSE']._serialized_end=1421
73
+ _globals['_LISTNODESREQUEST']._serialized_start=1423
74
+ _globals['_LISTNODESREQUEST']._serialized_end=1441
75
+ _globals['_LISTNODESRESPONSE']._serialized_start=1443
76
+ _globals['_LISTNODESRESPONSE']._serialized_end=1517
77
+ _globals['_CONTROL']._serialized_start=1520
78
+ _globals['_CONTROL']._serialized_end=2348
79
79
  # @@protoc_insertion_point(module_scope)
@@ -236,7 +236,7 @@ class PullArtifactsResponse(google.protobuf.message.Message):
236
236
  def WhichOneof(self, oneof_group: typing_extensions.Literal["_url",b"_url"]) -> typing.Optional[typing_extensions.Literal["url"]]: ...
237
237
  global___PullArtifactsResponse = PullArtifactsResponse
238
238
 
239
- class CreateNodeCliRequest(google.protobuf.message.Message):
239
+ class RegisterNodeRequest(google.protobuf.message.Message):
240
240
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
241
241
  PUBLIC_KEY_FIELD_NUMBER: builtins.int
242
242
  public_key: builtins.bytes
@@ -245,9 +245,9 @@ class CreateNodeCliRequest(google.protobuf.message.Message):
245
245
  public_key: builtins.bytes = ...,
246
246
  ) -> None: ...
247
247
  def ClearField(self, field_name: typing_extensions.Literal["public_key",b"public_key"]) -> None: ...
248
- global___CreateNodeCliRequest = CreateNodeCliRequest
248
+ global___RegisterNodeRequest = RegisterNodeRequest
249
249
 
250
- class CreateNodeCliResponse(google.protobuf.message.Message):
250
+ class RegisterNodeResponse(google.protobuf.message.Message):
251
251
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
252
252
  NODE_ID_FIELD_NUMBER: builtins.int
253
253
  node_id: builtins.int
@@ -258,9 +258,9 @@ class CreateNodeCliResponse(google.protobuf.message.Message):
258
258
  def HasField(self, field_name: typing_extensions.Literal["_node_id",b"_node_id","node_id",b"node_id"]) -> builtins.bool: ...
259
259
  def ClearField(self, field_name: typing_extensions.Literal["_node_id",b"_node_id","node_id",b"node_id"]) -> None: ...
260
260
  def WhichOneof(self, oneof_group: typing_extensions.Literal["_node_id",b"_node_id"]) -> typing.Optional[typing_extensions.Literal["node_id"]]: ...
261
- global___CreateNodeCliResponse = CreateNodeCliResponse
261
+ global___RegisterNodeResponse = RegisterNodeResponse
262
262
 
263
- class DeleteNodeCliRequest(google.protobuf.message.Message):
263
+ class UnregisterNodeRequest(google.protobuf.message.Message):
264
264
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
265
265
  NODE_ID_FIELD_NUMBER: builtins.int
266
266
  node_id: builtins.int
@@ -269,26 +269,21 @@ class DeleteNodeCliRequest(google.protobuf.message.Message):
269
269
  node_id: builtins.int = ...,
270
270
  ) -> None: ...
271
271
  def ClearField(self, field_name: typing_extensions.Literal["node_id",b"node_id"]) -> None: ...
272
- global___DeleteNodeCliRequest = DeleteNodeCliRequest
272
+ global___UnregisterNodeRequest = UnregisterNodeRequest
273
273
 
274
- class DeleteNodeCliResponse(google.protobuf.message.Message):
274
+ class UnregisterNodeResponse(google.protobuf.message.Message):
275
275
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
276
276
  def __init__(self,
277
277
  ) -> None: ...
278
- global___DeleteNodeCliResponse = DeleteNodeCliResponse
278
+ global___UnregisterNodeResponse = UnregisterNodeResponse
279
279
 
280
- class ListNodesCliRequest(google.protobuf.message.Message):
280
+ class ListNodesRequest(google.protobuf.message.Message):
281
281
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
282
- DRY_RUN_FIELD_NUMBER: builtins.int
283
- dry_run: builtins.bool
284
282
  def __init__(self,
285
- *,
286
- dry_run: builtins.bool = ...,
287
283
  ) -> None: ...
288
- def ClearField(self, field_name: typing_extensions.Literal["dry_run",b"dry_run"]) -> None: ...
289
- global___ListNodesCliRequest = ListNodesCliRequest
284
+ global___ListNodesRequest = ListNodesRequest
290
285
 
291
- class ListNodesCliResponse(google.protobuf.message.Message):
286
+ class ListNodesResponse(google.protobuf.message.Message):
292
287
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
293
288
  NODES_INFO_FIELD_NUMBER: builtins.int
294
289
  NOW_FIELD_NUMBER: builtins.int
@@ -301,4 +296,4 @@ class ListNodesCliResponse(google.protobuf.message.Message):
301
296
  now: typing.Text = ...,
302
297
  ) -> None: ...
303
298
  def ClearField(self, field_name: typing_extensions.Literal["nodes_info",b"nodes_info","now",b"now"]) -> None: ...
304
- global___ListNodesCliResponse = ListNodesCliResponse
299
+ global___ListNodesResponse = ListNodesResponse