-
Notifications
You must be signed in to change notification settings - Fork 17
fix: backup cli #345
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
fix: backup cli #345
Conversation
|
We might need/want to backup/restore Logos registry keys, as well as user data folders. |
ctrlaltf24
left a comment
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.
Nothing new, some thoughts feel free to ignore, I know you're still working
| return bar | ||
|
|
||
| # De-dup | ||
| if message != self._last_status: |
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.
Should the bar print even if the status didn't change?
We may consider changing the Downloading.... status to use a percentage instead of adding dots
ou_dedetai/control.py
Outdated
|
|
||
| from . import system | ||
| from . import utils | ||
| # from . import utils |
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.
?
ou_dedetai/backup.py
Outdated
| while t.is_alive(): | ||
| i += 1 | ||
| i = i % 20 | ||
| app.status(f"{message}{"." * i}\r") |
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.
nit: use progress in status rather than adding dots
ou_dedetai/backup.py
Outdated
| if mode == 'restore': | ||
| if not app.conf.logos_exe: | ||
| app.exit("Cannot restore, Logos is not installed") | ||
| dst_dir = Path(app.conf.logos_exe).parent |
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.
Should this use logos app data Dir instead?
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 had the same question, but I think the Logos app should be installed before trying to restore a backup. Otherwise installing Logos over existing data directories might clobber them? Not sure. Also, is app.conf.logos_exe generic enough to be defined as the Verbum exe path as well?
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.
Also, is app.conf.logos_exe generic enough to be defined as the Verbum exe path as well?
Yup
|
Consider a file chooser for setting Backup dir: |
cf. #228 for links to some potential curses file browsers. |
|
Ran additional tests on 78aeef0:
Made a PR into this branch with a refactor to using python inheritance rather than setting source/dest dir manually. #360 |
ctrlaltf24
left a comment
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.
Approved, although would like to see #360 merged into this first.
| question = "New or existing folder to store backups in: " | ||
| options = [PROMPT_OPTION_DIRECTORY] | ||
| output = Path(self._ask_if_not_found("backup_dir", question, options)) | ||
| output.mkdir(parents=True, exist_ok=True) |
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.
What you have here is fine, or you could move https://github.com/FaithLife-Community/OuDedetai/pull/345/files#diff-07bb26aae0eae6d2749c28c992609c0619b8a27c628a8dc5efc075308f20181fR29-R35 here
Rational for the logic here was the return type is Path, so it'd be nice if it exists. Nice to have valid values returned from Config
|
|
||
|
|
||
| def get_path_size(file_path): | ||
| def get_path_size(file_path: Path|str) -> int: |
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.
nit: no need to change, but os.walk https://www.geeksforgeeks.org/os-walk-python/ is well designed for this task. Just FYI, not requiring you to change
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. Is it significantly faster? Less memory and/or CPU intensive? Or is there some other benefit to os.walk over Path.rglob?
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.
doesn't require recursion is the main benefit which may be inconsequentially faster
rather than initializing destination_dir to none, then setting it, use abstract functions to populate them.
| backup.backup(self) | ||
| else: | ||
| control.restore(self) | ||
| backup.restore(self) |
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.
We need to re-enable backup and restore in the menu below, lines 983–984.
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.
Perhaps I misunderstood, but this PR is not intended to fix #197, only partially so, correct?
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.
The way I understood it was an improvement, related to #197, but not aimed at fixing it. I looked to the PR description to determine scope rather than the issue
Discussed in other channel - they're willing to merge this
Get backup and restore working for CLI (prep for getting general backup/restore working)