Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix client concurrent issue #752

Merged
merged 5 commits into from
Jun 14, 2022
Merged

fix: fix client concurrent issue #752

merged 5 commits into from
Jun 14, 2022

Conversation

ZiniuYu
Copy link
Member

@ZiniuYu ZiniuYu commented Jun 13, 2022

In the original client implementation, it uses a global result variable to store all results from the server. This may break with the async client in that it can not distinguish the source of input and thus mix all concurrent requests and return the wrong results.

This PR fixes the above issue.

@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #752 (023ef7f) into main (e022bd4) will increase coverage by 1.37%.
The diff coverage is 96.66%.

@@            Coverage Diff             @@
##             main     #752      +/-   ##
==========================================
+ Coverage   80.41%   81.78%   +1.37%     
==========================================
  Files          17       17              
  Lines        1205     1208       +3     
==========================================
+ Hits          969      988      +19     
+ Misses        236      220      -16     
Flag Coverage Δ
cas 81.78% <96.66%> (+1.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/clip_client/client.py 88.33% <96.42%> (+2.45%) ⬆️
client/clip_client/__init__.py 100.00% <100.00%> (ø)
server/clip_server/__init__.py 100.00% <100.00%> (ø)
server/clip_server/model/simple_tokenizer.py 94.89% <0.00%> (+1.02%) ⬆️
server/clip_server/executors/clip_hg.py 86.07% <0.00%> (+2.53%) ⬆️
server/clip_server/executors/clip_onnx.py 85.48% <0.00%> (+3.22%) ⬆️
server/clip_server/model/clip.py 86.42% <0.00%> (+3.57%) ⬆️
server/clip_server/executors/clip_torch.py 87.03% <0.00%> (+3.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5ab22f...023ef7f. Read the comment docs.

client/clip_client/client.py Outdated Show resolved Hide resolved

def _gather_result(self, r):
def _gather_result(self, r, results):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _gather_result(self, r, results):
def _gather_result(self, response, results: 'DocumentArray'):

def _unboxed_result(self):
if self._results.embeddings is None:
@staticmethod
def _unboxed_result(results, return_plain):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _unboxed_result(results, return_plain):
def _unboxed_result(results, return_plain: bool):

@ZiniuYu ZiniuYu requested a review from numb3r3 June 14, 2022 05:48
client/clip_client/client.py Outdated Show resolved Hide resolved
client/clip_client/client.py Outdated Show resolved Hide resolved
Copy link
Member

@numb3r3 numb3r3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@numb3r3 numb3r3 merged commit b5c339f into main Jun 14, 2022
@numb3r3 numb3r3 deleted the fix-client-concurrent branch June 14, 2022 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants