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

Progress Bar #21

Closed
shyamd opened this issue Apr 18, 2018 · 8 comments
Closed

Progress Bar #21

shyamd opened this issue Apr 18, 2018 · 8 comments

Comments

@shyamd
Copy link
Contributor

shyamd commented Apr 18, 2018

Is there anyway we could build in a global progress bar for builders that also worked well with logger/input outputs and didn't require complex logic?

@dwinston
Copy link
Member

What do you mean by "worked well with logger/input outputs"? We could use (nested) tqdm progress bars, which default to sys.stderr. @tschaume ?

image

@dwinston
Copy link
Member

Noting here that this enhancement could be a step towards @jdagdelen's suggestion of built-in profiling: because tqdm reports seconds per iteration ("s/it"), one can profile Builder.process_item performance this way.

@mkhorton
Copy link
Member

Is there a way to do this automatically? I can see if get_items is a list or a cursor it could work, but not if it's a generator, because we wouldn't know the total number of items?

@shyamd
Copy link
Contributor Author

shyamd commented Apr 25, 2018

Yeah, I was thinking of something along the lines of:

self.total_items = 23432
for i in items:
  yield i

And it should build the appropriate tqdm progress bar.
Ideally it should detect what kind of env and use the right one as well.

@mkhorton
Copy link
Member

What do you want as a best practice? A yield, a cursor..?

@shyamd
Copy link
Contributor Author

shyamd commented Apr 25, 2018 via email

@dwinston
Copy link
Member

Right. If there's no count, it would still be valuable to see it/s. I think the runner can try to call <obj>.count() and then len(<obj>) on what get_items() returns (wrapping in a try/except) to pass the total= kwarg to the tqdm constructor. I think it'd also be helpful for the runner to look for a Builder.total_items set in the case of yielding.

@shyamd
Copy link
Contributor Author

shyamd commented Apr 30, 2018

Taken care of with #24

@shyamd shyamd closed this as completed Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants