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

Add support for child ProgressBar #70

Open
wants to merge 2 commits into
base: 1.0
Choose a base branch
from

Conversation

vehovsky
Copy link
Contributor

Initial implementation. Build on top of #69

progressbar

Fixes #66

@ctongfei
Copy link
Owner

Wow! Thanks @vehovsky !!!
This change would merit the 1.0 release I think. I'll review and release asap.

@ctongfei ctongfei added this to the 1.0 milestone Apr 14, 2020
@ctongfei ctongfei changed the base branch from master to 1.0 April 24, 2020 03:49
@ctongfei ctongfei changed the title Add support for child PprogressBar Add support for child ProgressBar Apr 24, 2020
@ctongfei
Copy link
Owner

I think that this proposal need more discussion. There are two cases with parent/children progress bars:

  • The parent m steps, and for each step there is n steps (there could be sub-progressbars spawning and dying in the process).
  • The parent finishes if all its children finishes (the parent does not have its own progress)

I think what you implemented here is the second case.

@vehovsky
Copy link
Contributor Author

Yes it is initial implementation only.

Well the actual progress of the parent is calculated as average of all it children/subchildren/etc. progresses.

It is true the "max" of parent is only size of immediate children, not subchildren/etc.

So instead:

max = children.size();

Something like:

int getSize(List<ProgressState> children) {
    AtomicInteger result = new AtomicInteger(children.size());
    if (children.size() > 0) {
        children.forEach(state -> result.addAndGet(getSize(state.children)));
    }
    return result.get();
}

@ctongfei
Copy link
Owner

Yes and I think that we need to discuss to understand the subtle semantics of the two cases. In the meantime, I'm thinking of releasing an interim 0.9 version with your fabulous multi-line contribution, and leave this for a later 1.0.

@nadilas
Copy link

nadilas commented Aug 16, 2020

Yes and I think that we need to discuss to understand the subtle semantics of the two cases. In the meantime, I'm thinking of releasing an interim 0.9 version with your fabulous multi-line contribution, and leave this for a later 1.0.

@ctongfei Can you release 0.9?

@koppor
Copy link
Contributor

koppor commented Oct 24, 2020

@nadilas 0.9.0 was relased https://github.com/ctongfei/progressbar/blob/master/CHANGELOG.md

I am a bit worried about the conflicts here. Maybe @vehovsky can fix them? 😇

@talemke
Copy link

talemke commented Aug 20, 2021

Hey,

don't mean to be annoying, but is there any ETA on when this can be released?

@nadilas
Copy link

nadilas commented Jul 9, 2022

@nadilas 0.9.0 was relased https://github.com/ctongfei/progressbar/blob/master/CHANGELOG.md

I am a bit worried about the conflicts here. Maybe @vehovsky can fix them? 😇

Let's try this again 😅 @koppor How can we help?

@leonard84
Copy link

It would be great if better multiline support could be added for 0.9.

And I would also like to add another scenario to this, or clarify if it is already covered by this.

The parent m steps, and for each step there is n steps (there could be sub-progressbars spawning and dying in the process).

My scenario would be similar, e.g. parent has m steps (files) and can process up to n files in parallel, i.e. it would show up to n child progress bars. The child progress bars would depend on the individual files and can have a different number of steps. Once a files is processed, the thread would pickup another file and process it, either reusing a child progress bar or creating a new one - whatever is the correct strategy.

@koppor
Copy link
Contributor

koppor commented Oct 27, 2022

@leonard84 Seems someone needs to redo this PR - and @vehovsky seems to be inactive. Anyone volunteering for the sake of hacktoberfest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How can I create a child progressbar?
6 participants