-
Notifications
You must be signed in to change notification settings - Fork 259
Fixes issue #580 #722
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
base: main
Are you sure you want to change the base?
Fixes issue #580 #722
Conversation
Simplify ProgressState.duration() function to show the duration regardless of if there is no progress or if the progressbar is finished. Rename Estimator.prev_steps to steps_done for increased readability
…as been made in a way where every second could be the second progress gets made so we assume each step needed will take that much time. This shows in an ETA that grows while no progress has been made after starting a progress bar and settles when the first step is made. The "sanity check" in Estimator.record() function needed to be removed for this since it prohibited any updates to Estimator parameters if no progress had been made. The ProgressState.eta() now also includes the time passed since last progress was made in it's ETA calculations and that is what makes the ETA counter count down. Add sec_per_step to Estimator which is an estimate for how many seconds each step takes. Also included sec_per_step in the Estimator.reset() function. Update Estimator.record() function to keep returning the same estimate for how many seconds each step takes even though no progress has been made. This is done so that the ProgressState.eta() function will keep counting down the actual estimated time. An exception is if the time since the last progress is more than the average time per step then we increase the estimate for how many seconds each step takes by 2% everytime Estimator.record() functino is called. This shows an increase in the ETA at a rate that is much more conservative than the previous rate and in the case of no progress being possible (for example if the progress is for a transmission and the router is unplugged) then the user will clearly see the ETA rise with no hope of it going down. In the case that progress does get done (somebody plugged the router back in) then the actual time it took for progress to be made is used to estimate the time for future steps. These changes make the parameters Estimator.smoothed_steps_per_sec and Estimator.double_smoothed_steps_per_sec obsolete and unnecessary as well as some functions potentially, like Estimator.steps_per_second() which uses this double exponential smoothing and seems to be only used in the tests/examples and also in the ProgressBar.per_sec() function which I don't know how much is used so I left everything related to these parameters untouched.
@djc How is this? |
It's on my list -- not sure when I'll be able to get to it, but pretty sure I will at some point. |
Great, yeah no stress from my part. |
There were apparently 2 places I missed with the |
Apparently the |
Here is a new and improved pull request which contains 2 commits.
The first one is from when I was mostly gaining understanding of the code and the second one contains the changes I implemented.
Here is the old pull request:
#721
This should fix issue #580
Detailed explanation
Change ProgressState.eta() function to show ETA before any progress has been made in a way where every second could be the second progress gets made so we assume each step needed will take that much time. This shows in an ETA that grows while no progress has been made after starting a progress bar and settles when the first step is made.
The "sanity check" in Estimator.record() function needed to be removed for this since it prohibited any updates to Estimator parameters if no progress had been made.
The ProgressState.eta() now also includes the time passed since last progress was made in it's ETA calculations and that is what makes the ETA counter count down.
Add sec_per_step to Estimator which is an estimate for how many seconds each step takes.
Also included sec_per_step in the Estimator.reset() function.
Update Estimator.record() function to keep returning the same estimate for how many seconds each step takes even though no progress has been made. This is done so that the ProgressState.eta() function will keep counting down the actual estimated time.
An exception is if the time since the last progress is more than the average time per step then we increase the estimate for how many seconds each step takes by 2% everytime Estimator.record() functino is called. This shows an increase in the ETA at a rate that is much more conservative than the previous rate and in the case of no progress being possible (for example if the progress is for a transmission and the router is unplugged) then the user will clearly see the ETA rise with no hope of it going down. In the case that progress does get done (somebody plugged the router back in) then the actual time it took for progress to be made is used to estimate the time for future steps.
These changes make the parameters Estimator.smoothed_steps_per_sec and Estimator.double_smoothed_steps_per_sec obsolete and unnecessary as well as some functions potentially, like Estimator.steps_per_second() which uses this double exponential smoothing and seems to be only used in the tests/examples and also in the ProgressBar.per_sec() function which I don't know how much is used so I left everything related to these parameters untouched.