Comments (8)
Thank you for the compliments and the detailed issue! Very helpful :)
Your ETA issue is because there are probably not enough samples for you case.
By default the progressbar will use an AdaptiveETA
:
python-progressbar/progressbar/bar.py
Line 745 in 6b0e48e
The AdaptiveETA
will use 2 seconds of samples:
python-progressbar/progressbar/widgets.py
Line 393 in 6b0e48e
For regular progressbars that is usually enough without storing too many values in memory, but in your case I think you want to increase that number significantly :)
This can be done using the widget_kwargs
to the ProgressBar
or by specifying the widgets completely manually. In the case of widget_kwargs
:
self._bars.append(
progressbar.ProgressBar(fd=BarStreamWrapper(0), prefix='Chunks: ', max_value=num_chunks, poll_interval=5, min_poll_interval=5,
widget_kwargs=dict(samples=datetime.timedelta(minutes=10)),
)
There might be an alternative as well however. I am currently working on a newer version (only available on the develop branch right now) which features an automatic MultiBar
class that re-renders the progressbars continuously regardless of the regular update intervals:
https://github.com/wolph/python-progressbar#multiple-threaded-progressbars
With regard to the poll_interval
and min_poll_interval
, those are used for visual updates because writing to the terminal is the slowest part of the progressbar.
For time sensitive widgets the INTERVAL
constant of the widget itself is what decides the interval:
python-progressbar/progressbar/widgets.py
Line 298 in 6b0e48e
from python-progressbar.
In fact, I have total_chunk_count, num_chunks, and num_completed_chunks. I can estimate the ETA from these. I also have a datetime object around to measure timing. So:
secs = (datetime.now() - start_time).total_seconds()
avg = secs / num_completed_chunks # assumes num_completed_chunks > 0 for the sake of the example
eta_secs = avg * (num_chunks - num_completed_chunks)
I need a way to override the ETA with a CustomETA class as far as I understand, like in here. But how can I pass these parameters to the Widget?
from python-progressbar.
Thank you for the detailed help and pointers @wolph ... I was just looking at the AdaptiveETA code... I'll try the widged_kwargs argument right away.
I read about MultiBar but could not find it, this is why :) Eagerly waiting for a new version!
from python-progressbar.
Should it read:
widget_kwargs={'interval': timedelta(minutes=5)}
from python-progressbar.
Oops... I didn't read correctly. It's the samples
argument: widget_kwargs=dict(samples=datetime.timedelta(minutes=10)),
from python-progressbar.
Oh. I thought samples
was for the number of samples for ETA calc...
Can I change these during runtime (not only during creating the object) - so that I can make it adaptive?
from python-progressbar.
Yes, you can change the variable whenever you wish. It should also be noted that you can use either an integer as a specific number of samples (depending on how often the chunks
bar is updated) or a timedelta
with a specific time interval.
from python-progressbar.
That clarifies it, thanks...
BTW, it works much better now :)
from python-progressbar.
Related Issues (20)
- progressbar suddenly throwing 'function' object has no attribute 'ProgressBar' HOT 2
- Not sure how to go about doing this HOT 4
- outdatated progress bar? HOT 1
- ETA does not honor empty `format_finished` HOT 5
- Replace the moving average algorithm
- Not an issue but an idea HOT 4
- MultiBar does not work if any of the node has an empty string as key HOT 1
- Colored markers HOT 7
- `cli-name` executable refers to non-existing Python module HOT 4
- 4.3.0: Windows OS: TypeError: '_fields_' must be a sequence of (name, C type) pairs HOT 3
- Progressbar update creates multiple lines HOT 19
- ProgressBar update no longer works with floats. HOT 3
- version 4.4: interactive shell: arrow keys yield weird symbols HOT 11
- Color support and ANSI terminal detection on Windows (broken for CMD.exe and Powershell.exe) HOT 5
- Missing separating blank line option HOT 4
- Progress bar out of range error HOT 1
- OSError exception from AbsoluteETA on Windows CPython HOT 1
- Syntax Error in latest release HOT 7
- broken import HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-progressbar.