Skip to content

Repeated non-complete bars #109

@Galzzly

Description

@Galzzly

On doing some testing on a utility that I have been building, I have found that Bars are being repeatedly rendered, such as:

Downloading [---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 / 6
Downloading [========================================================================>--------------------------------------------------------------------------------------------------------------------------------------------------] 2 / 6
Downloading [=============================================================================================================>-------------------------------------------------------------------------------------------------------------] 3 / 6
Downloading [=================================================================================================================================================>-------------------------------------------------------------------------] 4 / 6
Downloading [======================================================================================================================================================================================>------------------------------------] 5 / 6
Downloading  Done!
Extracting   Done!
Ingesting Intermediate  Done!
Ingesting Gold  Done!

I only render 4 bars for the tool in total - Downloading, Extracting, Ingesting Intermediate, and Ingesting Gold, only the totals are updated.

The bars are initialised as follows:

	p := mpb.New(mpb.PopCompletedMode())
	barDl := p.AddBar(
		int64(numFiles),
		mpb.BarFillerClearOnComplete(),
		mpb.PrependDecorators(
			decor.Name("Downloading", decor.WC{W: 11, C: decor.DidentRight}),
		),
		mpb.AppendDecorators(
			decor.OnComplete(decor.CountersNoUnit("%d / %d"), "Done!"),
		),
	)
	barExtract := p.AddBar(
		int64(numFiles),
		mpb.BarFillerClearOnComplete(),
		mpb.PrependDecorators(
			decor.Name("Extracting", decor.WC{W: 11, C: decor.DidentRight}),
		),
		mpb.AppendDecorators(
			decor.OnComplete(decor.CountersNoUnit("%d / %d"), "Done!"),
		),
	)
	barInter := p.AddBar(
		int64(numFiles),
		mpb.BarFillerClearOnComplete(),
		mpb.PrependDecorators(
			decor.Name("Ingesting Intermediate", decor.WC{W: 22, C: decor.DidentRight}),
		),
		mpb.AppendDecorators(
			decor.OnComplete(decor.CountersNoUnit("%d / %d"), "Done!"),
		),
	)
	barGold := p.AddBar(
		int64(5),
		mpb.BarFillerClearOnComplete(),
		mpb.PrependDecorators(
			decor.Name("Ingesting Gold", decor.WC{W: 14, C: decor.DidentRight}),
		),
		mpb.AppendDecorators(
			decor.OnComplete(decor.CountersNoUnit("%d / %d"), "Done!"),
		),
	)

When adding the bars to the container, I observe that there are the additional two 'Downloading' bars rendered, and additional ones added for unknown reasons as seen in the first example.

What I would like to see happen is the initial four bars rendered:

Downloading [---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 / 6
Extracting  [---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 / 6
Ingesting Intermediate [----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 / 6
Ingesting Gold [------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 / 5

The bars increment per the bar.Increment() method, and once complete remove bars and say Done!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions