-
Notifications
You must be signed in to change notification settings - Fork 64
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
Conversation
@@ -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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Codecov ReportAttention:
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/neptune/api/searching_entries.py
Outdated
|
||
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 |
There was a problem hiding this comment.
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 <=
?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Magic numbers 🛑
- Looks like
content-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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Before submitting checklist