-
Notifications
You must be signed in to change notification settings - Fork 98
fix(commands): Skip warmup script on --dry-run #1523
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: main
Are you sure you want to change the base?
fix(commands): Skip warmup script on --dry-run #1523
Conversation
@SomeThink1729 Thanks a lot for opening this PR! I think we should first talk a bit about the general direction. While I see that users may not want to warm-up during a So, I suggest that we make warming up in dry run an option to choose, i.e. either add a @SomeThink1729 Which variant do you like more? Can you add this to this PR? |
@aawsome Thanks for the feedback. Until now I didn't see the use case you're describing, but now it totally makes sense. For me personally I think this use case is more naturally and I'd put in under So I'll implement it the other way round ( |
After thinking about it, I agree that it may make more sense to have dry run not warm up by default. The next release will anyway break smaller things, so I think we can also introduce a breaking change here... |
@aawsome I've now added the discussed behaviour.
to check if both arguments are supplied or if the config is valid and continue execution. Do you think it's necessary and would like to include such a check or do you think its unnecessary? |
We could let An alternative would be to have a |
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.
Some minor findings.
I think the change should be also in the config example full.toml
as well as in the README.md
of the config. Besides this, seems to be ready to merge!
repo.warm_up(prune_plan.repack_packs().into_iter())?; | ||
} else { | ||
} else if !config.global.dry_run_warmup { | ||
info!("Ignoring --dry-run-warmup works only in combination with --dry-run"); |
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.
Nitpick: Users may not necessarily want to see this information, I'd make it a debug!
println!("restore done."); | ||
} else { | ||
info!( | ||
"--dry-run is without warmup, --dry-run --dry-run-warmup also issues the warmup script." |
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.
same here. Change into debug!
?
|
||
[repository] | ||
repository = "/tmp/repo" | ||
password = "test" |
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.
I think those come from a local rustic.toml
when you run the tests. In the CI, there is no rustic.toml
. Can you remove these two changes?
This resolves #1428 and also skips it on restore
On prune and restore --dry-run would still issue the warmup script when using hot/cold storage
Right now this doesn't add any information that the warmup script WOULD be executed, maybe it'd be a good information
I haven't added tests yet, but first I wanted to make sure #1428 is unintended behavior and should be fixed
New output
[INFO] using config /home/username/.config/rustic/warm_up.toml
[INFO] using warm-up command ./warmup.sh '%id'
enter repository password: [hidden]
[INFO] repository local:/some/test_repos/cold#local:/some/test_repos/hot: password is correct.
[INFO] using cache at
home/username/.cache/rustic/3b30726615c501982a75710ca6da0bf48bdd0aba5f40d93f0fc9762689e36098
[00:00:00] reading index... ████████████████████████████████████████ 0/0 [00:00:00] reading snapshots... ████████████████████████████████████████ 0/0 [00:00:00] finding used blobs... ████████████████████████████████████████ 0/0 [00:00:00] getting packs from repository... [INFO] to repack: 0 packs, 0 blobs, 0 B
[INFO] this removes: 0 blobs, 0 B
[INFO] to delete: 0 packs, 0 blobs, 0 B
[INFO] total prune: 0 blobs, 0 B
[INFO] remaining: 0 blobs, 0 B
[INFO] unused size after prune: 0 B (NaN% of remaining size)
[INFO] packs marked for deletion: 0, 0 B
[INFO] - complete deletion: 0, 0 B
[INFO] - keep marked: 0, 0 B
[INFO] - recover: 0, 0 B
Old output (doesn't show lines that are equal)
...
[INFO] - recover: 0, 0 B
[00:00:00] warming up packs... ████████████████████████████████████████ 0/0