-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: save and check a config lock for everyvoice preprocess #440
Conversation
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #440 +/- ##
==========================================
+ Coverage 73.08% 73.67% +0.59%
==========================================
Files 44 44
Lines 2653 2724 +71
Branches 406 422 +16
==========================================
+ Hits 1939 2007 +68
Misses 633 633
- Partials 81 84 +3 ☔ View full report in Codecov by Sentry. |
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.
Like Eric mentioned, to play it safe, may be we should only write the lock once all files have been processed. Otherwise, to be sure that all audio are processed the same, we should reprocess them.
What about writing the preprocessed files under a hierarchy where the root directory's name is some sort of audio preprocessing signature. If the user changes the config's preprocessing then EV would expect the audio under a different branch of the hierarchy. EV could detect and warn user about the fact the config has changed because it wouldn't be able to find the new branch and would ask the user to redo preprocessing.
What about having a "preprocessing_completed" boolean in the lock that writes when the preprocessing finishes. When preprocessing is started, you could write the config as you do, but set "preprocessing_completed" to false until it finishes and is set to true. That way you could check that boolean first and force the user to use the overwrite flag if it is false. |
This would work, but sounds a bit complicated. I would prefer the |
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.
Looks really good so far @joanise ! I do think you have the right things in the lock.
a5b2901
to
4141b18
Compare
Recommended changes done, and unit testing implemented. This is ready to re-review. |
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.
LGTM
with open(self.save_dir / ".config-lock", "w", encoding="utf8") as f: | ||
json.dump( | ||
self.get_config_lock(in_progress), f, indent=2, ensure_ascii=False | ||
) | ||
f.write("\n") |
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 we make the .config-lock
file read-only once written to discourage user to change that file?
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.
good idea
with patch_logger( | ||
everyvoice.preprocessor.preprocessor | ||
) as logger: | ||
with self.assertLogs(logger) as logs: |
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.
quintuple with
depth, this is serious ;)
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.
lol
Make it distinguish between in progress and completed Make it read-only to discourage writing
b0dd167
to
9d16ea4
Compare
PR Goal?
Add a config lock, and check it
This is a draft PR to seek early feedback. Still to do: add unit testing
Fixes?
Fixes #210
Feedback sought?
Sanity check in this current draft state. Does the config lock contain the right subset of the configuration?
Try the feature out, and have a look at the error messages I added.
At the moment, I check and write the lock when preprocessing starts. Here's a scenario this would fail to catch:
Question: is that caveat acceptable, or should I change the lock mechanism to write the config lock only at the end? Or maybe to update an existing config lock only at the end?
Priority?
normal
Tests added?
none yet, but I plan to add them.
How to test?
Run
everyvoice preprocess
on some config, change the config for text, audio or source_data, then run again and see it fail asking you to add--overwrite
.Confidence?
medium low
Version change?
no
Related PRs?
none