Skip to content
Permalink
Browse files

feat(client): abstract query_callback

  • Loading branch information...
hanxiao committed Sep 11, 2019
1 parent 31c796d commit 621c06b326f4ca5ff2df2ec6cef0176aa5dc8ab2
Showing with 4 additions and 5 deletions.
  1. +4 −5 gnes/client/cli.py
@@ -50,18 +50,17 @@ def query(self, all_bytes: List[bytes]):
for idx, q in enumerate(all_bytes):
for req in RequestGenerator.query(q, request_id_start=idx, top_k=self.args.top_k):
resp = self._stub.Call(req)
self.query_callback(resp, req)
self.query_callback(req, resp)

@staticmethod
def query_callback(resp: 'gnes_pb2.Response', query: 'gnes_pb2.Request'):
def query_callback(self, req: 'gnes_pb2.Request', resp: 'gnes_pb2.Response'):
"""
callback after get the query result
override this method to customize query behavior
:param resp: response
:param query: query
:param req: query
:return:
"""
print(query)
print(req)
print(resp)

def read_all(self) -> List[bytes]:

0 comments on commit 621c06b

Please sign in to comment.
You can’t perform that action at this time.