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

perf: reusing the inner httpx client #1640

Merged
merged 7 commits into from Aug 2, 2022

Conversation

frascuchon
Copy link
Member

@frascuchon frascuchon commented Jul 26, 2022

This PR introduces the changes to the API client to reuse the internal httpx client for several requests. These changes could help to mitigate some reported errors related to this issue encode/httpx#1027

Also, stop creating new threads after the utils.py::setup_loop_in_thread is called.

Closes #1646
Refs: The Slack thread

@frascuchon frascuchon changed the title Perf/reusing httpx client on load perf: reusing httpx client on load Jul 26, 2022
@frascuchon frascuchon self-assigned this Jul 26, 2022
@frascuchon frascuchon added this to In progress in Release via automation Jul 26, 2022
@frascuchon frascuchon added this to the v0.17.0 milestone Jul 26, 2022
@frascuchon frascuchon changed the title perf: reusing httpx client on load perf: reusing the inner httpx client Jul 26, 2022
@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #1640 (5c7b3da) into master (843f06d) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1640      +/-   ##
==========================================
- Coverage   95.59%   95.52%   -0.08%     
==========================================
  Files         133      133              
  Lines        6339     6346       +7     
==========================================
+ Hits         6060     6062       +2     
- Misses        279      284       +5     
Flag Coverage Δ
pytest 95.52% <100.00%> (-0.08%) ⬇️

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

Impacted Files Coverage Δ
src/rubrix/client/api.py 95.98% <100.00%> (-0.02%) ⬇️
src/rubrix/client/sdk/client.py 95.23% <100.00%> (+0.41%) ⬆️
src/rubrix/client/sdk/text2text/api.py 100.00% <100.00%> (ø)
src/rubrix/client/sdk/text_classification/api.py 100.00% <100.00%> (ø)
src/rubrix/client/sdk/token_classification/api.py 100.00% <100.00%> (ø)
src/rubrix/client/sdk/users/api.py 100.00% <100.00%> (ø)
src/rubrix/utils.py 100.00% <100.00%> (ø)
src/rubrix/client/sdk/commons/errors_handler.py 89.65% <0.00%> (-6.90%) ⬇️
...ubrix/labeling/text_classification/label_errors.py 86.74% <0.00%> (-3.62%) ⬇️

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 843f06d...5c7b3da. Read the comment docs.

@frascuchon frascuchon removed this from the v0.17.0 milestone Jul 28, 2022
@frascuchon frascuchon moved this from In progress to Pending Review in Release Aug 1, 2022
@frascuchon frascuchon merged commit f9a80cc into master Aug 2, 2022
Release automation moved this from Pending Review to Waiting Release Aug 2, 2022
@frascuchon frascuchon deleted the perf/reusing-httpx-client-on-load branch August 2, 2022 13:39
@frascuchon frascuchon removed this from Waiting Release in Release Aug 18, 2022
frascuchon added a commit that referenced this pull request Aug 18, 2022
frascuchon added a commit that referenced this pull request Aug 22, 2022
frascuchon added a commit that referenced this pull request Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running several rb.init on same process will hit too many open files error
1 participant