-
Notifications
You must be signed in to change notification settings - Fork 942
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(framework) Add proto files for SuperExec service
- Loading branch information
1 parent
c16cd75
commit 912d9e7
Showing
6 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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; | ||
|
||
service Exec { | ||
// Start run upon request | ||
rpc StartRun(StartRunRequest) returns (StartRunResponse) {} | ||
} | ||
|
||
message StartRunRequest { bytes fab_file = 1; } | ||
message StartRunResponse { sint64 run_id = 1; } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
@generated by mypy-protobuf. Do not edit manually! | ||
isort:skip_file | ||
""" | ||
import builtins | ||
import google.protobuf.descriptor | ||
import google.protobuf.message | ||
import typing_extensions | ||
|
||
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor | ||
|
||
class StartRunRequest(google.protobuf.message.Message): | ||
DESCRIPTOR: google.protobuf.descriptor.Descriptor | ||
FAB_FILE_FIELD_NUMBER: builtins.int | ||
fab_file: builtins.bytes | ||
def __init__(self, | ||
*, | ||
fab_file: builtins.bytes = ..., | ||
) -> None: ... | ||
def ClearField(self, field_name: typing_extensions.Literal["fab_file",b"fab_file"]) -> None: ... | ||
global___StartRunRequest = StartRunRequest | ||
|
||
class StartRunResponse(google.protobuf.message.Message): | ||
DESCRIPTOR: google.protobuf.descriptor.Descriptor | ||
RUN_ID_FIELD_NUMBER: builtins.int | ||
run_id: builtins.int | ||
def __init__(self, | ||
*, | ||
run_id: builtins.int = ..., | ||
) -> None: ... | ||
def ClearField(self, field_name: typing_extensions.Literal["run_id",b"run_id"]) -> None: ... | ||
global___StartRunResponse = StartRunResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# 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 exec_pb2 as flwr_dot_proto_dot_exec__pb2 | ||
|
||
|
||
class ExecStub(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def __init__(self, channel): | ||
"""Constructor. | ||
Args: | ||
channel: A grpc.Channel. | ||
""" | ||
self.StartRun = channel.unary_unary( | ||
'/flwr.proto.Exec/StartRun', | ||
request_serializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.SerializeToString, | ||
response_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.FromString, | ||
) | ||
|
||
|
||
class ExecServicer(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def StartRun(self, request, context): | ||
"""Start run upon request | ||
""" | ||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) | ||
context.set_details('Method not implemented!') | ||
raise NotImplementedError('Method not implemented!') | ||
|
||
|
||
def add_ExecServicer_to_server(servicer, server): | ||
rpc_method_handlers = { | ||
'StartRun': grpc.unary_unary_rpc_method_handler( | ||
servicer.StartRun, | ||
request_deserializer=flwr_dot_proto_dot_exec__pb2.StartRunRequest.FromString, | ||
response_serializer=flwr_dot_proto_dot_exec__pb2.StartRunResponse.SerializeToString, | ||
), | ||
} | ||
generic_handler = grpc.method_handlers_generic_handler( | ||
'flwr.proto.Exec', rpc_method_handlers) | ||
server.add_generic_rpc_handlers((generic_handler,)) | ||
|
||
|
||
# This class is part of an EXPERIMENTAL API. | ||
class Exec(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
@staticmethod | ||
def StartRun(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.Exec/StartRun', | ||
flwr_dot_proto_dot_exec__pb2.StartRunRequest.SerializeToString, | ||
flwr_dot_proto_dot_exec__pb2.StartRunResponse.FromString, | ||
options, channel_credentials, | ||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
@generated by mypy-protobuf. Do not edit manually! | ||
isort:skip_file | ||
""" | ||
import abc | ||
import flwr.proto.exec_pb2 | ||
import grpc | ||
|
||
class ExecStub: | ||
def __init__(self, channel: grpc.Channel) -> None: ... | ||
StartRun: grpc.UnaryUnaryMultiCallable[ | ||
flwr.proto.exec_pb2.StartRunRequest, | ||
flwr.proto.exec_pb2.StartRunResponse] | ||
"""Start run upon request""" | ||
|
||
|
||
class ExecServicer(metaclass=abc.ABCMeta): | ||
@abc.abstractmethod | ||
def StartRun(self, | ||
request: flwr.proto.exec_pb2.StartRunRequest, | ||
context: grpc.ServicerContext, | ||
) -> flwr.proto.exec_pb2.StartRunResponse: | ||
"""Start run upon request""" | ||
pass | ||
|
||
|
||
def add_ExecServicer_to_server(servicer: ExecServicer, server: grpc.Server) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters