A simpler progress monitor
This consists of a single class LoopProgressMonitor that you instantiate right before a loop and then call inside the loop. It monitors how long each iteration is taking and issues a forecast of when the loop will conclude based on the number of iterations remaining and the average time per iteration so far. It prints a new predicted end time only when the most recent forecast falls too far from its internal estimate modulo some tolerance.
Python 3 with the following modules: math, time
From pypi: pip install when_will_it_end
Alternatively, clone thesourceand - cd when_will_it_end - python setup.py install
import numpy as np import time import when_will_it_end as wwie number_of_iterations = 10 print('Starting time: ' + wwie.format_time(time.time())) lpm = wwie.LoopProgressMonitor(n = number_of_iterations) for k in range(number_of_iterations): lpm() _ = np.random.uniform(0,1,size=100000000) print('Actual ending time: ' + wwie.format_time(time.time()))
Starting time: 18:04:42 Starting first of 10 iterations ... Est. total 18.0 seconds, finish 18:05:00 after 9 iters at 1.8 sec/iter Est. total 20.0 seconds, finish 18:05:02 after 6 iters at 2.0 sec/iter Actual ending time: 18:05:01
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size when_will_it_end-0.0.2.tar.gz (2.7 kB)||File type Source||Python version None||Upload date||Hashes View hashes|