flwr-nightly 1.9.0.dev20240608__py3-none-any.whl → 1.10.0.dev20240610__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.

@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "flwr-datasets>=0.0.2,<1.0.0",
16
16
  "torch==2.2.1",
17
17
  "transformers>=4.30.0,<5.0"
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = {text = "Apache License (2.0)"}
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "jax==0.4.26",
16
16
  "jaxlib==0.4.26",
17
17
  "scikit-learn==1.4.2",
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "flwr-datasets[vision]>=0.0.2,<1.0.0",
16
16
  "mlx==0.10.0",
17
17
  "numpy==1.24.4",
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "numpy>=1.21.0",
16
16
  ]
17
17
 
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "flwr-datasets[vision]>=0.0.2,<1.0.0",
16
16
  "torch==2.2.1",
17
17
  "torchvision==0.17.1",
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "flwr-datasets[vision]>=0.0.2,<1.0.0",
16
16
  "scikit-learn>=1.1.1",
17
17
  ]
@@ -11,7 +11,7 @@ authors = [
11
11
  ]
12
12
  license = { text = "Apache License (2.0)" }
13
13
  dependencies = [
14
- "flwr[simulation]>=1.8.0,<2.0",
14
+ "flwr[simulation]>=1.9.0,<2.0",
15
15
  "flwr-datasets[vision]>=0.0.2,<1.0.0",
16
16
  "tensorflow>=2.11.1",
17
17
  ]
flwr/client/app.py CHANGED
@@ -265,9 +265,10 @@ def _start_client_internal(
265
265
  transport, server_address
266
266
  )
267
267
 
268
- run_tracker = _RunTracker()
268
+ app_state_tracker = _AppStateTracker()
269
269
 
270
270
  def _on_sucess(retry_state: RetryState) -> None:
271
+ app_state_tracker.is_connected = True
271
272
  if retry_state.tries > 1:
