From b250665f5a63d0c140cb884f2a55e04b900fb1b8 Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Mon, 18 Sep 2023 17:21:30 +0200 Subject: [PATCH] changes related to cpp client --- examples/mnist-keras/requirements.txt | 2 +- fedn/fedn/common/net/grpc/fedn.proto | 3 +- fedn/fedn/common/net/grpc/fedn_pb2.py | 384 ++++-------------- fedn/fedn/common/net/grpc/fedn_pb2_grpc.py | 380 ++++++++--------- fedn/fedn/network/clients/client.py | 13 +- .../combiner/aggregators/aggregatorbase.py | 12 +- .../network/combiner/aggregators/fedavg.py | 5 +- fedn/fedn/network/combiner/modelservice.py | 58 ++- fedn/fedn/network/combiner/server.py | 55 ++- fedn/setup.py | 2 +- 10 files changed, 379 insertions(+), 535 deletions(-) diff --git a/examples/mnist-keras/requirements.txt b/examples/mnist-keras/requirements.txt index 18b9e6e6a..625169b29 100644 --- a/examples/mnist-keras/requirements.txt +++ b/examples/mnist-keras/requirements.txt @@ -1,3 +1,3 @@ -tensorflow==2.9.3 +tensorflow-cpu==2.13.0 fire==0.3.1 docker==6.1.1 \ No newline at end of file diff --git a/fedn/fedn/common/net/grpc/fedn.proto b/fedn/fedn/common/net/grpc/fedn.proto index ff0ee293c..6e979311f 100644 --- a/fedn/fedn/common/net/grpc/fedn.proto +++ b/fedn/fedn/common/net/grpc/fedn.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package grpc; +package fedn; message Response { Client sender = 1; @@ -64,6 +64,7 @@ message ModelUpdate { string correlation_id = 5; string timestamp = 6; string meta = 7; + string config = 8; } message ModelValidationRequest { diff --git a/fedn/fedn/common/net/grpc/fedn_pb2.py b/fedn/fedn/common/net/grpc/fedn_pb2.py index fa4fbb16d..f3469b590 100644 --- a/fedn/fedn/common/net/grpc/fedn_pb2.py +++ b/fedn/fedn/common/net/grpc/fedn_pb2.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: fedn/common/net/grpc/fedn.proto +# source: fedn.proto """Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,312 +13,82 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x66\x65\x64n/common/net/grpc/fedn.proto\x12\x04grpc\":\n\x08Response\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08response\x18\x02 \x01(\t\"\x8c\x02\n\x06Status\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x0e\n\x06status\x18\x02 \x01(\t\x12(\n\tlog_level\x18\x03 \x01(\x0e\x32\x15.grpc.Status.LogLevel\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x1e\n\x04type\x18\x07 \x01(\x0e\x32\x10.grpc.StatusType\x12\r\n\x05\x65xtra\x18\x08 \x01(\t\"B\n\x08LogLevel\x12\x08\n\x04INFO\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x12\t\n\x05\x41UDIT\x10\x04\"\xab\x01\n\x12ModelUpdateRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\"\xaf\x01\n\x0bModelUpdate\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x17\n\x0fmodel_update_id\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\"\xc5\x01\n\x16ModelValidationRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\x12\x14\n\x0cis_inference\x18\x08 \x01(\x08\"\xa8\x01\n\x0fModelValidation\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\"\x89\x01\n\x0cModelRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x12\n\n\x02id\x18\x04 \x01(\t\x12!\n\x06status\x18\x05 \x01(\x0e\x32\x11.grpc.ModelStatus\"]\n\rModelResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\n\n\x02id\x18\x02 \x01(\t\x12!\n\x06status\x18\x03 \x01(\x0e\x32\x11.grpc.ModelStatus\x12\x0f\n\x07message\x18\x04 \x01(\t\"U\n\x15GetGlobalModelRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\"h\n\x16GetGlobalModelResponse\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\")\n\tHeartbeat\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\"W\n\x16\x43lientAvailableMessage\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\t\"R\n\x12ListClientsRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0e\x32\r.grpc.Channel\"*\n\nClientList\x12\x1c\n\x06\x63lient\x18\x01 \x03(\x0b\x32\x0c.grpc.Client\"0\n\x06\x43lient\x12\x18\n\x04role\x18\x01 \x01(\x0e\x32\n.grpc.Role\x12\x0c\n\x04name\x18\x02 \x01(\t\"m\n\x0fReassignRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x0e\n\x06server\x18\x03 \x01(\t\x12\x0c\n\x04port\x18\x04 \x01(\r\"c\n\x10ReconnectRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.grpc.Client\x12\x11\n\treconnect\x18\x03 \x01(\r\"\'\n\tParameter\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"T\n\x0e\x43ontrolRequest\x12\x1e\n\x07\x63ommand\x18\x01 \x01(\x0e\x32\r.grpc.Command\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.grpc.Parameter\"F\n\x0f\x43ontrolResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.grpc.Parameter\"R\n\x0eReportResponse\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.grpc.Client\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.grpc.Parameter\"\x13\n\x11\x43onnectionRequest\"<\n\x12\x43onnectionResponse\x12&\n\x06status\x18\x01 \x01(\x0e\x32\x16.grpc.ConnectionStatus*\x84\x01\n\nStatusType\x12\x07\n\x03LOG\x10\x00\x12\x18\n\x14MODEL_UPDATE_REQUEST\x10\x01\x12\x10\n\x0cMODEL_UPDATE\x10\x02\x12\x1c\n\x18MODEL_VALIDATION_REQUEST\x10\x03\x12\x14\n\x10MODEL_VALIDATION\x10\x04\x12\r\n\tINFERENCE\x10\x05*\x86\x01\n\x07\x43hannel\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\x19\n\x15MODEL_UPDATE_REQUESTS\x10\x01\x12\x11\n\rMODEL_UPDATES\x10\x02\x12\x1d\n\x19MODEL_VALIDATION_REQUESTS\x10\x03\x12\x15\n\x11MODEL_VALIDATIONS\x10\x04\x12\n\n\x06STATUS\x10\x05*F\n\x0bModelStatus\x12\x06\n\x02OK\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\x12\n\x0eIN_PROGRESS_OK\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03*8\n\x04Role\x12\n\n\x06WORKER\x10\x00\x12\x0c\n\x08\x43OMBINER\x10\x01\x12\x0b\n\x07REDUCER\x10\x02\x12\t\n\x05OTHER\x10\x03*J\n\x07\x43ommand\x12\x08\n\x04IDLE\x10\x00\x12\t\n\x05START\x10\x01\x12\t\n\x05PAUSE\x10\x02\x12\x08\n\x04STOP\x10\x03\x12\t\n\x05RESET\x10\x04\x12\n\n\x06REPORT\x10\x05*I\n\x10\x43onnectionStatus\x12\x11\n\rNOT_ACCEPTING\x10\x00\x12\r\n\tACCEPTING\x10\x01\x12\x13\n\x0fTRY_AGAIN_LATER\x10\x02\x32z\n\x0cModelService\x12\x33\n\x06Upload\x12\x12.grpc.ModelRequest\x1a\x13.grpc.ModelResponse(\x01\x12\x35\n\x08\x44ownload\x12\x12.grpc.ModelRequest\x1a\x13.grpc.ModelResponse0\x01\x32\xa9\x02\n\x07\x43ontrol\x12\x34\n\x05Start\x12\x14.grpc.ControlRequest\x1a\x15.grpc.ControlResponse\x12\x33\n\x04Stop\x12\x14.grpc.ControlRequest\x1a\x15.grpc.ControlResponse\x12\x37\n\tConfigure\x12\x14.grpc.ControlRequest\x1a\x14.grpc.ReportResponse\x12\x44\n\x15\x46lushAggregationQueue\x12\x14.grpc.ControlRequest\x1a\x15.grpc.ControlResponse\x12\x34\n\x06Report\x12\x14.grpc.ControlRequest\x1a\x14.grpc.ReportResponse2V\n\x07Reducer\x12K\n\x0eGetGlobalModel\x12\x1b.grpc.GetGlobalModelRequest\x1a\x1c.grpc.GetGlobalModelResponse2\xab\x03\n\tConnector\x12\x44\n\x14\x41llianceStatusStream\x12\x1c.grpc.ClientAvailableMessage\x1a\x0c.grpc.Status0\x01\x12*\n\nSendStatus\x12\x0c.grpc.Status\x1a\x0e.grpc.Response\x12?\n\x11ListActiveClients\x12\x18.grpc.ListClientsRequest\x1a\x10.grpc.ClientList\x12\x45\n\x10\x41\x63\x63\x65ptingClients\x12\x17.grpc.ConnectionRequest\x1a\x18.grpc.ConnectionResponse\x12\x30\n\rSendHeartbeat\x12\x0f.grpc.Heartbeat\x1a\x0e.grpc.Response\x12\x37\n\x0eReassignClient\x12\x15.grpc.ReassignRequest\x1a\x0e.grpc.Response\x12\x39\n\x0fReconnectClient\x12\x16.grpc.ReconnectRequest\x1a\x0e.grpc.Response2\xda\x04\n\x08\x43ombiner\x12T\n\x18ModelUpdateRequestStream\x12\x1c.grpc.ClientAvailableMessage\x1a\x18.grpc.ModelUpdateRequest0\x01\x12\x46\n\x11ModelUpdateStream\x12\x1c.grpc.ClientAvailableMessage\x1a\x11.grpc.ModelUpdate0\x01\x12\\\n\x1cModelValidationRequestStream\x12\x1c.grpc.ClientAvailableMessage\x1a\x1c.grpc.ModelValidationRequest0\x01\x12N\n\x15ModelValidationStream\x12\x1c.grpc.ClientAvailableMessage\x1a\x15.grpc.ModelValidation0\x01\x12\x42\n\x16SendModelUpdateRequest\x12\x18.grpc.ModelUpdateRequest\x1a\x0e.grpc.Response\x12\x34\n\x0fSendModelUpdate\x12\x11.grpc.ModelUpdate\x1a\x0e.grpc.Response\x12J\n\x1aSendModelValidationRequest\x12\x1c.grpc.ModelValidationRequest\x1a\x0e.grpc.Response\x12<\n\x13SendModelValidation\x12\x15.grpc.ModelValidation\x1a\x0e.grpc.Responseb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nfedn.proto\x12\x04\x66\x65\x64n\":\n\x08Response\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08response\x18\x02 \x01(\t\"\x8c\x02\n\x06Status\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x0e\n\x06status\x18\x02 \x01(\t\x12(\n\tlog_level\x18\x03 \x01(\x0e\x32\x15.fedn.Status.LogLevel\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x1e\n\x04type\x18\x07 \x01(\x0e\x32\x10.fedn.StatusType\x12\r\n\x05\x65xtra\x18\x08 \x01(\t\"B\n\x08LogLevel\x12\x08\n\x04INFO\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x12\t\n\x05\x41UDIT\x10\x04\"\xab\x01\n\x12ModelUpdateRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\"\xbf\x01\n\x0bModelUpdate\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x17\n\x0fmodel_update_id\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\x12\x0e\n\x06\x63onfig\x18\x08 \x01(\t\"\xc5\x01\n\x16ModelValidationRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\x12\x14\n\x0cis_inference\x18\x08 \x01(\x08\"\xa8\x01\n\x0fModelValidation\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x16\n\x0e\x63orrelation_id\x18\x05 \x01(\t\x12\x11\n\ttimestamp\x18\x06 \x01(\t\x12\x0c\n\x04meta\x18\x07 \x01(\t\"\x89\x01\n\x0cModelRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x12\n\n\x02id\x18\x04 \x01(\t\x12!\n\x06status\x18\x05 \x01(\x0e\x32\x11.fedn.ModelStatus\"]\n\rModelResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\n\n\x02id\x18\x02 \x01(\t\x12!\n\x06status\x18\x03 \x01(\x0e\x32\x11.fedn.ModelStatus\x12\x0f\n\x07message\x18\x04 \x01(\t\"U\n\x15GetGlobalModelRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\"h\n\x16GetGlobalModelResponse\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x10\n\x08model_id\x18\x03 \x01(\t\")\n\tHeartbeat\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\"W\n\x16\x43lientAvailableMessage\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\t\"R\n\x12ListClientsRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0e\x32\r.fedn.Channel\"*\n\nClientList\x12\x1c\n\x06\x63lient\x18\x01 \x03(\x0b\x32\x0c.fedn.Client\"0\n\x06\x43lient\x12\x18\n\x04role\x18\x01 \x01(\x0e\x32\n.fedn.Role\x12\x0c\n\x04name\x18\x02 \x01(\t\"m\n\x0fReassignRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x0e\n\x06server\x18\x03 \x01(\t\x12\x0c\n\x04port\x18\x04 \x01(\r\"c\n\x10ReconnectRequest\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\x1e\n\x08receiver\x18\x02 \x01(\x0b\x32\x0c.fedn.Client\x12\x11\n\treconnect\x18\x03 \x01(\r\"\'\n\tParameter\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"T\n\x0e\x43ontrolRequest\x12\x1e\n\x07\x63ommand\x18\x01 \x01(\x0e\x32\r.fedn.Command\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.fedn.Parameter\"F\n\x0f\x43ontrolResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.fedn.Parameter\"R\n\x0eReportResponse\x12\x1c\n\x06sender\x18\x01 \x01(\x0b\x32\x0c.fedn.Client\x12\"\n\tparameter\x18\x02 \x03(\x0b\x32\x0f.fedn.Parameter\"\x13\n\x11\x43onnectionRequest\"<\n\x12\x43onnectionResponse\x12&\n\x06status\x18\x01 \x01(\x0e\x32\x16.fedn.ConnectionStatus*\x84\x01\n\nStatusType\x12\x07\n\x03LOG\x10\x00\x12\x18\n\x14MODEL_UPDATE_REQUEST\x10\x01\x12\x10\n\x0cMODEL_UPDATE\x10\x02\x12\x1c\n\x18MODEL_VALIDATION_REQUEST\x10\x03\x12\x14\n\x10MODEL_VALIDATION\x10\x04\x12\r\n\tINFERENCE\x10\x05*\x86\x01\n\x07\x43hannel\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\x19\n\x15MODEL_UPDATE_REQUESTS\x10\x01\x12\x11\n\rMODEL_UPDATES\x10\x02\x12\x1d\n\x19MODEL_VALIDATION_REQUESTS\x10\x03\x12\x15\n\x11MODEL_VALIDATIONS\x10\x04\x12\n\n\x06STATUS\x10\x05*F\n\x0bModelStatus\x12\x06\n\x02OK\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\x12\n\x0eIN_PROGRESS_OK\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03*8\n\x04Role\x12\n\n\x06WORKER\x10\x00\x12\x0c\n\x08\x43OMBINER\x10\x01\x12\x0b\n\x07REDUCER\x10\x02\x12\t\n\x05OTHER\x10\x03*J\n\x07\x43ommand\x12\x08\n\x04IDLE\x10\x00\x12\t\n\x05START\x10\x01\x12\t\n\x05PAUSE\x10\x02\x12\x08\n\x04STOP\x10\x03\x12\t\n\x05RESET\x10\x04\x12\n\n\x06REPORT\x10\x05*I\n\x10\x43onnectionStatus\x12\x11\n\rNOT_ACCEPTING\x10\x00\x12\r\n\tACCEPTING\x10\x01\x12\x13\n\x0fTRY_AGAIN_LATER\x10\x02\x32z\n\x0cModelService\x12\x33\n\x06Upload\x12\x12.fedn.ModelRequest\x1a\x13.fedn.ModelResponse(\x01\x12\x35\n\x08\x44ownload\x12\x12.fedn.ModelRequest\x1a\x13.fedn.ModelResponse0\x01\x32\xa9\x02\n\x07\x43ontrol\x12\x34\n\x05Start\x12\x14.fedn.ControlRequest\x1a\x15.fedn.ControlResponse\x12\x33\n\x04Stop\x12\x14.fedn.ControlRequest\x1a\x15.fedn.ControlResponse\x12\x37\n\tConfigure\x12\x14.fedn.ControlRequest\x1a\x14.fedn.ReportResponse\x12\x44\n\x15\x46lushAggregationQueue\x12\x14.fedn.ControlRequest\x1a\x15.fedn.ControlResponse\x12\x34\n\x06Report\x12\x14.fedn.ControlRequest\x1a\x14.fedn.ReportResponse2V\n\x07Reducer\x12K\n\x0eGetGlobalModel\x12\x1b.fedn.GetGlobalModelRequest\x1a\x1c.fedn.GetGlobalModelResponse2\xab\x03\n\tConnector\x12\x44\n\x14\x41llianceStatusStream\x12\x1c.fedn.ClientAvailableMessage\x1a\x0c.fedn.Status0\x01\x12*\n\nSendStatus\x12\x0c.fedn.Status\x1a\x0e.fedn.Response\x12?\n\x11ListActiveClients\x12\x18.fedn.ListClientsRequest\x1a\x10.fedn.ClientList\x12\x45\n\x10\x41\x63\x63\x65ptingClients\x12\x17.fedn.ConnectionRequest\x1a\x18.fedn.ConnectionResponse\x12\x30\n\rSendHeartbeat\x12\x0f.fedn.Heartbeat\x1a\x0e.fedn.Response\x12\x37\n\x0eReassignClient\x12\x15.fedn.ReassignRequest\x1a\x0e.fedn.Response\x12\x39\n\x0fReconnectClient\x12\x16.fedn.ReconnectRequest\x1a\x0e.fedn.Response2\xda\x04\n\x08\x43ombiner\x12T\n\x18ModelUpdateRequestStream\x12\x1c.fedn.ClientAvailableMessage\x1a\x18.fedn.ModelUpdateRequest0\x01\x12\x46\n\x11ModelUpdateStream\x12\x1c.fedn.ClientAvailableMessage\x1a\x11.fedn.ModelUpdate0\x01\x12\\\n\x1cModelValidationRequestStream\x12\x1c.fedn.ClientAvailableMessage\x1a\x1c.fedn.ModelValidationRequest0\x01\x12N\n\x15ModelValidationStream\x12\x1c.fedn.ClientAvailableMessage\x1a\x15.fedn.ModelValidation0\x01\x12\x42\n\x16SendModelUpdateRequest\x12\x18.fedn.ModelUpdateRequest\x1a\x0e.fedn.Response\x12\x34\n\x0fSendModelUpdate\x12\x11.fedn.ModelUpdate\x1a\x0e.fedn.Response\x12J\n\x1aSendModelValidationRequest\x12\x1c.fedn.ModelValidationRequest\x1a\x0e.fedn.Response\x12<\n\x13SendModelValidation\x12\x15.fedn.ModelValidation\x1a\x0e.fedn.Responseb\x06proto3') -_STATUSTYPE = DESCRIPTOR.enum_types_by_name['StatusType'] -StatusType = enum_type_wrapper.EnumTypeWrapper(_STATUSTYPE) -_CHANNEL = DESCRIPTOR.enum_types_by_name['Channel'] -Channel = enum_type_wrapper.EnumTypeWrapper(_CHANNEL) -_MODELSTATUS = DESCRIPTOR.enum_types_by_name['ModelStatus'] -ModelStatus = enum_type_wrapper.EnumTypeWrapper(_MODELSTATUS) -_ROLE = DESCRIPTOR.enum_types_by_name['Role'] -Role = enum_type_wrapper.EnumTypeWrapper(_ROLE) -_COMMAND = DESCRIPTOR.enum_types_by_name['Command'] -Command = enum_type_wrapper.EnumTypeWrapper(_COMMAND) -_CONNECTIONSTATUS = DESCRIPTOR.enum_types_by_name['ConnectionStatus'] -ConnectionStatus = enum_type_wrapper.EnumTypeWrapper(_CONNECTIONSTATUS) -LOG = 0 -MODEL_UPDATE_REQUEST = 1 -MODEL_UPDATE = 2 -MODEL_VALIDATION_REQUEST = 3 -MODEL_VALIDATION = 4 -INFERENCE = 5 -DEFAULT = 0 -MODEL_UPDATE_REQUESTS = 1 -MODEL_UPDATES = 2 -MODEL_VALIDATION_REQUESTS = 3 -MODEL_VALIDATIONS = 4 -STATUS = 5 -OK = 0 -IN_PROGRESS = 1 -IN_PROGRESS_OK = 2 -FAILED = 3 -WORKER = 0 -COMBINER = 1 -REDUCER = 2 -OTHER = 3 -IDLE = 0 -START = 1 -PAUSE = 2 -STOP = 3 -RESET = 4 -REPORT = 5 -NOT_ACCEPTING = 0 -ACCEPTING = 1 -TRY_AGAIN_LATER = 2 - - -_RESPONSE = DESCRIPTOR.message_types_by_name['Response'] -_STATUS = DESCRIPTOR.message_types_by_name['Status'] -_MODELUPDATEREQUEST = DESCRIPTOR.message_types_by_name['ModelUpdateRequest'] -_MODELUPDATE = DESCRIPTOR.message_types_by_name['ModelUpdate'] -_MODELVALIDATIONREQUEST = DESCRIPTOR.message_types_by_name['ModelValidationRequest'] -_MODELVALIDATION = DESCRIPTOR.message_types_by_name['ModelValidation'] -_MODELREQUEST = DESCRIPTOR.message_types_by_name['ModelRequest'] -_MODELRESPONSE = DESCRIPTOR.message_types_by_name['ModelResponse'] -_GETGLOBALMODELREQUEST = DESCRIPTOR.message_types_by_name['GetGlobalModelRequest'] -_GETGLOBALMODELRESPONSE = DESCRIPTOR.message_types_by_name['GetGlobalModelResponse'] -_HEARTBEAT = DESCRIPTOR.message_types_by_name['Heartbeat'] -_CLIENTAVAILABLEMESSAGE = DESCRIPTOR.message_types_by_name['ClientAvailableMessage'] -_LISTCLIENTSREQUEST = DESCRIPTOR.message_types_by_name['ListClientsRequest'] -_CLIENTLIST = DESCRIPTOR.message_types_by_name['ClientList'] -_CLIENT = DESCRIPTOR.message_types_by_name['Client'] -_REASSIGNREQUEST = DESCRIPTOR.message_types_by_name['ReassignRequest'] -_RECONNECTREQUEST = DESCRIPTOR.message_types_by_name['ReconnectRequest'] -_PARAMETER = DESCRIPTOR.message_types_by_name['Parameter'] -_CONTROLREQUEST = DESCRIPTOR.message_types_by_name['ControlRequest'] -_CONTROLRESPONSE = DESCRIPTOR.message_types_by_name['ControlResponse'] -_REPORTRESPONSE = DESCRIPTOR.message_types_by_name['ReportResponse'] -_CONNECTIONREQUEST = DESCRIPTOR.message_types_by_name['ConnectionRequest'] -_CONNECTIONRESPONSE = DESCRIPTOR.message_types_by_name['ConnectionResponse'] -_STATUS_LOGLEVEL = _STATUS.enum_types_by_name['LogLevel'] -Response = _reflection.GeneratedProtocolMessageType('Response', (_message.Message,), { - 'DESCRIPTOR' : _RESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.Response) - }) -_sym_db.RegisterMessage(Response) - -Status = _reflection.GeneratedProtocolMessageType('Status', (_message.Message,), { - 'DESCRIPTOR' : _STATUS, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.Status) - }) -_sym_db.RegisterMessage(Status) - -ModelUpdateRequest = _reflection.GeneratedProtocolMessageType('ModelUpdateRequest', (_message.Message,), { - 'DESCRIPTOR' : _MODELUPDATEREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelUpdateRequest) - }) -_sym_db.RegisterMessage(ModelUpdateRequest) - -ModelUpdate = _reflection.GeneratedProtocolMessageType('ModelUpdate', (_message.Message,), { - 'DESCRIPTOR' : _MODELUPDATE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelUpdate) - }) -_sym_db.RegisterMessage(ModelUpdate) - -ModelValidationRequest = _reflection.GeneratedProtocolMessageType('ModelValidationRequest', (_message.Message,), { - 'DESCRIPTOR' : _MODELVALIDATIONREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelValidationRequest) - }) -_sym_db.RegisterMessage(ModelValidationRequest) - -ModelValidation = _reflection.GeneratedProtocolMessageType('ModelValidation', (_message.Message,), { - 'DESCRIPTOR' : _MODELVALIDATION, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelValidation) - }) -_sym_db.RegisterMessage(ModelValidation) - -ModelRequest = _reflection.GeneratedProtocolMessageType('ModelRequest', (_message.Message,), { - 'DESCRIPTOR' : _MODELREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelRequest) - }) -_sym_db.RegisterMessage(ModelRequest) - -ModelResponse = _reflection.GeneratedProtocolMessageType('ModelResponse', (_message.Message,), { - 'DESCRIPTOR' : _MODELRESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ModelResponse) - }) -_sym_db.RegisterMessage(ModelResponse) - -GetGlobalModelRequest = _reflection.GeneratedProtocolMessageType('GetGlobalModelRequest', (_message.Message,), { - 'DESCRIPTOR' : _GETGLOBALMODELREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.GetGlobalModelRequest) - }) -_sym_db.RegisterMessage(GetGlobalModelRequest) - -GetGlobalModelResponse = _reflection.GeneratedProtocolMessageType('GetGlobalModelResponse', (_message.Message,), { - 'DESCRIPTOR' : _GETGLOBALMODELRESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.GetGlobalModelResponse) - }) -_sym_db.RegisterMessage(GetGlobalModelResponse) - -Heartbeat = _reflection.GeneratedProtocolMessageType('Heartbeat', (_message.Message,), { - 'DESCRIPTOR' : _HEARTBEAT, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.Heartbeat) - }) -_sym_db.RegisterMessage(Heartbeat) - -ClientAvailableMessage = _reflection.GeneratedProtocolMessageType('ClientAvailableMessage', (_message.Message,), { - 'DESCRIPTOR' : _CLIENTAVAILABLEMESSAGE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ClientAvailableMessage) - }) -_sym_db.RegisterMessage(ClientAvailableMessage) - -ListClientsRequest = _reflection.GeneratedProtocolMessageType('ListClientsRequest', (_message.Message,), { - 'DESCRIPTOR' : _LISTCLIENTSREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ListClientsRequest) - }) -_sym_db.RegisterMessage(ListClientsRequest) - -ClientList = _reflection.GeneratedProtocolMessageType('ClientList', (_message.Message,), { - 'DESCRIPTOR' : _CLIENTLIST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ClientList) - }) -_sym_db.RegisterMessage(ClientList) - -Client = _reflection.GeneratedProtocolMessageType('Client', (_message.Message,), { - 'DESCRIPTOR' : _CLIENT, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.Client) - }) -_sym_db.RegisterMessage(Client) - -ReassignRequest = _reflection.GeneratedProtocolMessageType('ReassignRequest', (_message.Message,), { - 'DESCRIPTOR' : _REASSIGNREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ReassignRequest) - }) -_sym_db.RegisterMessage(ReassignRequest) - -ReconnectRequest = _reflection.GeneratedProtocolMessageType('ReconnectRequest', (_message.Message,), { - 'DESCRIPTOR' : _RECONNECTREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ReconnectRequest) - }) -_sym_db.RegisterMessage(ReconnectRequest) - -Parameter = _reflection.GeneratedProtocolMessageType('Parameter', (_message.Message,), { - 'DESCRIPTOR' : _PARAMETER, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.Parameter) - }) -_sym_db.RegisterMessage(Parameter) - -ControlRequest = _reflection.GeneratedProtocolMessageType('ControlRequest', (_message.Message,), { - 'DESCRIPTOR' : _CONTROLREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ControlRequest) - }) -_sym_db.RegisterMessage(ControlRequest) - -ControlResponse = _reflection.GeneratedProtocolMessageType('ControlResponse', (_message.Message,), { - 'DESCRIPTOR' : _CONTROLRESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ControlResponse) - }) -_sym_db.RegisterMessage(ControlResponse) - -ReportResponse = _reflection.GeneratedProtocolMessageType('ReportResponse', (_message.Message,), { - 'DESCRIPTOR' : _REPORTRESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ReportResponse) - }) -_sym_db.RegisterMessage(ReportResponse) - -ConnectionRequest = _reflection.GeneratedProtocolMessageType('ConnectionRequest', (_message.Message,), { - 'DESCRIPTOR' : _CONNECTIONREQUEST, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ConnectionRequest) - }) -_sym_db.RegisterMessage(ConnectionRequest) - -ConnectionResponse = _reflection.GeneratedProtocolMessageType('ConnectionResponse', (_message.Message,), { - 'DESCRIPTOR' : _CONNECTIONRESPONSE, - '__module__' : 'fedn.common.net.grpc.fedn_pb2' - # @@protoc_insertion_point(class_scope:grpc.ConnectionResponse) - }) -_sym_db.RegisterMessage(ConnectionResponse) - -_MODELSERVICE = DESCRIPTOR.services_by_name['ModelService'] -_CONTROL = DESCRIPTOR.services_by_name['Control'] -_REDUCER = DESCRIPTOR.services_by_name['Reducer'] -_CONNECTOR = DESCRIPTOR.services_by_name['Connector'] -_COMBINER = DESCRIPTOR.services_by_name['Combiner'] +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'fedn_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None - _STATUSTYPE._serialized_start=2412 - _STATUSTYPE._serialized_end=2544 - _CHANNEL._serialized_start=2547 - _CHANNEL._serialized_end=2681 - _MODELSTATUS._serialized_start=2683 - _MODELSTATUS._serialized_end=2753 - _ROLE._serialized_start=2755 - _ROLE._serialized_end=2811 - _COMMAND._serialized_start=2813 - _COMMAND._serialized_end=2887 - _CONNECTIONSTATUS._serialized_start=2889 - _CONNECTIONSTATUS._serialized_end=2962 - _RESPONSE._serialized_start=41 - _RESPONSE._serialized_end=99 - _STATUS._serialized_start=102 - _STATUS._serialized_end=370 - _STATUS_LOGLEVEL._serialized_start=304 - _STATUS_LOGLEVEL._serialized_end=370 - _MODELUPDATEREQUEST._serialized_start=373 - _MODELUPDATEREQUEST._serialized_end=544 - _MODELUPDATE._serialized_start=547 - _MODELUPDATE._serialized_end=722 - _MODELVALIDATIONREQUEST._serialized_start=725 - _MODELVALIDATIONREQUEST._serialized_end=922 - _MODELVALIDATION._serialized_start=925 - _MODELVALIDATION._serialized_end=1093 - _MODELREQUEST._serialized_start=1096 - _MODELREQUEST._serialized_end=1233 - _MODELRESPONSE._serialized_start=1235 - _MODELRESPONSE._serialized_end=1328 - _GETGLOBALMODELREQUEST._serialized_start=1330 - _GETGLOBALMODELREQUEST._serialized_end=1415 - _GETGLOBALMODELRESPONSE._serialized_start=1417 - _GETGLOBALMODELRESPONSE._serialized_end=1521 - _HEARTBEAT._serialized_start=1523 - _HEARTBEAT._serialized_end=1564 - _CLIENTAVAILABLEMESSAGE._serialized_start=1566 - _CLIENTAVAILABLEMESSAGE._serialized_end=1653 - _LISTCLIENTSREQUEST._serialized_start=1655 - _LISTCLIENTSREQUEST._serialized_end=1737 - _CLIENTLIST._serialized_start=1739 - _CLIENTLIST._serialized_end=1781 - _CLIENT._serialized_start=1783 - _CLIENT._serialized_end=1831 - _REASSIGNREQUEST._serialized_start=1833 - _REASSIGNREQUEST._serialized_end=1942 - _RECONNECTREQUEST._serialized_start=1944 - _RECONNECTREQUEST._serialized_end=2043 - _PARAMETER._serialized_start=2045 - _PARAMETER._serialized_end=2084 - _CONTROLREQUEST._serialized_start=2086 - _CONTROLREQUEST._serialized_end=2170 - _CONTROLRESPONSE._serialized_start=2172 - _CONTROLRESPONSE._serialized_end=2242 - _REPORTRESPONSE._serialized_start=2244 - _REPORTRESPONSE._serialized_end=2326 - _CONNECTIONREQUEST._serialized_start=2328 - _CONNECTIONREQUEST._serialized_end=2347 - _CONNECTIONRESPONSE._serialized_start=2349 - _CONNECTIONRESPONSE._serialized_end=2409 - _MODELSERVICE._serialized_start=2964 - _MODELSERVICE._serialized_end=3086 - _CONTROL._serialized_start=3089 - _CONTROL._serialized_end=3386 - _REDUCER._serialized_start=3388 - _REDUCER._serialized_end=3474 - _CONNECTOR._serialized_start=3477 - _CONNECTOR._serialized_end=3904 - _COMBINER._serialized_start=3907 - _COMBINER._serialized_end=4509 + _globals['_STATUSTYPE']._serialized_start=2407 + _globals['_STATUSTYPE']._serialized_end=2539 + _globals['_CHANNEL']._serialized_start=2542 + _globals['_CHANNEL']._serialized_end=2676 + _globals['_MODELSTATUS']._serialized_start=2678 + _globals['_MODELSTATUS']._serialized_end=2748 + _globals['_ROLE']._serialized_start=2750 + _globals['_ROLE']._serialized_end=2806 + _globals['_COMMAND']._serialized_start=2808 + _globals['_COMMAND']._serialized_end=2882 + _globals['_CONNECTIONSTATUS']._serialized_start=2884 + _globals['_CONNECTIONSTATUS']._serialized_end=2957 + _globals['_RESPONSE']._serialized_start=20 + _globals['_RESPONSE']._serialized_end=78 + _globals['_STATUS']._serialized_start=81 + _globals['_STATUS']._serialized_end=349 + _globals['_STATUS_LOGLEVEL']._serialized_start=283 + _globals['_STATUS_LOGLEVEL']._serialized_end=349 + _globals['_MODELUPDATEREQUEST']._serialized_start=352 + _globals['_MODELUPDATEREQUEST']._serialized_end=523 + _globals['_MODELUPDATE']._serialized_start=526 + _globals['_MODELUPDATE']._serialized_end=717 + _globals['_MODELVALIDATIONREQUEST']._serialized_start=720 + _globals['_MODELVALIDATIONREQUEST']._serialized_end=917 + _globals['_MODELVALIDATION']._serialized_start=920 + _globals['_MODELVALIDATION']._serialized_end=1088 + _globals['_MODELREQUEST']._serialized_start=1091 + _globals['_MODELREQUEST']._serialized_end=1228 + _globals['_MODELRESPONSE']._serialized_start=1230 + _globals['_MODELRESPONSE']._serialized_end=1323 + _globals['_GETGLOBALMODELREQUEST']._serialized_start=1325 + _globals['_GETGLOBALMODELREQUEST']._serialized_end=1410 + _globals['_GETGLOBALMODELRESPONSE']._serialized_start=1412 + _globals['_GETGLOBALMODELRESPONSE']._serialized_end=1516 + _globals['_HEARTBEAT']._serialized_start=1518 + _globals['_HEARTBEAT']._serialized_end=1559 + _globals['_CLIENTAVAILABLEMESSAGE']._serialized_start=1561 + _globals['_CLIENTAVAILABLEMESSAGE']._serialized_end=1648 + _globals['_LISTCLIENTSREQUEST']._serialized_start=1650 + _globals['_LISTCLIENTSREQUEST']._serialized_end=1732 + _globals['_CLIENTLIST']._serialized_start=1734 + _globals['_CLIENTLIST']._serialized_end=1776 + _globals['_CLIENT']._serialized_start=1778 + _globals['_CLIENT']._serialized_end=1826 + _globals['_REASSIGNREQUEST']._serialized_start=1828 + _globals['_REASSIGNREQUEST']._serialized_end=1937 + _globals['_RECONNECTREQUEST']._serialized_start=1939 + _globals['_RECONNECTREQUEST']._serialized_end=2038 + _globals['_PARAMETER']._serialized_start=2040 + _globals['_PARAMETER']._serialized_end=2079 + _globals['_CONTROLREQUEST']._serialized_start=2081 + _globals['_CONTROLREQUEST']._serialized_end=2165 + _globals['_CONTROLRESPONSE']._serialized_start=2167 + _globals['_CONTROLRESPONSE']._serialized_end=2237 + _globals['_REPORTRESPONSE']._serialized_start=2239 + _globals['_REPORTRESPONSE']._serialized_end=2321 + _globals['_CONNECTIONREQUEST']._serialized_start=2323 + _globals['_CONNECTIONREQUEST']._serialized_end=2342 + _globals['_CONNECTIONRESPONSE']._serialized_start=2344 + _globals['_CONNECTIONRESPONSE']._serialized_end=2404 + _globals['_MODELSERVICE']._serialized_start=2959 + _globals['_MODELSERVICE']._serialized_end=3081 + _globals['_CONTROL']._serialized_start=3084 + _globals['_CONTROL']._serialized_end=3381 + _globals['_REDUCER']._serialized_start=3383 + _globals['_REDUCER']._serialized_end=3469 + _globals['_CONNECTOR']._serialized_start=3472 + _globals['_CONNECTOR']._serialized_end=3899 + _globals['_COMBINER']._serialized_start=3902 + _globals['_COMBINER']._serialized_end=4504 # @@protoc_insertion_point(module_scope) diff --git a/fedn/fedn/common/net/grpc/fedn_pb2_grpc.py b/fedn/fedn/common/net/grpc/fedn_pb2_grpc.py index 9590e2b5c..6cae714e5 100644 --- a/fedn/fedn/common/net/grpc/fedn_pb2_grpc.py +++ b/fedn/fedn/common/net/grpc/fedn_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from fedn.common.net.grpc import fedn_pb2 as fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2 +from . import fedn_pb2 as fedn__pb2 class ModelServiceStub(object): @@ -15,14 +15,14 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Upload = channel.stream_unary( - '/grpc.ModelService/Upload', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.FromString, + '/fedn.ModelService/Upload', + request_serializer=fedn__pb2.ModelRequest.SerializeToString, + response_deserializer=fedn__pb2.ModelResponse.FromString, ) self.Download = channel.unary_stream( - '/grpc.ModelService/Download', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.FromString, + '/fedn.ModelService/Download', + request_serializer=fedn__pb2.ModelRequest.SerializeToString, + response_deserializer=fedn__pb2.ModelResponse.FromString, ) @@ -46,17 +46,17 @@ def add_ModelServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'Upload': grpc.stream_unary_rpc_method_handler( servicer.Upload, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.SerializeToString, + request_deserializer=fedn__pb2.ModelRequest.FromString, + response_serializer=fedn__pb2.ModelResponse.SerializeToString, ), 'Download': grpc.unary_stream_rpc_method_handler( servicer.Download, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.SerializeToString, + request_deserializer=fedn__pb2.ModelRequest.FromString, + response_serializer=fedn__pb2.ModelResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'grpc.ModelService', rpc_method_handlers) + 'fedn.ModelService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) @@ -75,9 +75,9 @@ def Upload(request_iterator, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.stream_unary(request_iterator, target, '/grpc.ModelService/Upload', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.FromString, + return grpc.experimental.stream_unary(request_iterator, target, '/fedn.ModelService/Upload', + fedn__pb2.ModelRequest.SerializeToString, + fedn__pb2.ModelResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -92,9 +92,9 @@ def Download(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.ModelService/Download', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelResponse.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.ModelService/Download', + fedn__pb2.ModelRequest.SerializeToString, + fedn__pb2.ModelResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -109,29 +109,29 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Start = channel.unary_unary( - '/grpc.Control/Start', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + '/fedn.Control/Start', + request_serializer=fedn__pb2.ControlRequest.SerializeToString, + response_deserializer=fedn__pb2.ControlResponse.FromString, ) self.Stop = channel.unary_unary( - '/grpc.Control/Stop', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + '/fedn.Control/Stop', + request_serializer=fedn__pb2.ControlRequest.SerializeToString, + response_deserializer=fedn__pb2.ControlResponse.FromString, ) self.Configure = channel.unary_unary( - '/grpc.Control/Configure', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.FromString, + '/fedn.Control/Configure', + request_serializer=fedn__pb2.ControlRequest.SerializeToString, + response_deserializer=fedn__pb2.ReportResponse.FromString, ) self.FlushAggregationQueue = channel.unary_unary( - '/grpc.Control/FlushAggregationQueue', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + '/fedn.Control/FlushAggregationQueue', + request_serializer=fedn__pb2.ControlRequest.SerializeToString, + response_deserializer=fedn__pb2.ControlResponse.FromString, ) self.Report = channel.unary_unary( - '/grpc.Control/Report', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.FromString, + '/fedn.Control/Report', + request_serializer=fedn__pb2.ControlRequest.SerializeToString, + response_deserializer=fedn__pb2.ReportResponse.FromString, ) @@ -173,32 +173,32 @@ def add_ControlServicer_to_server(servicer, server): rpc_method_handlers = { 'Start': grpc.unary_unary_rpc_method_handler( servicer.Start, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.SerializeToString, + request_deserializer=fedn__pb2.ControlRequest.FromString, + response_serializer=fedn__pb2.ControlResponse.SerializeToString, ), 'Stop': grpc.unary_unary_rpc_method_handler( servicer.Stop, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.SerializeToString, + request_deserializer=fedn__pb2.ControlRequest.FromString, + response_serializer=fedn__pb2.ControlResponse.SerializeToString, ), 'Configure': grpc.unary_unary_rpc_method_handler( servicer.Configure, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.SerializeToString, + request_deserializer=fedn__pb2.ControlRequest.FromString, + response_serializer=fedn__pb2.ReportResponse.SerializeToString, ), 'FlushAggregationQueue': grpc.unary_unary_rpc_method_handler( servicer.FlushAggregationQueue, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.SerializeToString, + request_deserializer=fedn__pb2.ControlRequest.FromString, + response_serializer=fedn__pb2.ControlResponse.SerializeToString, ), 'Report': grpc.unary_unary_rpc_method_handler( servicer.Report, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.SerializeToString, + request_deserializer=fedn__pb2.ControlRequest.FromString, + response_serializer=fedn__pb2.ReportResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'grpc.Control', rpc_method_handlers) + 'fedn.Control', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) @@ -217,9 +217,9 @@ def Start(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Control/Start', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Control/Start', + fedn__pb2.ControlRequest.SerializeToString, + fedn__pb2.ControlResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -234,9 +234,9 @@ def Stop(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Control/Stop', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Control/Stop', + fedn__pb2.ControlRequest.SerializeToString, + fedn__pb2.ControlResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -251,9 +251,9 @@ def Configure(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Control/Configure', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Control/Configure', + fedn__pb2.ControlRequest.SerializeToString, + fedn__pb2.ReportResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -268,9 +268,9 @@ def FlushAggregationQueue(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Control/FlushAggregationQueue', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Control/FlushAggregationQueue', + fedn__pb2.ControlRequest.SerializeToString, + fedn__pb2.ControlResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -285,9 +285,9 @@ def Report(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Control/Report', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ControlRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReportResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Control/Report', + fedn__pb2.ControlRequest.SerializeToString, + fedn__pb2.ReportResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -302,9 +302,9 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.GetGlobalModel = channel.unary_unary( - '/grpc.Reducer/GetGlobalModel', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelResponse.FromString, + '/fedn.Reducer/GetGlobalModel', + request_serializer=fedn__pb2.GetGlobalModelRequest.SerializeToString, + response_deserializer=fedn__pb2.GetGlobalModelResponse.FromString, ) @@ -322,12 +322,12 @@ def add_ReducerServicer_to_server(servicer, server): rpc_method_handlers = { 'GetGlobalModel': grpc.unary_unary_rpc_method_handler( servicer.GetGlobalModel, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelResponse.SerializeToString, + request_deserializer=fedn__pb2.GetGlobalModelRequest.FromString, + response_serializer=fedn__pb2.GetGlobalModelResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'grpc.Reducer', rpc_method_handlers) + 'fedn.Reducer', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) @@ -346,9 +346,9 @@ def GetGlobalModel(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Reducer/GetGlobalModel', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.GetGlobalModelResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Reducer/GetGlobalModel', + fedn__pb2.GetGlobalModelRequest.SerializeToString, + fedn__pb2.GetGlobalModelResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -363,39 +363,39 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.AllianceStatusStream = channel.unary_stream( - '/grpc.Connector/AllianceStatusStream', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.FromString, + '/fedn.Connector/AllianceStatusStream', + request_serializer=fedn__pb2.ClientAvailableMessage.SerializeToString, + response_deserializer=fedn__pb2.Status.FromString, ) self.SendStatus = channel.unary_unary( - '/grpc.Connector/SendStatus', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Connector/SendStatus', + request_serializer=fedn__pb2.Status.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.ListActiveClients = channel.unary_unary( - '/grpc.Connector/ListActiveClients', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ListClientsRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientList.FromString, + '/fedn.Connector/ListActiveClients', + request_serializer=fedn__pb2.ListClientsRequest.SerializeToString, + response_deserializer=fedn__pb2.ClientList.FromString, ) self.AcceptingClients = channel.unary_unary( - '/grpc.Connector/AcceptingClients', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionResponse.FromString, + '/fedn.Connector/AcceptingClients', + request_serializer=fedn__pb2.ConnectionRequest.SerializeToString, + response_deserializer=fedn__pb2.ConnectionResponse.FromString, ) self.SendHeartbeat = channel.unary_unary( - '/grpc.Connector/SendHeartbeat', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Heartbeat.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Connector/SendHeartbeat', + request_serializer=fedn__pb2.Heartbeat.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.ReassignClient = channel.unary_unary( - '/grpc.Connector/ReassignClient', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReassignRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Connector/ReassignClient', + request_serializer=fedn__pb2.ReassignRequest.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.ReconnectClient = channel.unary_unary( - '/grpc.Connector/ReconnectClient', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReconnectRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Connector/ReconnectClient', + request_serializer=fedn__pb2.ReconnectRequest.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) @@ -454,42 +454,42 @@ def add_ConnectorServicer_to_server(servicer, server): rpc_method_handlers = { 'AllianceStatusStream': grpc.unary_stream_rpc_method_handler( servicer.AllianceStatusStream, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.SerializeToString, + request_deserializer=fedn__pb2.ClientAvailableMessage.FromString, + response_serializer=fedn__pb2.Status.SerializeToString, ), 'SendStatus': grpc.unary_unary_rpc_method_handler( servicer.SendStatus, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.Status.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'ListActiveClients': grpc.unary_unary_rpc_method_handler( servicer.ListActiveClients, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ListClientsRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientList.SerializeToString, + request_deserializer=fedn__pb2.ListClientsRequest.FromString, + response_serializer=fedn__pb2.ClientList.SerializeToString, ), 'AcceptingClients': grpc.unary_unary_rpc_method_handler( servicer.AcceptingClients, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionResponse.SerializeToString, + request_deserializer=fedn__pb2.ConnectionRequest.FromString, + response_serializer=fedn__pb2.ConnectionResponse.SerializeToString, ), 'SendHeartbeat': grpc.unary_unary_rpc_method_handler( servicer.SendHeartbeat, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Heartbeat.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.Heartbeat.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'ReassignClient': grpc.unary_unary_rpc_method_handler( servicer.ReassignClient, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReassignRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ReassignRequest.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'ReconnectClient': grpc.unary_unary_rpc_method_handler( servicer.ReconnectClient, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReconnectRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ReconnectRequest.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'grpc.Connector', rpc_method_handlers) + 'fedn.Connector', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) @@ -508,9 +508,9 @@ def AllianceStatusStream(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.Connector/AllianceStatusStream', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.Connector/AllianceStatusStream', + fedn__pb2.ClientAvailableMessage.SerializeToString, + fedn__pb2.Status.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -525,9 +525,9 @@ def SendStatus(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/SendStatus', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Status.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/SendStatus', + fedn__pb2.Status.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -542,9 +542,9 @@ def ListActiveClients(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/ListActiveClients', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ListClientsRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientList.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/ListActiveClients', + fedn__pb2.ListClientsRequest.SerializeToString, + fedn__pb2.ClientList.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -559,9 +559,9 @@ def AcceptingClients(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/AcceptingClients', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ConnectionResponse.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/AcceptingClients', + fedn__pb2.ConnectionRequest.SerializeToString, + fedn__pb2.ConnectionResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -576,9 +576,9 @@ def SendHeartbeat(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/SendHeartbeat', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Heartbeat.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/SendHeartbeat', + fedn__pb2.Heartbeat.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -593,9 +593,9 @@ def ReassignClient(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/ReassignClient', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReassignRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/ReassignClient', + fedn__pb2.ReassignRequest.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -610,9 +610,9 @@ def ReconnectClient(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Connector/ReconnectClient', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ReconnectRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Connector/ReconnectClient', + fedn__pb2.ReconnectRequest.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -627,44 +627,44 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.ModelUpdateRequestStream = channel.unary_stream( - '/grpc.Combiner/ModelUpdateRequestStream', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.FromString, + '/fedn.Combiner/ModelUpdateRequestStream', + request_serializer=fedn__pb2.ClientAvailableMessage.SerializeToString, + response_deserializer=fedn__pb2.ModelUpdateRequest.FromString, ) self.ModelUpdateStream = channel.unary_stream( - '/grpc.Combiner/ModelUpdateStream', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.FromString, + '/fedn.Combiner/ModelUpdateStream', + request_serializer=fedn__pb2.ClientAvailableMessage.SerializeToString, + response_deserializer=fedn__pb2.ModelUpdate.FromString, ) self.ModelValidationRequestStream = channel.unary_stream( - '/grpc.Combiner/ModelValidationRequestStream', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.FromString, + '/fedn.Combiner/ModelValidationRequestStream', + request_serializer=fedn__pb2.ClientAvailableMessage.SerializeToString, + response_deserializer=fedn__pb2.ModelValidationRequest.FromString, ) self.ModelValidationStream = channel.unary_stream( - '/grpc.Combiner/ModelValidationStream', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.FromString, + '/fedn.Combiner/ModelValidationStream', + request_serializer=fedn__pb2.ClientAvailableMessage.SerializeToString, + response_deserializer=fedn__pb2.ModelValidation.FromString, ) self.SendModelUpdateRequest = channel.unary_unary( - '/grpc.Combiner/SendModelUpdateRequest', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Combiner/SendModelUpdateRequest', + request_serializer=fedn__pb2.ModelUpdateRequest.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.SendModelUpdate = channel.unary_unary( - '/grpc.Combiner/SendModelUpdate', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Combiner/SendModelUpdate', + request_serializer=fedn__pb2.ModelUpdate.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.SendModelValidationRequest = channel.unary_unary( - '/grpc.Combiner/SendModelValidationRequest', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Combiner/SendModelValidationRequest', + request_serializer=fedn__pb2.ModelValidationRequest.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) self.SendModelValidation = channel.unary_unary( - '/grpc.Combiner/SendModelValidation', - request_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.SerializeToString, - response_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + '/fedn.Combiner/SendModelValidation', + request_serializer=fedn__pb2.ModelValidation.SerializeToString, + response_deserializer=fedn__pb2.Response.FromString, ) @@ -725,47 +725,47 @@ def add_CombinerServicer_to_server(servicer, server): rpc_method_handlers = { 'ModelUpdateRequestStream': grpc.unary_stream_rpc_method_handler( servicer.ModelUpdateRequestStream, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.SerializeToString, + request_deserializer=fedn__pb2.ClientAvailableMessage.FromString, + response_serializer=fedn__pb2.ModelUpdateRequest.SerializeToString, ), 'ModelUpdateStream': grpc.unary_stream_rpc_method_handler( servicer.ModelUpdateStream, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.SerializeToString, + request_deserializer=fedn__pb2.ClientAvailableMessage.FromString, + response_serializer=fedn__pb2.ModelUpdate.SerializeToString, ), 'ModelValidationRequestStream': grpc.unary_stream_rpc_method_handler( servicer.ModelValidationRequestStream, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.SerializeToString, + request_deserializer=fedn__pb2.ClientAvailableMessage.FromString, + response_serializer=fedn__pb2.ModelValidationRequest.SerializeToString, ), 'ModelValidationStream': grpc.unary_stream_rpc_method_handler( servicer.ModelValidationStream, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.SerializeToString, + request_deserializer=fedn__pb2.ClientAvailableMessage.FromString, + response_serializer=fedn__pb2.ModelValidation.SerializeToString, ), 'SendModelUpdateRequest': grpc.unary_unary_rpc_method_handler( servicer.SendModelUpdateRequest, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ModelUpdateRequest.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'SendModelUpdate': grpc.unary_unary_rpc_method_handler( servicer.SendModelUpdate, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ModelUpdate.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'SendModelValidationRequest': grpc.unary_unary_rpc_method_handler( servicer.SendModelValidationRequest, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ModelValidationRequest.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), 'SendModelValidation': grpc.unary_unary_rpc_method_handler( servicer.SendModelValidation, - request_deserializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.FromString, - response_serializer=fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.SerializeToString, + request_deserializer=fedn__pb2.ModelValidation.FromString, + response_serializer=fedn__pb2.Response.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'grpc.Combiner', rpc_method_handlers) + 'fedn.Combiner', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) @@ -784,9 +784,9 @@ def ModelUpdateRequestStream(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.Combiner/ModelUpdateRequestStream', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.Combiner/ModelUpdateRequestStream', + fedn__pb2.ClientAvailableMessage.SerializeToString, + fedn__pb2.ModelUpdateRequest.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -801,9 +801,9 @@ def ModelUpdateStream(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.Combiner/ModelUpdateStream', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.Combiner/ModelUpdateStream', + fedn__pb2.ClientAvailableMessage.SerializeToString, + fedn__pb2.ModelUpdate.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -818,9 +818,9 @@ def ModelValidationRequestStream(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.Combiner/ModelValidationRequestStream', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.Combiner/ModelValidationRequestStream', + fedn__pb2.ClientAvailableMessage.SerializeToString, + fedn__pb2.ModelValidationRequest.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -835,9 +835,9 @@ def ModelValidationStream(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/grpc.Combiner/ModelValidationStream', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ClientAvailableMessage.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.FromString, + return grpc.experimental.unary_stream(request, target, '/fedn.Combiner/ModelValidationStream', + fedn__pb2.ClientAvailableMessage.SerializeToString, + fedn__pb2.ModelValidation.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -852,9 +852,9 @@ def SendModelUpdateRequest(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Combiner/SendModelUpdateRequest', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdateRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Combiner/SendModelUpdateRequest', + fedn__pb2.ModelUpdateRequest.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -869,9 +869,9 @@ def SendModelUpdate(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Combiner/SendModelUpdate', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelUpdate.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Combiner/SendModelUpdate', + fedn__pb2.ModelUpdate.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -886,9 +886,9 @@ def SendModelValidationRequest(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Combiner/SendModelValidationRequest', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidationRequest.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Combiner/SendModelValidationRequest', + fedn__pb2.ModelValidationRequest.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @@ -903,8 +903,8 @@ def SendModelValidation(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/grpc.Combiner/SendModelValidation', - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.ModelValidation.SerializeToString, - fedn_dot_common_dot_net_dot_grpc_dot_fedn__pb2.Response.FromString, + return grpc.experimental.unary_unary(request, target, '/fedn.Combiner/SendModelValidation', + fedn__pb2.ModelValidation.SerializeToString, + fedn__pb2.Response.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/fedn/fedn/network/clients/client.py b/fedn/fedn/network/clients/client.py index 9851b32ef..744862065 100644 --- a/fedn/fedn/network/clients/client.py +++ b/fedn/fedn/network/clients/client.py @@ -377,10 +377,17 @@ def upload_request_generator(mdl): b = mdl.read(CHUNK_SIZE) if b: result = fedn.ModelRequest( - data=b, id=id, status=fedn.ModelStatus.IN_PROGRESS) + data=b, + id=id, + status=fedn.ModelStatus.IN_PROGRESS, + sender=fedn.Client(name=self.name, role=fedn.WORKER) + ) else: result = fedn.ModelRequest( - id=id, status=fedn.ModelStatus.OK) + id=id, + status=fedn.ModelStatus.OK, + sender=fedn.Client(name=self.name, role=fedn.WORKER) + ) yield result if not b: @@ -574,11 +581,11 @@ def process_request(self): request.model_id) processing_time = time.time()-tic meta['processing_time'] = processing_time - meta['config'] = request.data if model_id is not None: # Send model update to combiner update = fedn.ModelUpdate() + update.config = request.data update.sender.name = self.name update.sender.role = fedn.WORKER update.receiver.name = request.sender.name diff --git a/fedn/fedn/network/combiner/aggregators/aggregatorbase.py b/fedn/fedn/network/combiner/aggregators/aggregatorbase.py index bcbb699e2..b048a968c 100644 --- a/fedn/fedn/network/combiner/aggregators/aggregatorbase.py +++ b/fedn/fedn/network/combiner/aggregators/aggregatorbase.py @@ -73,7 +73,7 @@ def on_model_update(self, model_update): except Exception as e: self.server.report_status("AGGREGATOR({}): Failed to receive model update! {}".format(self.name, e), log_level=fedn.Status.WARNING) - pass + raise e def _validate_model_update(self, model_update): """ Validate the model update. @@ -84,10 +84,14 @@ def _validate_model_update(self, model_update): :rtype: bool """ # TODO: Validate the metadata to check that it contains all variables assumed by the aggregator. - data = json.loads(model_update.meta)['training_metadata'] - if 'num_examples' not in data.keys(): + meta = json.loads(model_update.meta)['training_metadata'] + if 'num_examples' not in meta.keys(): self.server.report_status("AGGREGATOR({}): Model validation failed, num_examples missing in metadata.".format(self.name)) return False + config = json.loads(model_update.config) + if 'round_id' not in config.keys(): + self.server.report_status("AGGREGATOR({}): Model validation failed, round_id missing in config.".format(self.name)) + return False return True def next_model_update(self, helper): @@ -103,7 +107,7 @@ def next_model_update(self, helper): model_next = self.control.load_model_update(helper, model_id) # Get relevant metadata data = json.loads(model_update.meta)['training_metadata'] - config = json.loads(json.loads(model_update.meta)['config']) + config = json.loads(model_update.config) data['round_id'] = config['round_id'] return model_next, data, model_id diff --git a/fedn/fedn/network/combiner/aggregators/fedavg.py b/fedn/fedn/network/combiner/aggregators/fedavg.py index 0cd15b66a..ebce06b51 100644 --- a/fedn/fedn/network/combiner/aggregators/fedavg.py +++ b/fedn/fedn/network/combiner/aggregators/fedavg.py @@ -78,7 +78,10 @@ def combine_models(self, helper=None, time_window=180, max_nr_models=100, delete self.model_updates.task_done() except Exception as e: self.server.report_status( - "AGGREGATOR({}): Error encoutered while processing model update {}, skipping this update.".format(self.name, e)) + "AGGREGATOR({}): Error encoutered while processing model update, skipping this update. Error: {}".format(self.name, e)) + if model_id: + self.server.report_status( + "AGGREGATOR({}): Error for model update {}".format(self.name, model_id)) self.model_updates.task_done() data['nr_aggregated_models'] = nr_aggregated_models diff --git a/fedn/fedn/network/combiner/modelservice.py b/fedn/fedn/network/combiner/modelservice.py index 7d29d0d00..b2adcecd0 100644 --- a/fedn/fedn/network/combiner/modelservice.py +++ b/fedn/fedn/network/combiner/modelservice.py @@ -16,6 +16,7 @@ class ModelService(rpc.ModelServiceServicer): def __init__(self): self.models = TempModelStorage() + self.name = "ModelService" def exist(self, model_id): """ Check if a model exists on the server. @@ -119,10 +120,12 @@ def upload_request_generator(mdl): b = mdl.read(CHUNK_SIZE) if b: result = fedn.ModelRequest( - data=b, id=id, status=fedn.ModelStatus.IN_PROGRESS) + data=b, id=id, status=fedn.ModelStatus.IN_PROGRESS, + sender=fedn.Client(name=self.name, role=fedn.WORKER)) else: result = fedn.ModelRequest( - id=id, data=None, status=fedn.ModelStatus.OK) + id=id, data=None, status=fedn.ModelStatus.OK, + sender=fedn.Client(name=self.name, role=fedn.WORKER)) yield result if not b: break @@ -141,21 +144,48 @@ def Upload(self, request_iterator, context): :return: A model response object. :rtype: :class:`fedn.common.net.grpc.fedn_pb2.ModelResponse` """ - - result = None for request in request_iterator: + print("ModelRequest (Upload): Processing incoming request from {}".format(request.sender.name), flush=True) if request.status == fedn.ModelStatus.IN_PROGRESS: - self.models.get_ptr(request.id).write(request.data) - self.models.set_meta(request.id, fedn.ModelStatus.IN_PROGRESS) - - if request.status == fedn.ModelStatus.OK and not request.data: - result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.OK, - message="Got model successfully.") - # self.models_metadata.update({request.id: fedn.ModelStatus.OK}) - self.models.set_meta(request.id, fedn.ModelStatus.OK) - self.models.get_ptr(request.id).flush() - self.models.get_ptr(request.id).close() + # Print sender and model id + if request.sender: + print("ModelRequest (Upload): Received {} bytes from {}, ModelStatus.IN_PROGRESS".format( + len(request.data), request.sender.name), flush=True) + try: + self.models.get_ptr(request.id).write(request.data) + self.models.set_meta(request.id, fedn.ModelStatus.IN_PROGRESS) + except Exception as e: + message = "ModelRequest (Upload): Error writing model to file: {}".format(e) + print(message, flush=True) + result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.FAILED, message=message) + return result + + elif request.status == fedn.ModelStatus.OK and not request.data: + if request.sender: + print("ModelRequest (Upload): Received final ModeStatus.OK from {}".format( + request.sender.name), flush=True) + message = "ModelRequest (Upload): Received final ModeStatus.OK" + try: + self.models.set_meta(request.id, fedn.ModelStatus.OK) + self.models.get_ptr(request.id).flush() + self.models.get_ptr(request.id).close() + except Exception as e: + message = "ModelRequest (Upload): Error writing model to file: {}".format(e) + print(message, flush=True) + result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.FAILED, message=message) + return result + result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.OK, message=message) + return result + elif request.status == fedn.ModelStatus.OK and request.data: + message = "ModelRequest (Upload): Internal ERROR, got {} but data still exists in ModelRequest".format(request.status) + print(message, flush=True) + result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.FAILED, message=message) return result + else: + message = "ModelRequest (Upload): Internal ERROR, got unknown ModelStatus {}".format(request.status) + print(message, flush=True) + result = fedn.ModelResponse(id=request.id, status=fedn.ModelStatus.FAILED, message=message) + return result def Download(self, request, context): """ RPC endpoints for downloading a model. diff --git a/fedn/fedn/network/combiner/server.py b/fedn/fedn/network/combiner/server.py index 11d874ea6..a9ebe71b1 100644 --- a/fedn/fedn/network/combiner/server.py +++ b/fedn/fedn/network/combiner/server.py @@ -10,6 +10,8 @@ from datetime import datetime, timedelta from enum import Enum +from grpc import StatusCode + import fedn.common.net.grpc.fedn_pb2 as fedn import fedn.common.net.grpc.fedn_pb2_grpc as rpc from fedn.common.net.grpc.server import Server @@ -649,11 +651,23 @@ def SendHeartbeat(self, heartbeat: fedn.Heartbeat, context): :return: the response :rtype: :class:`fedn.common.net.grpc.fedn_pb2.Response` """ - self.__register_heartbeat(heartbeat.sender) + try: + self.__register_heartbeat(heartbeat.sender) + message = "Heartbeat received from client {}".format( + heartbeat.sender.name) + context.set_details(message) + context.set_code(StatusCode.OK) + except Exception as e: + message = "Failed to register heartbeat: CLIENT: {} INTERNAL ERROR".format(heartbeat.sender.name) + print(message, flush=True) + print(e, flush=True) + context.set_details(message) + context.set_code(StatusCode.INTERNAL) + response = fedn.Response() response.sender.name = heartbeat.sender.name response.sender.role = heartbeat.sender.role - response.response = "Heartbeat received" + response.response = message return response # Combiner Service @@ -694,10 +708,8 @@ def ModelUpdateRequestStream(self, response, context): """ client = response.sender - metadata = context.invocation_metadata() - if metadata: - metadata = dict(metadata) - print("\nClient connected: {}\n".format(metadata['client']), flush=True) + + print("\nClient connected: {}\n".format(client.name), flush=True) status = fedn.Status( status="Client {} connecting to ModelUpdateRequestStream.".format(client.name)) @@ -714,6 +726,11 @@ def ModelUpdateRequestStream(self, response, context): while context.is_active(): try: + # Track time, send heatbeat every 5 seconds + now = datetime.now() + then = self.clients[client.name]["lastseen"] + if (now - then) > timedelta(seconds=5): + self.__register_heartbeat(client) yield q.get(timeout=1.0) except queue.Empty: pass @@ -792,7 +809,7 @@ def SendModelUpdateRequest(self, request, context): return response # TODO Fill later def SendModelUpdate(self, request, context): - """ Send a model update response. + """ Process ModelUpdate message from client and send a model update response. :param request: the request :type request: :class:`fedn.common.net.grpc.fedn_pb2.ModelUpdate` @@ -801,12 +818,26 @@ def SendModelUpdate(self, request, context): :return: the response :rtype: :class:`fedn.common.net.grpc.fedn_pb2.Response` """ - self.control.aggregator.on_model_update(request) - response = fedn.Response() - response.response = "RECEIVED ModelUpdate {} from client {}".format( - response, response.sender.name) - return response # TODO Fill later + message = "SendModelUpdate: ModelUpdate {} from client {}".format( + request.model_id, + request.sender.name + ) + print(message, flush=True) + print("SendModelUpdate: LocalModelUpdateID {} from client {}".format( + request.model_update_id, + request.sender.name + ), flush=True + ) + try: + self.control.aggregator.on_model_update(request) + except Exception as e: + print("SendModelUpdate: Failed to process model update: {}".format(e), flush=True) + message = "SERVER ERROR: Failed to process model update" + pass + + response.response = message + return response def SendModelValidationRequest(self, request, context): """ Send a model validation request. diff --git a/fedn/setup.py b/fedn/setup.py index 0adcd8e8e..073699b22 100644 --- a/fedn/setup.py +++ b/fedn/setup.py @@ -15,7 +15,7 @@ "urllib3>=1.26.4", "minio", "python-slugify", - "grpcio~=1.48.0", + "grpcio~=1.57.0", "grpcio-tools", "numpy>=1.21.6", "protobuf",