From 2ed4793ca74df41538cbc8fa70f71a2288f3be58 Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Tue, 5 Dec 2023 15:18:28 +0000 Subject: [PATCH] fix lacking request.sender --- fedn/fedn/network/clients/client.py | 2 ++ fedn/fedn/network/combiner/modelservice.py | 4 ++-- fedn/fedn/network/combiner/server.py | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fedn/fedn/network/clients/client.py b/fedn/fedn/network/clients/client.py index c8c4ac020..4769c371e 100644 --- a/fedn/fedn/network/clients/client.py +++ b/fedn/fedn/network/clients/client.py @@ -444,6 +444,8 @@ def _listen_to_model_update_request_stream(self): while self._attached: try: for request in self.combinerStub.ModelUpdateRequestStream(r, metadata=self.metadata): + if request: + logger.debug("Received model update request from combiner: {}.".format(request)) if request.sender.role == fedn.COMBINER: # Process training request self._send_status("Received model update request.", log_level=fedn.Status.AUDIT, diff --git a/fedn/fedn/network/combiner/modelservice.py b/fedn/fedn/network/combiner/modelservice.py index e851e0086..6d1ffa78f 100644 --- a/fedn/fedn/network/combiner/modelservice.py +++ b/fedn/fedn/network/combiner/modelservice.py @@ -142,7 +142,7 @@ def Upload(self, request_iterator, context): :return: A model response object. :rtype: :class:`fedn.common.net.grpc.fedn_pb2.ModelResponse` """ - logger.info("grpc.ModelService.Upload: Called") + logger.debug("grpc.ModelService.Upload: Called") result = None for request in request_iterator: if request.status == fedn.ModelStatus.IN_PROGRESS: @@ -168,7 +168,7 @@ def Download(self, request, context): :return: A model response iterator. :rtype: :class:`fedn.common.net.grpc.fedn_pb2.ModelResponse` """ - logger.info("grpc.ModelService.Download: Called") + logger.debug("grpc.ModelService.Download: Called") try: if self.models.get_meta(request.id) != fedn.ModelStatus.OK: logger.warning("Error file is not ready") diff --git a/fedn/fedn/network/combiner/server.py b/fedn/fedn/network/combiner/server.py index e90c998fd..0d1cb09ec 100644 --- a/fedn/fedn/network/combiner/server.py +++ b/fedn/fedn/network/combiner/server.py @@ -170,6 +170,9 @@ def request_model_update(self, config, clients=[]): request.timestamp = str(datetime.now()) request.data = json.dumps(config) + request.sender.name = self.id + request.sender.role = fedn.COMBINER + if len(clients) == 0: clients = self.get_active_trainers() @@ -207,7 +210,7 @@ def request_model_validation(self, model_id, config, clients=[]): clients = self.get_active_validators() for client in clients: - request.receiver.name = client.name + request.receiver.name = client request.receiver.role = fedn.WORKER self._put_request_to_client_queue(request, fedn.Channel.MODEL_VALIDATION_REQUESTS) @@ -403,7 +406,7 @@ def FlushAggregationQueue(self, control: fedn.ControlRequest, context): :return: the control response :rtype: :class:`fedn.common.net.grpc.fedn_pb2.ControlResponse` """ - logger.info("grpc.Combiner.FlushAggregationQueue: Called") + logger.debug("grpc.Combiner.FlushAggregationQueue: Called") status = self._flush_model_update_queue() response = fedn.ControlResponse()