Comments (8)
In the end I went ahead and published my own progress bar crate, yapb, which has a much simpler implementation and does not make assumptions about use patterns or even IO.
from indicatif.
Had this problem with futures today. Lots of stuff to progress, but only one thread.
from indicatif.
#231 and #234 may address this: the former makes ProgressBars in a MultiProgress update their shared draw target synchronously, the latter reworks batching / ratelimiting of terminal updates so it's fully shared by MultiProgress and single bars.
After those two changes, MultiProgress no longer requires using a separate thread to run update(), and is entirely single-threaded when updates are not ratelimited (using stderr_nohz()
or similar). When using ratelimited drawing (with either a single bar or MultiProgress), the library manages a background thread to buffer updates and write to the terminal.
(I still don't really like this design: seems like the draw targets should only receive notifications that state changed, not a full draw state, and the draw targets should then be able to request the bars to render themselves when they want to redraw. That'd mean less wasted work, and the possibility of doing something like steady_tick and redraws on terminal size changes in the draw target. That's more of a redesign than I'd like to tackle, though.)
from indicatif.
while not ideal, it does work if you can spin up a separate thread for the MultiProgress instance:
let multi_progress = MultiProgress::new();
let progress_one = mp.add(ProgressBar::new_spinner());
let progress_two = mp.add(ProgressBar::new_spinner());
let progress_three = mp.add(ProgressBar::new_spinner());
let multi_progress = thread::spawn(move || multi_progress.join());
// do work
for i in 0..10 {
progress_one.inc(1);
progress_two.inc(1);
progress_three.inc(1);
}
progress_one.finish();
progress_two.finish();
progress_three.finish();
multi_progress.join().unwrap();
from indicatif.
Ran into this issue directly today also when I tried out this crate.
I had some single-threadedcode that has multiple progress bars that I want to be able to update but they didn't show up at all when using MultiProgress
, and creating multiple individual ProgressBar
created conflicted output.
from indicatif.
Yeah. I wanted to clean this up already. For now I'm accepting pull requests to make this better because I did not come up with a nice design for it.
from indicatif.
#231 was merged by way of #284. I'm not completely sure the current state addresses the original concerns so I'll leave this open for now, but I think the state in the soon to be released 0.17 (#318) is substantially improved.
from indicatif.
I'm going to close this. MultiProgress
no longer necessitates another thread for drawing. It's been like that for a few years now.
from indicatif.
Related Issues (20)
- Width-filling progress bars wrap around on >1 character wide emojis HOT 3
- indicatif crashes with assertion failed: self.orphan_lines_count <= self.lines.len() if number of terminal columns is less than 135 HOT 11
- Finished progress bars are not preserved in `MultiProgress::println` HOT 6
- `{msg}` `.set_message(Cow<'static, str>)` design unnecessarily requires allocation HOT 3
- Question: How to get latest progress bar state string HOT 3
- Git repo is missing tag for v0.17.7 HOT 1
- Add gifs/videos in readme for each example HOT 1
- Hidden as an attribute on Style not ProgressBar HOT 3
- Use with Zenity HOT 7
- Intermittent `style::tests::wide_element_style` failure HOT 2
- ‘percent_precise’ do not work HOT 4
- examples/fastbar.rs rendering is different on Windows git-bash than CMD or PowerShell HOT 3
- [Meta] missing release entries for 0.17.6 and up HOT 3
- MultiProgress falls apart if the number of ProgressBars excedes the number of lines in a terminal HOT 1
- Feature Req.: Human readable `per_sec` rate HOT 3
- Using ⚙️ emoji in ProgressBar spinner message causes unnessecary line breaks HOT 23
- How do I get the progress bar to align under my design? HOT 1
- MultiProgress second ProgressBar extremely delayed HOT 3
- Stacked progress bar HOT 2
- Adding/removing progress bar spinners leaves newlines HOT 3
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 indicatif.