Add 'fixed' option to fix the position of progress bars #615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.leave=True
(default) and usingposition
with tqdm(total=srcr.dbsize(), ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:
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.
leave=False
and usingposition
with tqdm(total=srcr.dbsize(), leave=False, ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:
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.fixed=True
and usingposition
with tqdm(total=srcr.dbsize(), fixed=True, ascii=True, unit='keys', unit_scale=True, position=pos) as pbar:
With
fixed=True
, I could see completed outputs which were not disappeared.fixed
option is very simillar toleave=Fasle
except that it does not "clear" the completed progress bar (at__exit()__
).