-
-
Notifications
You must be signed in to change notification settings - Fork 790
prune --keep-all: alias for --keep-last <inf>, fixes #6656 #7462
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
base: master
Are you sure you want to change the base?
prune --keep-all: alias for --keep-last <inf>, fixes #6656 #7462
Conversation
acd9654
to
e69fbe9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7462 +/- ##
==========================================
+ Coverage 81.46% 81.48% +0.02%
==========================================
Files 77 77
Lines 13520 13521 +1
Branches 2004 2004
==========================================
+ Hits 11014 11018 +4
+ Misses 1853 1851 -2
+ Partials 653 652 -1 ☔ View full report in Codecov by Sentry. |
Hehe, looks good. Considering the special infinity value, I guess a test for this would be good (just test the code does not crash and keeps all archives present, except old checkpoint archives). |
What happens if someone does The above conflicts might happen because someone has a script that already has various |
@jdchristensen, interesting insight. I'll take a look at the interactions between those flags. @ThomasWaldmann I did test that eye-catching infinite value locally (didn't test deeply, just created a few archives to see that it didn't crash). I can write up a unit test to see how well it works with keeping archives and removing checkpoints. I would love to hear your thoughts on @jdchristensen's remarks though. |
Good catch!
Issue #6269 applies here also, I guess.
|
If we have different argparse options, we could also use this: https://docs.python.org/3/library/argparse.html#mutual-exclusion |
I resolved the merge conflict and also had another look:
@Michael-Girma Can you try to implement that and add a test? |
@Michael-Girma did you see my last comment, can you fix it? |
@ThomasWaldmann just seeing this. Will take a look tonight. |
@Michael-Girma do you need help finishing this? |
I'm looking at similar logic in #8775 and could finish this up pretty quick. Additionally I've been thinking to add handling of Thinking about what this PR practically solves, cleanup of checkpoints, should this flag maybe be something like |
I'd say both Yes and No. You're absolutely right that using |
Agreed on this. Maybe it could even belong together with Whatever the case, I would like to have |
True that. In the end it boils down to whether you consider a checkpoint an "archive" (from a user's perspective, not technically) - if it is an archive, removing it with I like the idea to let So, yeah, I feel like So, in the end WDYT? Other opinions?
IMHO that's a reasonable addition no matter what 👍 I'd go with |
b630fda
to
61df3bb
Compare
61df3bb
to
2d0e590
Compare
--keep-all
, as an alias for '--keep-last <inf>', as an option…
I added some tests. The reuse of the "secondly" variable for miscellaneous purposes that should be mutually exclusive is problematic. I added one (failing) test that shows the problem @jdchristensen pointed out. 2 other considerations:
|
args.minutely, | ||
args.hourly, | ||
args.daily, | ||
args.weekly, | ||
args.monthly, | ||
args.quarterly_13weekly, | ||
args.quarterly_3monthly, | ||
args.yearly, | ||
args.within, |
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.
note that secondly is missing here!
The concerns raised by Dan are very valid, thanks Dan, also thank you Thomas for making the problem more approachable by adding the test: IMO a user won't ever expect I feel like this comes from me originally suggesting Let's take a short step back and think about how From this point on a technical solution immediately popped into my mind: Why not store the presence of def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
# …
subparser.add_argument(
"--keep-all",
dest="all",
action="store_true",
help="keep all archives (overrules all other --keep-* options)",
)
# … def do_prune(self, args, repository, manifest):
# …
if args.all:
args.within = 0
args.secondly = float("inf")
args.minutely = 0
args.hourly = 0
args.daily = 0
args.weekly = 0
args.monthly = 0
args.quarterly_13weekly = 0
args.quarterly_3monthly = 0
args.yearly = 0
# … Regarding Borg 2: I feel like that even if things end up making |
Added a subparser argument that stores a large value for
--keep-last
when pruning.