-
Notifications
You must be signed in to change notification settings - Fork 19
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
gc: add dry option and return num removed #441
Conversation
Can we add meaningful unit tests for this? I couldn't easily figure out a way to do it. Let me see what we can cover in the corresponding dvc PR. |
odb.fs.remove(paths) | ||
removed += len(paths) | ||
if not dry: | ||
odb.fs.remove(paths) |
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.
Maybe we could put some logging here in debug mode (or even info if you passed dry
?
Or is the list of things to be removed logged elsewhere?
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.
Didn't track down where, but it looks like it is already logged:
$ dvc gc -v --all-commits --all-branches --all-tags
2023-09-15 10:54:20,087 DEBUG: v3.19.1.dev20+gbf2af8639.d20230915, CPython 3.11.5 on macOS-13.5-arm64-arm-64bit
2023-09-15 10:54:20,087 DEBUG: command: /Users/dave/micromamba/envs/dvc-test/bin/dvc gc -v --all-commits --all-branches --all-tags
2023-09-15 10:54:20,288 WARNING: This will remove all cache except items used in the workspace and all git commits of the current repo.
Are you sure you want to proceed? [y/n]: y
2023-09-15 10:54:22,624 DEBUG: Estimated remote size: 256 files
2023-09-15 10:54:22,625 DEBUG: Removing '/Users/dave/repo/.dvc/cache/files/md5/91/52ab3f172b3e23fd6b1a3ab0e1d150'
Removed 1 objects from repo cache.
2023-09-15 10:54:22,625 DEBUG: Estimated remote size: 256 files
No unused 'local' cache to remove.
2023-09-15 10:54:22,625 DEBUG: Estimated remote size: 256 files
2023-09-15 10:54:22,625 DEBUG: '/Users/dave/repo/.dvc/cache/files/md5/5f/b7ba7e8447a836e774b66155f5776a' doesn't look like a cache file, skipping
No unused 'legacy' cache to remove.
Codecov ReportPatch has no changes to coverable lines.
📢 Thoughts on this report? Let us know!. |
@efiop Any thoughts on tests? |
Prerequisites to make gc more user friendly by exposing a dry option and returning the number of files removed.