272
273
  log(
273
274
  INFO,
@@ -275,10 +276,9 @@ def _start_client_internal(
275
276
  retry_state.elapsed_time,
276
277
  retry_state.tries,
277
278
  )
278
- if run_tracker.create_node:
279
- run_tracker.create_node()
280
279
 
281
280
  def _on_backoff(retry_state: RetryState) -> None:
281
+ app_state_tracker.is_connected = False
282
282
  if retry_state.tries == 1:
283
283
  log(WARN, "Connection attempt failed, retrying...")
284
284
  else:
@@ -309,7 +309,7 @@ def _start_client_internal(
309
309
 
310
310
  node_state = NodeState()
311
311
 
312
- while True:
312
+ while not app_state_tracker.interrupt:
313
313
  sleep_duration: int = 0
314
314
  with connection(
315
315
  address,
@@ -326,99 +326,112 @@ def _start_client_internal(
326
326
  if create_node is not None:
327
327
  create_node() # pylint: disable=not-callable
328
328
 
329
- while True:
330
- # Receive
331
- message = receive()
332
- if message is None:
333
- time.sleep(3) # Wait for 3s before asking again
334
- continue
335
-
336
- log(INFO, "")
337
- if len(message.metadata.group_id) > 0:
329
+ app_state_tracker.register_signal_handler()
330
+ while not app_state_tracker.interrupt:
331
+ try:
332
+ # Receive
333
+ message = receive()
334
+ if message is None:
335
+ time.sleep(3) # Wait for 3s before asking again
336
+ continue
337
+
338
+ log(INFO, "")
339
+ if len(message.metadata.group_id) > 0:
340
+ log(
341
+ INFO,
342
+ "[RUN %s, ROUND %s]",
343
+ message.metadata.run_id,
344
+ message.metadata.group_id,
345
+ )
338
346
  log(
339
347
  INFO,
340
- "[RUN %s, ROUND %s]",
341
- message.metadata.run_id,
342
- message.metadata.group_id,
348
+ "Received: %s message %s",
349
+ message.metadata.message_type,
350
+ message.metadata.message_id,
343
351
  )
344
- log(
345
- INFO,
346
- "Received: %s message %s",
347
- message.metadata.message_type,
348
- message.metadata.message_id,
349
- )
350
-
351
- # Handle control message
352
- out_message, sleep_duration = handle_control_message(message)
353
- if out_message:
354
- send(out_message)
355
- break
356
352
 
357
- # Register context for this run
358
- node_state.register_context(run_id=message.metadata.run_id)
353
+ # Handle control message
354
+ out_message, sleep_duration = handle_control_message(message)
355
+ if out_message:
356
+ send(out_message)
357
+ break
359
358
 
360
- # Retrieve context for this run
361
- context = node_state.retrieve_context(run_id=message.metadata.run_id)
362
-
363
- # Create an error reply message that will never be used to prevent
364
- # the used-before-assignment linting error
365
- reply_message = message.create_error_reply(
366
- error=Error(code=ErrorCode.UNKNOWN, reason="Unknown")
367
- )
368
-
369
- # Handle app loading and task message
370
- try:
371
- # Load ClientApp instance
372
- client_app: ClientApp = load_client_app_fn()
373
-
374
- # Execute ClientApp
375
- reply_message = client_app(message=message, context=context)
376
- except Exception as ex: # pylint: disable=broad-exception-caught
377
-
378
- # Legacy grpc-bidi
379
- if transport in ["grpc-bidi", None]:
380
- log(ERROR, "Client raised an exception.", exc_info=ex)
381
- # Raise exception, crash process
382
- raise ex
383
-
384
- # Don't update/change NodeState
385
-
386
- e_code = ErrorCode.CLIENT_APP_RAISED_EXCEPTION
387
- # Reason example: "<class 'ZeroDivisionError'>:<'division by zero'>"
388
- reason = str(type(ex)) + ":<'" + str(ex) + "'>"
389
- exc_entity = "ClientApp"
390
- if isinstance(ex, LoadClientAppError):
391
- reason = (
392
- "An exception was raised when attempting to load "
393
- "`ClientApp`"
394
- )
395
- e_code = ErrorCode.LOAD_CLIENT_APP_EXCEPTION
396
- exc_entity = "SuperNode"
359
+ # Register context for this run
360
+ node_state.register_context(run_id=message.metadata.run_id)
397
361
 
398
- log(ERROR, "%s raised an exception", exc_entity, exc_info=ex)
362
+ # Retrieve context for this run
363
+ context = node_state.retrieve_context(
364
+ run_id=message.metadata.run_id
365
+ )
399
366
 
400
- # Create error message
367
+ # Create an error reply message that will never be used to prevent
368
+ # the used-before-assignment linting error
401
369
  reply_message = message.create_error_reply(
402
- error=Error(code=e_code, reason=reason)
403
- )
404
- else:
405
- # No exception, update node state
406
- node_state.update_context(
407
- run_id=message.metadata.run_id,
408
- context=context,
370
+ error=Error(code=ErrorCode.UNKNOWN, reason="Unknown")
409
371
  )
410
372
 
411
- # Send
412
- send(reply_message)
413
- log(INFO, "Sent reply")
373
+ # Handle app loading and task message
374
+ try:
375
+ # Load ClientApp instance
376
+ client_app: ClientApp = load_client_app_fn()
377
+
378
+ # Execute ClientApp
379
+ reply_message = client_app(message=message, context=context)
380
+ except Exception as ex: # pylint: disable=broad-exception-caught
381
+
382
+ # Legacy grpc-bidi
383
+ if transport in ["grpc-bidi", None]:
384
+ log(ERROR, "Client raised an exception.", exc_info=ex)
385
+ # Raise exception, crash process
386
+ raise ex
387
+
388
+ # Don't update/change NodeState
389
+
390
+ e_code = ErrorCode.CLIENT_APP_RAISED_EXCEPTION
391
+ # Ex fmt: "<class 'ZeroDivisionError'>:<'division by zero'>"
392
+ reason = str(type(ex)) + ":<'" + str(ex) + "'>"
393
+ exc_entity = "ClientApp"
394
+ if isinstance(ex, LoadClientAppError):
395
+ reason = (
396
+ "An exception was raised when attempting to load "
397
+ "`ClientApp`"
398
+ )
399
+ e_code = ErrorCode.LOAD_CLIENT_APP_EXCEPTION
400
+ exc_entity = "SuperNode"
401
+
402
+ if not app_state_tracker.interrupt:
403
+ log(
404
+ ERROR, "%s raised an exception", exc_entity, exc_info=ex
405
+ )
406
+
407
+ # Create error message
408
+ reply_message = message.create_error_reply(
409
+ error=Error(code=e_code, reason=reason)
410
+ )
411
+ else:
412
+ # No exception, update node state
413
+ node_state.update_context(
414
+ run_id=message.metadata.run_id,
415
+ context=context,
416
+ )
417
+
418
+ # Send
419
+ send(reply_message)
420
+ log(INFO, "Sent reply")
421
+
422
+ except StopIteration:
423
+ sleep_duration = 0
424
+ break
414
425
 
415
426
  # Unregister node
416
- if delete_node is not None:
427
+ if delete_node is not None and app_state_tracker.is_connected:
417
428
  delete_node() # pylint: disable=not-callable
418
429
 
419
430
  if sleep_duration == 0:
420
431
  log(INFO, "Disconnect and shut down")
432
+ del app_state_tracker
421
433
  break
434
+
422
435
  # Sleep and reconnect afterwards
423
436
  log(
424
437
  INFO,
@@ -590,9 +603,9 @@ def _init_connection(transport: Optional[str], server_address: str) -> Tuple[
590
603
 
591
604
 
592
605
  @dataclass
593
- class _RunTracker:
594
- create_node: Optional[Callable[[], None]] = None
606
+ class _AppStateTracker:
595
607
  interrupt: bool = False
608
+ is_connected: bool = False
596
609
 
597
610
  def register_signal_handler(self) -> None:
598
611
  """Register handlers for exit signals."""
@@ -193,8 +193,6 @@ def grpc_request_response( # pylint: disable=R0913, R0914, R0915
193
193
 
194
194
  # Stop the ping-loop thread
195
195
  ping_stop_event.set()
196
- if ping_thread is not None:
197
- ping_thread.join()
198
196
 
199
197
  # Call FleetAPI
200
198
  delete_node_request = DeleteNodeRequest(node=node)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.9.0.dev20240608
3
+ Version: 1.10.0.dev20240610
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -31,18 +31,18 @@ flwr/cli/new/templates/app/code/task.jax.py.tpl,sha256=u4o3V019EH79szOw2xzVeC5r9
31
31
  flwr/cli/new/templates/app/code/task.mlx.py.tpl,sha256=y7aVj3F_98-wBnDcbPsCNnFs9BOHTn0y6XIYkByzv7Y,2598
32
32
  flwr/cli/new/templates/app/code/task.pytorch.py.tpl,sha256=NvajdZN-eTyfdqKK0v2MrvWITXw9BjJ3Ri5c1haPJDs,3684
33
33
  flwr/cli/new/templates/app/code/task.tensorflow.py.tpl,sha256=cPOUUS07QbblT9PGFucwu9lY1clRA4-W4DQGA7cpcao,1044
34
- flwr/cli/new/templates/app/pyproject.hf.toml.tpl,sha256=zQz3sUmd-Tpa8QF0UwrAKT13CTxfH-qJ1DtkZN6oKuA,759
35
- flwr/cli/new/templates/app/pyproject.jax.toml.tpl,sha256=o34H5MvQeu4H2nRolbIas9G63mR7nDDL4rqQMlJW6LA,568
36
- flwr/cli/new/templates/app/pyproject.mlx.toml.tpl,sha256=oUtYknyM00vGZSBoxmdJqCeOZahg9mtAQfupgaQPhlI,668
37
- flwr/cli/new/templates/app/pyproject.numpy.toml.tpl,sha256=1cBwKx5eYW6vEcU5gyuVbt2FEFT5fbQ7Lr6t5LGNUuc,606
38
- flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl,sha256=yBlpz7WF8m8bLBYsPdD5J93cn6xv8vLHbLNxP1a1Iwg,675
39
- flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl,sha256=T0MxHVnW1fnMDdz1EqN1JK6jIc3J0ZmznBQwK1eGvkg,655
40
- flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl,sha256=yp4w6LZn2v67AvYRRO9mSm7yfKi14zFYQBl5SbIjEe0,654
34
+ flwr/cli/new/templates/app/pyproject.hf.toml.tpl,sha256=O3-dgH8_knk9uM49IzX06CYC2Ev5xdPuITB40Phvewc,759
35
+ flwr/cli/new/templates/app/pyproject.jax.toml.tpl,sha256=QIhp6_eYYFk9aJd_n-tc_Ar76Se1OP6zSibTbGeHV7w,568
36
+ flwr/cli/new/templates/app/pyproject.mlx.toml.tpl,sha256=OJ15G7CmjevBsUCVJ3ixv01VFwL4nkPcKkVGKeVW8ew,668
37
+ flwr/cli/new/templates/app/pyproject.numpy.toml.tpl,sha256=VYHSqaZzUS8H4jy1Cr1Plyd2kuoNNWoGD3a8UzbOANI,606
38
+ flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl,sha256=wxN6I8uvWZ4MErvTbQJTJOTbY4H_fsYCBXmZURJWLGQ,675
39
+ flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl,sha256=wFeJuhqnBPQtKCBvnE3ySBpxmbeNdxcsq2Eb_RmSDIg,655
40
+ flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl,sha256=zkxLTQRvujF76sIlzNNGPVU7Y9nVCwNBxAx82AOBaJY,654
41
41
  flwr/cli/run/__init__.py,sha256=oCd6HmQDx-sqver1gecgx-uMA38BLTSiiKpl7RGNceg,789
42
42
  flwr/cli/run/run.py,sha256=Oadt7JsJX549JG-2P1UPdF11vnblLWS8uGvuVx0modA,2687
43
43
  flwr/cli/utils.py,sha256=px-M-IlBLu6Ez-Sc9tWhsJRjWurRaZTmxB9ASz8wurk,4119
44
44
  flwr/client/__init__.py,sha256=tcgMyAW8brnmAIk4NmXkonVjYV3lafQJD4vfZ3OJ6kA,1279
45
- flwr/client/app.py,sha256=FjCJ6_ORVeDgfB0NDLg-mBOPvz1eUbZbatPvCaePRrw,23035
45
+ flwr/client/app.py,sha256=QwSlJ7duRor1X7PRqet0rjVD64Nzsw7KKYwfc7vK50Q,23793
46
46
  flwr/client/client.py,sha256=Vp9UkOkoHdNfn6iMYZsj_5m_GICiFfUlKEVaLad-YhM,8183
47
47
  flwr/client/client_app.py,sha256=2jyVTzu8pwDtg66z4FjAa_kPzg31Q8-hx-RkDhguIqw,8635
48
48
  flwr/client/dpfedavg_numpy_client.py,sha256=9Tnig4iml2J88HBKNahegjXjbfvIQyBtaIQaqjbeqsA,7435
@@ -50,7 +50,7 @@ flwr/client/grpc_client/__init__.py,sha256=LsnbqXiJhgQcB0XzAlUQgPx011Uf7Y7yabIC1
50
50
  flwr/client/grpc_client/connection.py,sha256=KWbBwuvn1-2wjrAKteydGCZC_7A2zmEjk3DycQWafrA,8993
51
51
  flwr/client/grpc_rere_client/__init__.py,sha256=avn6W_vHEM_yZEB1S7hCZgnTbXb6ZujqRP_vAzyXu-0,752
52
52
  flwr/client/grpc_rere_client/client_interceptor.py,sha256=rDBXRVo-d-rflxJ6Kw3eDfBmvChdUHkzRw5eP-bpe6Y,4903
53
- flwr/client/grpc_rere_client/connection.py,sha256=e-e6CQmubzmB4n36MtS_u7_T1daNKl5ZltfLATllM-U,9716
53
+ flwr/client/grpc_rere_client/connection.py,sha256=RJxImIWiGem5YFBIpH939GMfY5c_lA4lG2fCp-KYFUU,9649
54
54
  flwr/client/heartbeat.py,sha256=cx37mJBH8LyoIN4Lks85wtqT1mnU5GulQnr4pGCvAq0,2404
55
55
  flwr/client/message_handler/__init__.py,sha256=abHvBRJJiiaAMNgeILQbMOa6h8WqMK2BcnvxwQZFpic,719
56
56
  flwr/client/message_handler/message_handler.py,sha256=ml_FlduAJ5pxO31n1tKRrWfQRSxkMgKLbwXXcRsNSos,6553
@@ -229,8 +229,8 @@ flwr/simulation/ray_transport/ray_actor.py,sha256=_wv2eP7qxkCZ-6rMyYWnjLrGPBZRxj
229
229
  flwr/simulation/ray_transport/ray_client_proxy.py,sha256=oDu4sEPIOu39vrNi-fqDAe10xtNUXMO49bM2RWfRcyw,6738
230
230
  flwr/simulation/ray_transport/utils.py,sha256=TYdtfg1P9VfTdLMOJlifInGpxWHYs9UfUqIv2wfkRLA,2392
231
231
  flwr/simulation/run_simulation.py,sha256=Jmc6DyN5UCY1U1PcDvL04NgYmEQ6ufJ1JisjG5yqfY8,15098
232
- flwr_nightly-1.9.0.dev20240608.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
233
- flwr_nightly-1.9.0.dev20240608.dist-info/METADATA,sha256=3gY0CsNjHke3Kro6kPrXoQBFbkPH4zcuXV4LoGKWV44,15517
234
- flwr_nightly-1.9.0.dev20240608.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
235
- flwr_nightly-1.9.0.dev20240608.dist-info/entry_points.txt,sha256=8JJPfpqMnXz9c5V_FSt07Xwd-wCWbAO3MFUDXQ5ZGsI,378
236
- flwr_nightly-1.9.0.dev20240608.dist-info/RECORD,,
232
+ flwr_nightly-1.10.0.dev20240610.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
233
+ flwr_nightly-1.10.0.dev20240610.dist-info/METADATA,sha256=OZC0j2snVxyAeImtM9_Ql6sXmRhCFy6Cc-e-mE_rZwk,15518
234
+ flwr_nightly-1.10.0.dev20240610.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
235
+ flwr_nightly-1.10.0.dev20240610.dist-info/entry_points.txt,sha256=8JJPfpqMnXz9c5V_FSt07Xwd-wCWbAO3MFUDXQ5ZGsI,378
236
+ flwr_nightly-1.10.0.dev20240610.dist-info/RECORD,,