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

Move progress bar back to a value? #545

Closed
markddavidoff opened this issue Apr 20, 2018 · 8 comments · Fixed by #738
Closed

Move progress bar back to a value? #545

markddavidoff opened this issue Apr 20, 2018 · 8 comments · Fixed by #738
Assignees
Labels
p4-enhancement-future 🧨 On the back burner

Comments

@markddavidoff
Copy link

If i want to set the progress bar to a specific point, update only allows postive values, so how do i do that?

@chengs
Copy link
Contributor

chengs commented Apr 20, 2018

just set n manually and then update. See #374 #432

from tqdm import tqdm
from time import sleep
pbar = tqdm(range(100))
pbar.update(50)
pbar.refresh()
sleep(2)
pbar.n = 10 #check this
pbar.refresh() #check this
sleep(2)
pbar.update(30)

@chengs chengs added the question/docs ‽ Documentation clarification candidate label Apr 20, 2018
@chengs
Copy link
Contributor

chengs commented Apr 20, 2018

@casperdcl how about we add this into Faq of README and close #545, #432, #374?

@grollinger
Copy link

After resetting n, the progress bar might not update automatically, any more (see also #547).

I've found that what helps resolve that is to also reset last_print_n

pbar.n = 10 
pbar.last_print_n = 10 

@casperdcl
Copy link
Sponsor Member

Somewhat messes with ETA and the concept of a progressbar - sounds more like a meter (for e.g. monitoring CPU usage)

@grollinger
Copy link

grollinger commented Mar 4, 2019

Somewhat messes with ETA and the concept of a progressbar - sounds more like a meter (for e.g. monitoring CPU usage)

Indeed.

For the moment I'm also resetting the start time and last_print_time.

And all that because I have to reuse a single progress bar for multiple tasks in my Jupyter notebook.
Otherwise I'd have an ever growing whitespace in the output section (#479).

@casperdcl
Copy link
Sponsor Member

casperdcl commented Mar 4, 2019

I believe you may want to use

with tdqm(...) as t:
  ...
  t.unpause()

@grollinger
Copy link

If I understand correctly what unpause() does, that would mean that the total time keeps accumulating across tasks which I don't want to happen.

@flutefreak7
Copy link

Somewhat messes with ETA and the concept of a progressbar - sounds more like a meter (for e.g. monitoring CPU usage)

Indeed.

For the moment I'm also resetting the start time and last_print_time.

And all that because I have to reuse a single progress bar for multiple tasks in my Jupyter notebook.
Otherwise I'd have an ever growing whitespace in the output section (#479).

I'm trying to do something similar to @grollinger. Is this equivalent to what you are doing to "reset" a progressbar for reuse on another task?

pbar.n = 0
pbar.last_print_n = 0
pbar.start_t = time()
pbar.last_print_t = time()
pbar.update()

It really makes sense that the progress bar should be capable of resetting... like if a task is cancelled and restarted for any reason. That's how a download meter in a web browser works if I cancel and restart a download. The desire to reset or backtrack doesn't mean its a "meter" like a CPU meter, it just means the concept of task "progress" is not always monotonically increasing. I understand that messes with completion estimation, which is why the simplest scenario is to support a full reset and then later address how to handle back tracking.

@casperdcl casperdcl self-assigned this Mar 10, 2019
@casperdcl casperdcl added p4-enhancement-future 🧨 On the back burner and removed question/docs ‽ Documentation clarification candidate labels Mar 10, 2019
casperdcl added a commit that referenced this issue May 10, 2019
- example of dynamic usage (#735, #545, #547, #432, #374)
- note writing issues #737
- update badges
casperdcl added a commit that referenced this issue May 10, 2019
casperdcl added a commit that referenced this issue May 10, 2019
@casperdcl casperdcl mentioned this issue May 10, 2019
13 tasks
@ghost ghost added the review label May 10, 2019
@ghost ghost removed the review label May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4-enhancement-future 🧨 On the back burner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants