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

ETA constantly shows <1min remaining during a 1+ hour process #62

Open
howardjones opened this issue Jan 7, 2019 · 0 comments
Open

Comments

@howardjones
Copy link

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...

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

No branches or pull requests

1 participant