-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
change progress bar backend to tqdm #2333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @casperdcl and welcome to the project! It looks way cleaner now) I've added a few comments below.
- progress.Progress - progress.ProgressCallback - progress.progress
Ah just opened a new issue, at least in part due to tqdm/tqdm#795 |
incidentally WARNING: Some of the cache files do not exist neither locally nor on remote. Missing cache files |
Looks like it is due to redirection settings being changed on dvc.org. I'm looking into it. |
@casperdcl updated the url on master, please rebase. Pull should be working now. |
Right looks about done now. Had to release a new version of |
This comment has been minimized.
This comment has been minimized.
@casperdcl Once again, sorry for that one, it is WIP #2407 . Will merge soon. |
@casperdcl Should be fixed now. Sorry for that. |
will merge |
return ret | ||
|
||
return list(set(checksums) & set(self.all())) | ||
pbar.update_desc("", 0) # clear path name description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add .clear_desc()
? This at least would make the comment not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably need a better description though.. maybe pbar.update_desc("Cache lookup", 0)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@casperdcl Btw, it actually seems pretty weird here, is it clearing the progress bars from batch_exists? You have another similar line pbar.update_desc("Checkout", 0) # clear path name description
up above. Maybe pbar.finish()
would be better? Is this line used to just leave the trace of the progress bar? If that is the case, we could definitely just drop them, those operations are kinda internal ones, so there is no real need to leave them(those leftover progress bars) in the final output, after they've already served the purpose of notifiying user about what was going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@efiop I wrote this to match the old behavior precisely, where the bar was left behind without any description (the callback would've injected various descriptions). The same is sort of true of the "Checkout" case, where I've replaced a description-less bar + "Checkout finished!" message with simply a completed bar labelled "Checkout".
Basically the new version is either identical to or slightly less verbose than the original.
Happy to change if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@casperdcl I understand, and the idea for this PR was precisely that: to make a migration happen and then polish everything in the next PRs, but looks like making a few changes along the way is inevitable. If my understanding of those update_desc() described above is correct, then we could simply remove those lines and be done with this 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, we can indeed deal with it on top. Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but to be more explicit
old version:
>>> progress_callback.finish("")
[##############################] 100%
new version:
>>> pbar.update_desc("", 0) # clear path name description
100%|██████████| 3/3 [00:01<00:00, 1.96it/s]
if removed:
...f17c72d: 100%|██████████| 3/3 [00:01<00:00, 1.96it/s]
Actually (unrelated) there's a slight logic error (the line needs to be moved up a little before the function returns).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@casperdcl Sure, please create a new PR for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Let's proceed with the UI on top of this.
Substitute current
progress
with a thin wrapper aroundtqdm
details
most optional. Necessary starred (
*
)*
addprogress.Tqdm(tqdm.tqdm)
*
progress-aware logging*
update/fix old testslogging.getLogger().getEffectiveLevel() >= WARNING
?tqdm
is very efficient and there are now at mostN_WORKERS
bars which will be cleared upon completionif pbar.n > LARGE_FILE_SIZE: pbar.write(str(pbar))
)*
under which appears a per-file download thread bar*
which is cleared away correctlyreview TODO list
*
fix remaining0%
bar whendvc pull
ing*
increase description length to 25*
remove MD5 descriptions*
add units (file
,md5
,B
) for all barsremoves
logger.ColorFormatter._progress_aware
progress.Progress
progress.ProgressCallback
progress.progress
progress.CLEARLINE_PATTERN
remote.azure.Callback
remote.http.ProgressBarCallback
remote.s3.Callback
remote.ssh.connection.percent_cb
remote.ssh.connection.create_cb
repo.checkout.get_progress_callback
tests.func.test_checkout.TestCheckoutShouldHaveSelfClearingProgressBar
adds
progress.Tqdm(tqdm.tqdm)
progress.TqdmThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor)
logger.LoggerHandler.emit
remote.base.RemoteBASE.get_files_number
modifies
depends on
tqdm>=4.34.0
(Release 4.34.0: nested closing,=
CLI option syntax, docs & framework updates tqdm/tqdm#797 <- shifting nested/parallel bars when closing tqdm/tqdm#795)