-
Notifications
You must be signed in to change notification settings - Fork 42
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
Issue251 cli init command #306
Conversation
Codecov Report
@@ Coverage Diff @@
## master #306 +/- ##
===========================================
+ Coverage 79.8% 99.35% +19.55%
===========================================
Files 55 55
Lines 2842 2962 +120
===========================================
+ Hits 2268 2943 +675
+ Misses 574 19 -555
Continue to review full report at Codecov.
|
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.
It's very good now but I'm still thinking about what the semantics should be here.
Originall I thought that this command could also be used to initialize Maui Server (once we add support for it) but I'm not so sure anymore - maybe that's overloading the command too much. It would be simpler to just define this command as clearing the state of a project - as is currently implemented. Consequently it would be best to call the command annif clear
instead of annif init
.
So just two things needed before this can be merged:
- Rename the command to
clear
- Show a warning instead of an error if there is nothing to remove.
Sorry for dithering on this!
annif/project.py
Outdated
"""remove the data of this project""" | ||
datadir_path = self._datadir_path | ||
if not os.path.isdir(datadir_path): | ||
raise AnnifException('No model data to remove for project {}.' |
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 this should emit a warning message but it shouldn't be a fatal error.
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.
Implemented showing warning instead of erroring.
In the test for nonexistent data the command is run for dummy-fi
project, because when running for a nonexistent project a (different) warning is raised already in get_project
.
The test has logger.propagate = True
for the same reason as in #299 (comment).
Still need to document this on the wiki page Commands |
The
init
command simply deletes all files underdata/projects/project-to-remove/
(that directory will remain):Stated in the issue comment: "It could wipe all state and reset any configuration settings."
Is this PR enough for this?
The issue #269 for creating backend for using Maui server plans using
init
command for "creating tagger on the Maui server end", which is left for future.This closes #251.