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

feat: set prefetch in client for traffic control #897

Merged
merged 8 commits into from
Mar 7, 2023
Merged

Conversation

ZiniuYu
Copy link
Member

@ZiniuYu ZiniuYu commented Mar 2, 2023

In this PR, we introduce the prefetch in client for traffic control.
This is especially beneficial to large and time consuming requests which can be unexpectedly be closed be remote server and cause timeout watchdog issue.
This PR also disables uploading progress bar that is not compatible with prefetching 🙁
For more info about client prefetching, please view https://docs.jina.ai/concepts/client/rate-limit/

@github-actions github-actions bot added size/xs and removed size/s labels Mar 2, 2023
@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Merging #897 (4125016) into main (d70f238) will decrease coverage by 11.10%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main     #897       +/-   ##
===========================================
- Coverage   82.70%   71.61%   -11.10%     
===========================================
  Files          23       23               
  Lines        1567     1564        -3     
===========================================
- Hits         1296     1120      -176     
- Misses        271      444      +173     
Flag Coverage Δ
cas 71.61% <100.00%> (-11.10%) ⬇️

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

Impacted Files Coverage Δ
client/clip_client/client.py 87.57% <100.00%> (+0.18%) ⬆️
server/clip_server/executors/clip_tensorrt.py 0.00% <0.00%> (-94.60%) ⬇️
server/clip_server/model/clip_trt.py 0.00% <0.00%> (-85.72%) ⬇️
server/clip_server/model/trt_utils.py 0.00% <0.00%> (-83.52%) ⬇️
server/clip_server/model/clip_onnx.py 87.30% <0.00%> (+22.22%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions github-actions bot added size/s and removed size/xs labels Mar 3, 2023
@ZiniuYu ZiniuYu changed the title fix: set prefetch in client for traffic control feat: set prefetch in client for traffic control Mar 3, 2023
@ZiniuYu ZiniuYu requested review from girishc13 and a team March 3, 2023 04:49
@numb3r3
Copy link
Member

numb3r3 commented Mar 3, 2023

Could you give an example of the new progress bar after this PR?

client/clip_client/client.py Outdated Show resolved Hide resolved
@ZiniuYu
Copy link
Member Author

ZiniuYu commented Mar 3, 2023

@numb3r3
image

@@ -334,6 +341,7 @@ def encode(self, content, **kwargs):
on_error=on_error,
on_always=partial(self._update_pbar, func=on_always),
parameters=parameters,
prefetch=prefetch,
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just inline the code like: prefecth=kwargs.get('prefetch', 1000). You can reduce the number of lines if you do this to other params also.

@numb3r3
Copy link
Member

numb3r3 commented Mar 3, 2023

@ZiniuYu From the example bar, I would suggest changing Recv to Progress.

@ZiniuYu ZiniuYu closed this Mar 3, 2023
@ZiniuYu ZiniuYu reopened this Mar 3, 2023
@numb3r3 numb3r3 marked this pull request as ready for review March 6, 2023 05:51
@ZiniuYu
Copy link
Member Author

ZiniuYu commented Mar 7, 2023

@numb3r3
image

@numb3r3 numb3r3 closed this Mar 7, 2023
@numb3r3 numb3r3 reopened this Mar 7, 2023
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

📝 Docs are deployed on https://ft-fix-client-prefetch--jina-docs.netlify.app 🎉

@numb3r3 numb3r3 merged commit cce3b05 into main Mar 7, 2023
@numb3r3 numb3r3 deleted the fix-client-prefetch branch March 7, 2023 07:25
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.

3 participants