Skip to content

Add 'fixed' option to fix the position of progress bars - #615

Open
mingrammer wants to merge 1 commit into
tqdm:masterfrom
mingrammer:fixed-option
Open

Add 'fixed' option to fix the position of progress bars#615
mingrammer wants to merge 1 commit into
tqdm:masterfrom
mingrammer:fixed-option

Conversation

@mingrammer

@mingrammer mingrammer commented Sep 17, 2018

Copy link
Copy Markdown

I've added fixed option to fix the position of progress bars. I think it is useful to make the position of multiple bars fixed while using multiprocessing.

With fixed option, you can fix the position of progress bars and make the bars keeping on its position even though a process was completed.

Real case

I wanted to run 8 jobs with 3 processes with multiprocessing. As you know, an order of job running is unexpectable, so it may be challenging to keep the progress bars for each job on its fixed positions.

  1. leave=True (default) and using position

with tqdm(total=srcr.dbsize(), ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:

screenshot 2018-09-17 20 05 24

Yes it is tracing option, so, unexpected process switching are all traced. So I can't fix progress bars on a single line for a process.

  1. leave=False and using position

with tqdm(total=srcr.dbsize(), leave=False, ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:

screenshot 2018-09-17 20 05 45

With leave=False, each progress bar will be updated on its (fixed) position. But, when a progress is completed, bars will be disappeared. So, I could not see completed output.

  1. fixed=True and using position

with tqdm(total=srcr.dbsize(), fixed=True, ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:

screenshot 2018-09-17 20 42 40

With fixed=True, I could see completed outputs which were not disappeared.fixed option is very simillar to leave=Fasle except that it does not "clear" the completed progress bar (at __exit()__).

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #615 into master will decrease coverage by 0.41%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##           master     #615      +/-   ##
==========================================
- Coverage   98.87%   98.45%   -0.42%     
==========================================
  Files           9        9              
  Lines         709      713       +4     
  Branches      127      129       +2     
==========================================
+ Hits          701      702       +1     
- Misses          5        6       +1     
- Partials        3        5       +2

@chengs

chengs commented Sep 17, 2018

Copy link
Copy Markdown
Contributor

I help you fix the error in travis-ci. If you find the perf test reports an error, try to rerun it in travis-ci. Sometimes it happens.

As to the decision of whether use this PR, let's wait @casperdcl to make it.

@mingrammer

Copy link
Copy Markdown
Author

@chengs There seems no error in travis-ci

@chengs

chengs commented Sep 17, 2018

Copy link
Copy Markdown
Contributor

@mingrammer Ah, that's because I rerun the test in travis-ci. :-)

@mingrammer

Copy link
Copy Markdown
Author

@chengs Ah, that's good! Thank you :)

@casperdcl casperdcl self-assigned this Sep 22, 2018
@casperdcl casperdcl added p3-enhancement 🔥 Much new such feature to-review 🔍 Awaiting final confirmation labels Sep 22, 2018
@mingrammer
mingrammer requested a review from casperdcl as a code owner August 2, 2020 14:39
@mingrammer

Copy link
Copy Markdown
Author

Any progress?

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

Labels

p3-enhancement 🔥 Much new such feature to-review 🔍 Awaiting final confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants