Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(client): abstract query_callback
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Sep 11, 2019
1 parent 31c796d commit 621c06b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gnes/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 621c06b

Please sign in to comment.