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

Increase the timing precision of progress bar #819

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

dachengx
Copy link
Collaborator

@dachengx dachengx commented Apr 9, 2024

What is the problem / what does the code in this PR do

To solve #816

Can you briefly describe how it works?

Can you give a minimal working example (or illustrate with a figure)?

Please include the following if applicable:

  • Update the docstring(s)
  • Update the documentation
  • Tests to check the (new) code is working as desired.
  • Does it solve one of the open issues on github?

Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).

@coveralls
Copy link

coveralls commented Apr 9, 2024

Coverage Status

coverage: 91.494% (+0.001%) from 91.493%
when pulling f9a185e on high_precision_pbar
into a1e921f on master.

@dachengx dachengx requested a review from yuema137 April 9, 2024 21:01
Copy link
Collaborator

@yuema137 yuema137 left a comment

Choose a reason for hiding this comment

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

@dachengx Thanks for this PR and thanks for catching this issue @zaitsev136
Looking at #816 and this PR, I agree that it's a better solution to use an independent attribute. The last_print_t is an attribute provided by tqdm which is updated with time.time in __iter__. So when we do

yield result
or
pbar.update(0)

The pbar.last_print_t will be overwritten by time.time. As we don't want to touch the inner side of tqdm it's good to separate the high-resolution time calculation with a different one.

@dachengx dachengx marked this pull request as ready for review April 9, 2024 21:39
@dachengx
Copy link
Collaborator Author

dachengx commented Apr 9, 2024

Let's wait for @zaitsev136 's review.

@zaitsev136
Copy link

Looking good, thanks a lot for looking into this

@dachengx
Copy link
Collaborator Author

dachengx commented Apr 9, 2024

Looking good, thanks a lot for looking into this

Will this PR solve the error you saw?

@zaitsev136
Copy link

yes, it will

@dachengx dachengx merged commit 0728d2c into master Apr 9, 2024
9 checks passed
@dachengx dachengx deleted the high_precision_pbar branch April 9, 2024 21:57
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.

4 participants