AbsoluteETA¶
AbsoluteETA shows the wall-clock time the run is expected to finish.
Reach for it when the audience cares about when the job will finish (“done around 14:32:07”) rather than a countdown duration. Every other ETA widget in this reference reports a remaining-time span instead.
- class progressbar.widgets.AbsoluteETA(format_not_started='Estimated finish time: ----/--/-- --:--:--', format_finished='Finished at: %(elapsed)s', format='Estimated finish time: %(eta)s', **kwargs)[source]
Bases:
ETAWidget which attempts to estimate the absolute time of arrival.
Create an AbsoluteETA with clock-time-flavoured defaults.
Example¶
"""``AbsoluteETA`` shows the wall-clock time the run is expected to finish.
Reach for it when the audience cares about *when* the job will finish
("done around 14:32:07") rather than a countdown duration -- every other
ETA widget in this reference reports a remaining-time span instead. This
example runs longer than most in this set: the estimate is only shown to
whole-second resolution, so a bar that finishes in a fraction of a second
never accumulates enough elapsed time for the projected finish time to
visibly move.
"""
import time
import progressbar
STEPS = 30
def main() -> None:
widgets = [
progressbar.Percentage(),
' ',
progressbar.Bar(),
' ',
progressbar.AbsoluteETA(),
]
with progressbar.ProgressBar(max_value=STEPS, widgets=widgets) as bar:
for step in range(STEPS):
bar.update(step + 1)
time.sleep(0.2)
if __name__ == '__main__':
main()
See also¶
ETA: the whole-run-average countdown behind this clock time.
AdaptiveETA: a countdown that reacts to recent pace instead.
SmoothingETA: a countdown smoothed with an exponential moving average.