-
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.
For the communication efficiency: dynamic type selection in gRPC serv…
…icer; transformer & parser
- Loading branch information
1 parent
869e491
commit 9b0b0bc
Showing
7 changed files
with
224 additions
and
125 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
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.