Closed sanyamsinghal closed 1 year ago
So in the implementation, first i am creating the progress bar container like this:
progressBarContainer := mpb.New(mpb.PopCompletedMode())
Then i am just calling one goroutine for each progress bar where each progress bar tracks some ongoing work in the main process.
go startPB()
where each call to startPB() function will add a Progress Bar to the container and will increment it till the end. In startPB() function, the way i am creating progress bar is:
bar := importProgressContainer.container.AddBar(total,
mpb.BarFillerClearOnComplete(),
mpb.PrependDecorators(
decor.Name(name),
),
mpb.AppendDecorators(
decor.OnComplete(
decor.NewPercentage("%.2f", decor.WCSyncSpaceR), "completed",
),
decor.OnComplete(
decor.AverageETA(decor.ET_STYLE_GO), "",
),
),
)
Just to add previous i was creating the container without PopOnComplete()
but the issue was when i was having 110 progress bars, then at some point of time for the current Progress Bars whole set of previous progress bars(even though its complete) was repeting and causing the output console to be very much filled by the output.
I am using
mpb
module to display multiple progress bars for some ongoing process. The issue is that progress bar's output is not correct/cleaner. (this issue is important for us since we want to use it in our production code)The output looks like this:
Here you can see that rental progress bar is displayed/printed twice before competition
In my usecase, progress bars dynamically gets added the container based on whenever the corresponding thing to track starts.
I believe there might be some issue with the way i am using it in my code. I can share the way i have implemented it, any help would be highly appreciated. cc @vbauerster