Skip to content
Snippets Groups Projects
Commit fbf663fe authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

fix corpus reset cli command

parent 66a54dae
No related branches found
No related tags found
No related merge requests found
from app.models import Corpus, CorpusStatus from app.models import Corpus, CorpusStatus
import os import os
import shutil import shutil
from app import db
from . import bp from . import bp
...@@ -16,6 +17,8 @@ def reset(): ...@@ -16,6 +17,8 @@ def reset():
CorpusStatus.CANCELING_ANALYSIS_SESSION CorpusStatus.CANCELING_ANALYSIS_SESSION
] ]
for corpus in [x for x in Corpus.query.all() if x.status in status]: for corpus in [x for x in Corpus.query.all() if x.status in status]:
print(f'Resetting corpus {corpus}')
shutil.rmtree(os.path.join(corpus.path, 'cwb'), ignore_errors=True) shutil.rmtree(os.path.join(corpus.path, 'cwb'), ignore_errors=True)
corpus.status = CorpusStatus.SUBMITTED corpus.status = CorpusStatus.UNPREPARED
corpus.num_analysis_sessions = 0 corpus.num_analysis_sessions = 0
db.session.commit()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment