Skip to content

Commit

Permalink
Merge branch 'main' into db-state-superexec
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Sep 23, 2024
2 parents b8b45d1 + b6babe9 commit f9ebf30
Show file tree
Hide file tree
Showing 20 changed files with 500 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def main(driver: Driver, context: Context) -> None:
strategy = FedAvg(
# Select all available clients
fraction_fit=1.0,
min_fit_clients=5,
# Disable evaluation in demo
fraction_evaluate=(0.0 if is_demo else context.run_config["fraction-evaluate"]),
min_available_clients=5,
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart-mlx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ flwr run . --run-config "num-server-rounds=5 learning-rate=0.05"
### Run with the Deployment Engine

> \[!NOTE\]
> An update to this example will show how to run this Flower project with the Deployment Engine and TLS certificates, or with Docker.
> An update to this example will show how to run this Flower project with the Deployment Engine and TLS certificates.
32 changes: 32 additions & 0 deletions src/proto/flwr/proto/control.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2024 Flower Labs GmbH. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ==============================================================================

syntax = "proto3";

package flwr.proto;

import "flwr/proto/run.proto";

service Control {
// Request to create a new run
rpc CreateRun(CreateRunRequest) returns (CreateRunResponse) {}

// Get the status of a given run
rpc GetRunStatus(GetRunStatusRequest) returns (GetRunStatusResponse) {}

// Update the status of a given run
rpc UpdateRunStatus(UpdateRunStatusRequest)
returns (UpdateRunStatusResponse) {}
}
10 changes: 0 additions & 10 deletions src/proto/flwr/proto/driver.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import "flwr/proto/node.proto";
import "flwr/proto/task.proto";
import "flwr/proto/run.proto";
import "flwr/proto/fab.proto";
import "flwr/proto/transport.proto";

service Driver {
// Request run_id
Expand All @@ -43,15 +42,6 @@ service Driver {
rpc GetFab(GetFabRequest) returns (GetFabResponse) {}
}

// CreateRun
message CreateRunRequest {
string fab_id = 1;
string fab_version = 2;
map<string, Scalar> override_config = 3;
Fab fab = 4;
}
message CreateRunResponse { uint64 run_id = 1; }

// GetNodes messages
message GetNodesRequest { uint64 run_id = 1; }
message GetNodesResponse { repeated Node nodes = 1; }
Expand Down
32 changes: 32 additions & 0 deletions src/proto/flwr/proto/run.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ syntax = "proto3";

package flwr.proto;

import "flwr/proto/fab.proto";
import "flwr/proto/transport.proto";

message Run {
Expand All @@ -26,5 +27,36 @@ message Run {
map<string, Scalar> override_config = 4;
string fab_hash = 5;
}

message RunStatus {
// "starting", "running", "finished"
string status = 1;
// "completed", "failed", "stopped" or "" (non-finished)
string sub_status = 2;
// failure details
string details = 3;
}

// CreateRun
message CreateRunRequest {
string fab_id = 1;
string fab_version = 2;
map<string, Scalar> override_config = 3;
Fab fab = 4;
}
message CreateRunResponse { uint64 run_id = 1; }

// GetRun
message GetRunRequest { uint64 run_id = 1; }
message GetRunResponse { Run run = 1; }

// UpdateRunStatus
message UpdateRunStatusRequest {
uint64 run_id = 1;
RunStatus run_status = 2;
}
message UpdateRunStatusResponse {}

// GetRunStatus
message GetRunStatusRequest { repeated uint64 run_ids = 1; }
message GetRunStatusResponse { map<uint64, RunStatus> run_status_dict = 1; }
27 changes: 27 additions & 0 deletions src/py/flwr/proto/control_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/py/flwr/proto/control_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import google.protobuf.descriptor

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
135 changes: 135 additions & 0 deletions src/py/flwr/proto/control_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2


class ControlStub(object):
"""Missing associated documentation comment in .proto file."""

def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.CreateRun = channel.unary_unary(
'/flwr.proto.Control/CreateRun',
request_serializer=flwr_dot_proto_dot_run__pb2.CreateRunRequest.SerializeToString,
response_deserializer=flwr_dot_proto_dot_run__pb2.CreateRunResponse.FromString,
)
self.GetRunStatus = channel.unary_unary(
'/flwr.proto.Control/GetRunStatus',
request_serializer=flwr_dot_proto_dot_run__pb2.GetRunStatusRequest.SerializeToString,
response_deserializer=flwr_dot_proto_dot_run__pb2.GetRunStatusResponse.FromString,
)
self.UpdateRunStatus = channel.unary_unary(
'/flwr.proto.Control/UpdateRunStatus',
request_serializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusRequest.SerializeToString,
response_deserializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusResponse.FromString,
)


class ControlServicer(object):
"""Missing associated documentation comment in .proto file."""

def CreateRun(self, request, context):
"""Request to create a new run
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def GetRunStatus(self, request, context):
"""Get the status of a given run
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def UpdateRunStatus(self, request, context):
"""Update the status of a given run
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_ControlServicer_to_server(servicer, server):
rpc_method_handlers = {
'CreateRun': grpc.unary_unary_rpc_method_handler(
servicer.CreateRun,
request_deserializer=flwr_dot_proto_dot_run__pb2.CreateRunRequest.FromString,
response_serializer=flwr_dot_proto_dot_run__pb2.CreateRunResponse.SerializeToString,
),
'GetRunStatus': grpc.unary_unary_rpc_method_handler(
servicer.GetRunStatus,
request_deserializer=flwr_dot_proto_dot_run__pb2.GetRunStatusRequest.FromString,
response_serializer=flwr_dot_proto_dot_run__pb2.GetRunStatusResponse.SerializeToString,
),
'UpdateRunStatus': grpc.unary_unary_rpc_method_handler(
servicer.UpdateRunStatus,
request_deserializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusRequest.FromString,
response_serializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'flwr.proto.Control', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class Control(object):
"""Missing associated documentation comment in .proto file."""

@staticmethod
def CreateRun(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/flwr.proto.Control/CreateRun',
flwr_dot_proto_dot_run__pb2.CreateRunRequest.SerializeToString,
flwr_dot_proto_dot_run__pb2.CreateRunResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def GetRunStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/flwr.proto.Control/GetRunStatus',
flwr_dot_proto_dot_run__pb2.GetRunStatusRequest.SerializeToString,
flwr_dot_proto_dot_run__pb2.GetRunStatusResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def UpdateRunStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/flwr.proto.Control/UpdateRunStatus',
flwr_dot_proto_dot_run__pb2.UpdateRunStatusRequest.SerializeToString,
flwr_dot_proto_dot_run__pb2.UpdateRunStatusResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
53 changes: 53 additions & 0 deletions src/py/flwr/proto/control_pb2_grpc.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import abc
import flwr.proto.run_pb2
import grpc

class ControlStub:
def __init__(self, channel: grpc.Channel) -> None: ...
CreateRun: grpc.UnaryUnaryMultiCallable[
flwr.proto.run_pb2.CreateRunRequest,
flwr.proto.run_pb2.CreateRunResponse]
"""Request to create a new run"""

GetRunStatus: grpc.UnaryUnaryMultiCallable[
flwr.proto.run_pb2.GetRunStatusRequest,
flwr.proto.run_pb2.GetRunStatusResponse]
"""Get the status of a given run"""

UpdateRunStatus: grpc.UnaryUnaryMultiCallable[
flwr.proto.run_pb2.UpdateRunStatusRequest,
flwr.proto.run_pb2.UpdateRunStatusResponse]
"""Update the status of a given run"""


class ControlServicer(metaclass=abc.ABCMeta):
@abc.abstractmethod
def CreateRun(self,
request: flwr.proto.run_pb2.CreateRunRequest,
context: grpc.ServicerContext,
) -> flwr.proto.run_pb2.CreateRunResponse:
"""Request to create a new run"""
pass

@abc.abstractmethod
def GetRunStatus(self,
request: flwr.proto.run_pb2.GetRunStatusRequest,
context: grpc.ServicerContext,
) -> flwr.proto.run_pb2.GetRunStatusResponse:
"""Get the status of a given run"""
pass

@abc.abstractmethod
def UpdateRunStatus(self,
request: flwr.proto.run_pb2.UpdateRunStatusRequest,
context: grpc.ServicerContext,
) -> flwr.proto.run_pb2.UpdateRunStatusResponse:
"""Update the status of a given run"""
pass


def add_ControlServicer_to_server(servicer: ControlServicer, server: grpc.Server) -> None: ...
39 changes: 15 additions & 24 deletions src/py/flwr/proto/driver_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f9ebf30

Please sign in to comment.