flwr-nightly 1.14.0.dev20241204__py3-none-any.whl → 1.14.0.dev20241207__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/proto/exec_pb2.py CHANGED
@@ -18,7 +18,7 @@ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
18
18
  from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
19
19
 
20
20
 
21
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x14\x66lwr/proto/run.proto\"\xfb\x01\n\x0fStartRunRequest\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fab\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\x12\x35\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecord\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"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\x32\xe9\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\x12G\n\x08ListRuns\x12\x1b.flwr.proto.ListRunsRequest\x1a\x1c.flwr.proto.ListRunsResponse\"\x00\x62\x06proto3')
21
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x14\x66lwr/proto/run.proto\"\xfb\x01\n\x0fStartRunRequest\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fab\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\x12\x35\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecord\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"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\" \n\x0eStopRunRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"\"\n\x0fStopRunResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x32\xaf\x02\n\x04\x45xec\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\x62\x06proto3')
22
22
 
23
23
  _globals = globals()
24
24
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -45,6 +45,10 @@ if _descriptor._USE_C_DESCRIPTORS == False:
45
45
  _globals['_LISTRUNSRESPONSE']._serialized_end=782
46
46
  _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._serialized_start=719
47
47
  _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._serialized_end=782
48
- _globals['_EXEC']._serialized_start=785
49
- _globals['_EXEC']._serialized_end=1018
48
+ _globals['_STOPRUNREQUEST']._serialized_start=784
49
+ _globals['_STOPRUNREQUEST']._serialized_end=816
50
+ _globals['_STOPRUNRESPONSE']._serialized_start=818
51
+ _globals['_STOPRUNRESPONSE']._serialized_end=852
52
+ _globals['_EXEC']._serialized_start=855
53
+ _globals['_EXEC']._serialized_end=1158
50
54
  # @@protoc_insertion_point(module_scope)
flwr/proto/exec_pb2.pyi CHANGED
@@ -134,3 +134,25 @@ class ListRunsResponse(google.protobuf.message.Message):
134
134
  ) -> None: ...
135
135
  def ClearField(self, field_name: typing_extensions.Literal["now",b"now","run_dict",b"run_dict"]) -> None: ...
136
136
  global___ListRunsResponse = ListRunsResponse
137
+
138
+ class StopRunRequest(google.protobuf.message.Message):
139
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
140
+ RUN_ID_FIELD_NUMBER: builtins.int
141
+ run_id: builtins.int
142
+ def __init__(self,
143
+ *,
144
+ run_id: builtins.int = ...,
145
+ ) -> None: ...
146
+ def ClearField(self, field_name: typing_extensions.Literal["run_id",b"run_id"]) -> None: ...
147
+ global___StopRunRequest = StopRunRequest
148
+
149
+ class StopRunResponse(google.protobuf.message.Message):
150
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
151
+ SUCCESS_FIELD_NUMBER: builtins.int
152
+ success: builtins.bool
153
+ def __init__(self,
154
+ *,
155
+ success: builtins.bool = ...,
156
+ ) -> None: ...
157
+ def ClearField(self, field_name: typing_extensions.Literal["success",b"success"]) -> None: ...
158
+ global___StopRunResponse = StopRunResponse
@@ -19,6 +19,11 @@ class ExecStub(object):
19
19
  request_serializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.SerializeToString,
20
20
  response_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.FromString,
21
21
  )
22
+ self.StopRun = channel.unary_unary(
23
+ '/flwr.proto.Exec/StopRun',
24
+ request_serializer=flwr_dot_proto_dot_exec__pb2.StopRunRequest.SerializeToString,
25
+ response_deserializer=flwr_dot_proto_dot_exec__pb2.StopRunResponse.FromString,
26
+ )
22
27
  self.StreamLogs = channel.unary_stream(
23
28
  '/flwr.proto.Exec/StreamLogs',
24
29
  request_serializer=flwr_dot_proto_dot_exec__pb2.StreamLogsRequest.SerializeToString,
@@ -41,6 +46,13 @@ class ExecServicer(object):
41
46
  context.set_details('Method not implemented!')
42
47
  raise NotImplementedError('Method not implemented!')
43
48
 
49
+ def StopRun(self, request, context):
50
+ """Stop run upon request
51
+ """
52
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
53
+ context.set_details('Method not implemented!')
54
+ raise NotImplementedError('Method not implemented!')
55
+
44
56
  def StreamLogs(self, request, context):
45
57
  """Start log stream upon request
46
58
  """
@@ -63,6 +75,11 @@ def add_ExecServicer_to_server(servicer, server):
63
75
  request_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.FromString,
64
76
  response_serializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.SerializeToString,
65
77
  ),
