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

Disable progress bar for small fetchings #1638

Merged
merged 7 commits into from
Feb 8, 2024

Conversation

AleksanderWWW
Copy link
Contributor

@AleksanderWWW AleksanderWWW commented Feb 8, 2024

Before submitting checklist

  • Did you update the CHANGELOG? (not for test updates, internal changes/refactors or CI/CD setup)
  • Did you ask the docs owner to review all the user-facing changes?

@@ -1094,7 +1094,7 @@ def search_leaderboard_entries(
sort_by=sort_by,
ascending=ascending,
sort_by_column_type=sort_by_column_type,
progress_bar=progress_bar,
progress_bar=False if limit < default_step_size else progress_bar,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If limit is smaller than the default_step_size then it means that we will not fetch even a "full" single page, so no need to construct a progress bar for that

Copy link
Contributor

Choose a reason for hiding this comment

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

But as we're always fetching the total number of matching entries -> is it needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe that's not a reason but for instance if you would like to use step_size=1 so you would like to show progress bar even there are 2 entries to fetch 😉 much less than default step size.

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (b63b69b) 80.69% compared to head (abbc302) 74.54%.
Report is 3 commits behind head on master.

Files Patch % Lines
...eptune/internal/backends/hosted_file_operations.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1638      +/-   ##
==========================================
- Coverage   80.69%   74.54%   -6.15%     
==========================================
  Files         303      303              
  Lines       15387    15104     -283     
==========================================
- Hits        12416    11259    -1157     
- Misses       2971     3845     +874     
Flag Coverage Δ
e2e ?
e2e-management ?
e2e-s3 ?
e2e-s3-gcs ?
e2e-standard ?
macos 73.96% <33.33%> (-6.47%) ⬇️
py3.10 ?
py3.7 74.29% <33.33%> (-5.97%) ⬇️
py3.7.16 ?
py3.8 ?
py3.9 ?
ubuntu 74.15% <33.33%> (-6.20%) ⬇️
unit 74.29% <33.33%> (-0.58%) ⬇️
windows 73.49% <33.33%> (-6.64%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AleksanderWWW AleksanderWWW requested a review from Raalsky February 8, 2024 10:30

progress_bar = progress_bar if step_size >= total else None
progress_bar = False if total < step_size else progress_bar # disable progress bar if only one page is fetched
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% sure but shouldn't it be <=?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -481,6 +481,9 @@ def _store_response_as_file(
target_file = destination

total_size = int(response.headers.get("content-length", 0))

progress_bar = False if total_size < 1024 * 1024 else progress_bar # less than one chunk
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Magic numbers 🛑
  2. Looks likecontent-length may not be provided. If I understand correctly this doesn't mean that the file is empty; rather it's not possible to determine the target size. In such a case we should probably show the progress bar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@AleksanderWWW AleksanderWWW merged commit 6d65cea into master Feb 8, 2024
4 checks passed
@AleksanderWWW AleksanderWWW deleted the aw/no-bar-small-projects branch February 8, 2024 11:55
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.

2 participants