Skip to content

Commit

Permalink
fix lacking request.sender
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrede committed Dec 5, 2023
1 parent 30f5e74 commit 2ed4793
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions fedn/fedn/network/clients/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions fedn/fedn/network/combiner/modelservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand Down
7 changes: 5 additions & 2 deletions fedn/fedn/network/combiner/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2ed4793

Please sign in to comment.