-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Communication efficiency optimization (#19)
* minor fixed for distributed mode * For the communication efficiency: dynamic type selection in gRPC servicer; transformer & parser
- Loading branch information
1 parent
e62db55
commit d5adb81
Showing
11 changed files
with
242 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import queue | ||
from collections import deque | ||
|
||
from federatedscope.core.proto import gRPC_comm_manager_pb2, gRPC_comm_manager_pb2_grpc | ||
|
||
|
||
class gRPCComServeFunc(gRPC_comm_manager_pb2_grpc.gRPCComServeFuncServicer): | ||
def __init__(self): | ||
self.msg_queue = queue.Queue() | ||
self.msg_queue = deque() | ||
|
||
def sendMessage(self, request, context): | ||
self.msg_queue.put(request) | ||
self.msg_queue.append(request) | ||
|
||
return gRPC_comm_manager_pb2.MessageResponse(msg='ACK') | ||
|
||
def receive(self): | ||
while self.msg_queue.empty(): | ||
while len(self.msg_queue) == 0: | ||
continue | ||
msg = self.msg_queue.get() | ||
msg = self.msg_queue.popleft() | ||
return msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.