78
+ 'StopRun': grpc.unary_unary_rpc_method_handler(
79
+ servicer.StopRun,
80
+ request_deserializer=flwr_dot_proto_dot_exec__pb2.StopRunRequest.FromString,
81
+ response_serializer=flwr_dot_proto_dot_exec__pb2.StopRunResponse.SerializeToString,
82
+ ),
66
83
  'StreamLogs': grpc.unary_stream_rpc_method_handler(
67
84
  servicer.StreamLogs,
68
85
  request_deserializer=flwr_dot_proto_dot_exec__pb2.StreamLogsRequest.FromString,
@@ -100,6 +117,23 @@ class Exec(object):
100
117
  options, channel_credentials,
101
118
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
102
119
 
120
+ @staticmethod
121
+ def StopRun(request,
122
+ target,
123
+ options=(),
124
+ channel_credentials=None,
125
+ call_credentials=None,
126
+ insecure=False,
127
+ compression=None,
128
+ wait_for_ready=None,
129
+ timeout=None,
130
+ metadata=None):
131
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.Exec/StopRun',
132
+ flwr_dot_proto_dot_exec__pb2.StopRunRequest.SerializeToString,
133
+ flwr_dot_proto_dot_exec__pb2.StopRunResponse.FromString,
134
+ options, channel_credentials,
135
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
136
+
103
137
  @staticmethod
104
138
  def StreamLogs(request,
105
139
  target,
@@ -14,6 +14,11 @@ class ExecStub:
14
14
  flwr.proto.exec_pb2.StartRunResponse]
15
15
  """Start run upon request"""
16
16
 
17
+ StopRun: grpc.UnaryUnaryMultiCallable[
18
+ flwr.proto.exec_pb2.StopRunRequest,
19
+ flwr.proto.exec_pb2.StopRunResponse]
20
+ """Stop run upon request"""
21
+
17
22
  StreamLogs: grpc.UnaryStreamMultiCallable[
18
23
  flwr.proto.exec_pb2.StreamLogsRequest,
19
24
  flwr.proto.exec_pb2.StreamLogsResponse]
@@ -34,6 +39,14 @@ class ExecServicer(metaclass=abc.ABCMeta):
34
39
  """Start run upon request"""
35
40
  pass
36
41
 
42
+ @abc.abstractmethod
43
+ def StopRun(self,
44
+ request: flwr.proto.exec_pb2.StopRunRequest,
45
+ context: grpc.ServicerContext,
46
+ ) -> flwr.proto.exec_pb2.StopRunResponse:
47
+ """Stop run upon request"""
48
+ pass
49
+
37
50
  @abc.abstractmethod
38
51
  def StreamLogs(self,
39
52
  request: flwr.proto.exec_pb2.StreamLogsRequest,
@@ -23,19 +23,22 @@ from typing import Any
23
23
  import grpc
24
24
 
25
25
  from flwr.common import now
26
- from flwr.common.constant import LOG_STREAM_INTERVAL, Status
26
+ from flwr.common.constant import LOG_STREAM_INTERVAL, Status, SubStatus
27
27
  from flwr.common.logger import log
28
28
  from flwr.common.serde import (
29
29
  configs_record_from_proto,
30
30
  run_to_proto,
31
31
  user_config_from_proto,
32
32
  )
33
+ from flwr.common.typing import RunStatus
33
34
  from flwr.proto import exec_pb2_grpc # pylint: disable=E0611
34
35
  from flwr.proto.exec_pb2 import ( # pylint: disable=E0611
35
36
  ListRunsRequest,
36
37
  ListRunsResponse,
37
38
  StartRunRequest,
38
39
  StartRunResponse,
40
+ StopRunRequest,
41
+ StopRunResponse,
39
42
  StreamLogsRequest,
40
43
  StreamLogsResponse,
41
44
  )
@@ -126,6 +129,32 @@ class ExecServicer(exec_pb2_grpc.ExecServicer):
126
129
  # Handle `flwr ls --run-id <run_id>`
127
130
  return _create_list_runs_response({request.run_id}, state)
128
131
 
132
+ def StopRun(
133
+ self, request: StopRunRequest, context: grpc.ServicerContext
134
+ ) -> StopRunResponse:
135
+ """Stop a given run ID."""
136
+ log(INFO, "ExecServicer.StopRun")
137
+ state = self.linkstate_factory.state()
138
+
139
+ # Exit if `run_id` not found
140
+ if not state.get_run(request.run_id):
141
+ context.abort(
142
+ grpc.StatusCode.NOT_FOUND, f"Run ID {request.run_id} not found"
143
+ )
144
+
145
+ run_status = state.get_run_status({request.run_id})[request.run_id]
146
+ if run_status.status == Status.FINISHED:
147
+ context.abort(
148
+ grpc.StatusCode.FAILED_PRECONDITION,
149
+ f"Run ID {request.run_id} is already finished",
150
+ )
151
+
152
+ update_success = state.update_run_status(
153
+ run_id=request.run_id,
154
+ new_status=RunStatus(Status.FINISHED, SubStatus.STOPPED, ""),
155
+ )
156
+ return StopRunResponse(success=update_success)
157
+
129
158
 
130
159
  def _create_list_runs_response(run_ids: set[int], state: LinkState) -> ListRunsResponse:
131
160
  """Create response for `flwr ls --runs` and `flwr ls --run-id <run_id>`."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.14.0.dev20241204
3
+ Version: 1.14.0.dev20241207
4
4
  Summary: Flower: A Friendly Federated AI Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -151,10 +151,10 @@ flwr/proto/error_pb2.py,sha256=LarjKL90LbwkXKlhzNrDssgl4DXcvIPve8NVCXHpsKA,1084
151
151
  flwr/proto/error_pb2.pyi,sha256=ZNH4HhJTU_KfMXlyCeg8FwU-fcUYxTqEmoJPtWtHikc,734
152
152
  flwr/proto/error_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
153
153
  flwr/proto/error_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
154
- flwr/proto/exec_pb2.py,sha256=BubvZLm2_IA9ziNdEc4zUj27r9u7jP20w1P8dzEaE1Q,4057
155
- flwr/proto/exec_pb2.pyi,sha256=r-GGeFEsmc9I838U2CUWpXQEmkLiVKhxGZMmb067PUA,6327
156
- flwr/proto/exec_pb2_grpc.py,sha256=kPXb_vp2Swl-1nkQEHJaqXKXi9P8pauBFemboGFgI9Q,5621
157
- flwr/proto/exec_pb2_grpc.pyi,sha256=qnefAjYPdWs-yYTPIfsbecoKWbVKjp6IFZHwN82ZGUo,1601
154
+ flwr/proto/exec_pb2.py,sha256=dSxDJm2rRXw7zhV6MTrJJyU51oqMNWDm0JUzVvD86BI,4484
155
+ flwr/proto/exec_pb2.pyi,sha256=xWfRQHFOLAxPqLkAaecihNK5_zlAfqE0NUJuSjPViXw,7145
156
+ flwr/proto/exec_pb2_grpc.py,sha256=z_9Hw-VapmkyfNlAOyvy2xJel1jo6P2oZgduOxnHPeE,7163
157
+ flwr/proto/exec_pb2_grpc.pyi,sha256=VDsnz9vJeweJdKCNyygDqSDfyR6LoHA4mwWViF2f7AI,2000
158
158
  flwr/proto/fab_pb2.py,sha256=3QSDq9pjbZoqVxsmCRDwHO5PrSjzn2vixjYxE-qPmb0,1589
159
159
  flwr/proto/fab_pb2.pyi,sha256=fXI108QaFtbl1WWTyslPbIx9c_19D0aYCoFn0xYtL4U,2277
160
160
  flwr/proto/fab_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
@@ -310,11 +310,11 @@ flwr/superexec/__init__.py,sha256=fcj366jh4RFby_vDwLroU4kepzqbnJgseZD_jUr_Mko,71
310
310
  flwr/superexec/app.py,sha256=Tt3GonnTwHrMmicwx9XaP-crP78-bf4DUWl-N5cG6zY,1841
311
311
  flwr/superexec/deployment.py,sha256=7VYmmI12zEaTHp_cQtU1GLikmqhctUHhEdshBPRFHMs,6734
312
312
  flwr/superexec/exec_grpc.py,sha256=OuhBAk7hiky9rjGceinLGIXqchtzGPQThZnwyYv6Ei0,2241
313
- flwr/superexec/exec_servicer.py,sha256=M3R3q5rg2kYz-gFN-nmiXkvjels4QbieEA0K5wks0kQ,4972
313
+ flwr/superexec/exec_servicer.py,sha256=qHWbGRuP702-JxlxFuztGlRdRoNET8G-0m1xwnoZgig,6016
314
314
  flwr/superexec/executor.py,sha256=zH3_53il6Jh0ZscIVEB9f4GNnXMeBbCGyCoBCxLgiG0,3114
315
315
  flwr/superexec/simulation.py,sha256=WQDon15oqpMopAZnwRZoTICYCfHqtkvFSqiTQ2hLD_g,4088
316
- flwr_nightly-1.14.0.dev20241204.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
317
- flwr_nightly-1.14.0.dev20241204.dist-info/METADATA,sha256=JKj9ml38e8ierd6xHKY74h2jSsjXJ49CqYyoRCkdbPQ,15679
318
- flwr_nightly-1.14.0.dev20241204.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
319
- flwr_nightly-1.14.0.dev20241204.dist-info/entry_points.txt,sha256=JlNxX3qhaV18_2yj5a3kJW1ESxm31cal9iS_N_pf1Rk,538
320
- flwr_nightly-1.14.0.dev20241204.dist-info/RECORD,,
316
+ flwr_nightly-1.14.0.dev20241207.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
317
+ flwr_nightly-1.14.0.dev20241207.dist-info/METADATA,sha256=5QsxHSr8typyN39O_YyHaD3g5t7viGIA7rxbethV6iU,15679
318
+ flwr_nightly-1.14.0.dev20241207.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
319
+ flwr_nightly-1.14.0.dev20241207.dist-info/entry_points.txt,sha256=JlNxX3qhaV18_2yj5a3kJW1ESxm31cal9iS_N_pf1Rk,538
320
+ flwr_nightly-1.14.0.dev20241207.dist-info/RECORD,,