From 3ed5643d61674ae066ce24f0076d35756e7004eb Mon Sep 17 00:00:00 2001 From: benjaminastrand Date: Wed, 4 Dec 2024 12:37:42 +0100 Subject: [PATCH 1/2] Replace WORKER with CLIENT --- src/grpc.cpp | 20 ++++++++++---------- src/protos/fedn.proto | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/grpc.cpp b/src/grpc.cpp index 9fd4305..3abe535 100644 --- a/src/grpc.cpp +++ b/src/grpc.cpp @@ -25,7 +25,7 @@ using fedn::ModelStatus; using fedn::StatusType; using fedn::Client; using fedn::ClientAvailableMessage; -using fedn::WORKER; +using fedn::CLIENT; using fedn::Response; /** @@ -58,7 +58,7 @@ void GrpcClient::heartBeat() { // Data we are sending to the server. Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); Heartbeat request; @@ -104,7 +104,7 @@ void GrpcClient::connectTaskStream() { // Data we are sending to the server. Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); ClientAvailableMessage request; @@ -162,7 +162,7 @@ std::string GrpcClient::downloadModel(const std::string& modelID) { // Set client Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); // Pass ownership of client to protobuf message @@ -231,7 +231,7 @@ void GrpcClient::downloadModelToFile(const std::string& modelID, const std::stri // Set client Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); // Pass ownership of client to protobuf message @@ -305,7 +305,7 @@ void GrpcClient::uploadModel(std::string& modelID, std::string& modelData) { // Client Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); // Get ClientWriter from stream @@ -384,7 +384,7 @@ void GrpcClient::uploadModelFromFile(const std::string& modelID, const std::stri // Client Client* client = new Client(); client->set_name(name_); - client->set_role(WORKER); + client->set_role(CLIENT); client->set_client_id(id_); // Get ClientWriter from stream @@ -639,7 +639,7 @@ void GrpcClient::sendModelUpdate(const std::string& modelID, std::string& modelU // Send model update response to server Client client; client.set_name(name_); - client.set_role(WORKER); + client.set_role(CLIENT); client.set_client_id(id_); @@ -698,7 +698,7 @@ void GrpcClient::sendModelValidation(const std::string& modelID, json& metricDat // Send model validation response to server Client client; client.set_name(name_); - client.set_role(WORKER); + client.set_role(CLIENT); client.set_client_id(id_); ModelValidation validation; @@ -756,7 +756,7 @@ void GrpcClient::sendModelPrediction(const std::string& modelID, json& predictio // Send model prediction response to server Client client; client.set_name(name_); - client.set_role(WORKER); + client.set_role(CLIENT); client.set_client_id(id_); ModelPrediction prediction; diff --git a/src/protos/fedn.proto b/src/protos/fedn.proto index fa98591..64a4a95 100644 --- a/src/protos/fedn.proto +++ b/src/protos/fedn.proto @@ -149,10 +149,10 @@ message ClientList { } enum Role { - WORKER = 0; - COMBINER = 1; - REDUCER = 2; - OTHER = 3; + OTHER = 0; + CLIENT = 1; + COMBINER = 2; + REDUCER = 3; } message Client { From 83cf61e8fcc73129fc8aa109a341e82b929c388f Mon Sep 17 00:00:00 2001 From: benjaminastrand Date: Wed, 4 Dec 2024 13:12:13 +0100 Subject: [PATCH 2/2] Add StatusType NETWORK and move LogLevel outside of Status message --- src/protos/fedn.proto | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/protos/fedn.proto b/src/protos/fedn.proto index 64a4a95..825a252 100644 --- a/src/protos/fedn.proto +++ b/src/protos/fedn.proto @@ -15,20 +15,21 @@ enum StatusType { MODEL_VALIDATION_REQUEST = 3; MODEL_VALIDATION = 4; MODEL_PREDICTION = 5; + NETWORK = 6; +} + +enum LogLevel { + NONE = 0; + INFO = 1; + DEBUG = 2; + WARNING = 3; + ERROR = 4; + AUDIT = 5; } message Status { Client sender = 1; string status = 2; - - enum LogLevel { - INFO = 0; - DEBUG = 1; - WARNING = 2; - ERROR = 3; - AUDIT = 4; - } - LogLevel log_level = 3; string data = 4; string correlation_id = 5;