progress
progress copied to clipboard
ETA constantly shows <1min remaining during a 1+ hour process
I know from Windows 95 not to put too much faith in ETAs, but this is consistently and obviously wrong! progress
1.4 will show an ETA of at most a few minutes, even when it is 50% of the way through a large hour-long process. Is there some timing module that it needs to work more reliably?
I am using it with requests
and humanize
to show a progress bar for HTTP PUT requests of large files:
class HumanBar(ChargingBar):
@property
def eta_human(self):
return humanize.naturaldelta(self.eta)
@property
def max_human(self):
return humanize.naturalsize(self.max, binary=True)
class MonitoredFile(object):
def __init__(self, handle, size=0, callback=None):
self.len = size
self.handle = handle
self.callback = callback
self.total = 0
self.bar = HumanBar('Uploading %(max_human)s: ', max=size, fill='>', suffix='%(percent)d%% ETA %(eta_human)s ')
def __len__(self):
return self.len
def read(self, *args):
chunk = self.handle.read(*args)
if len(chunk) > 0:
self.total += len(chunk)
self.bar.next(len(chunk))
if self.callback:
self.callback(len(chunk), self.total, self.len)
return chunk
The percentage is accurate, but the ETA isn't even close...