gc: add dry option and return num removed#441
Merged
dberenbaum merged 3 commits intomainfrom Sep 25, 2023
Merged
Conversation
Author
|
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. |
daavoo
reviewed
Sep 15, 2023
| odb.fs.remove(paths) | ||
| removed += len(paths) | ||
| if not dry: | ||
| odb.fs.remove(paths) |
Contributor
There was a problem hiding this comment.
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?
Author
There was a problem hiding this comment.
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.
added 2 commits
September 22, 2023 12:30
Codecov ReportPatch has no changes to coverable lines.
📢 Thoughts on this report? Let us know!. |
Author
daavoo
approved these changes
Sep 25, 2023
Author
|
@efiop Any thoughts on tests? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prerequisites to make gc more user friendly by exposing a dry option and returning the number of files removed.