Cache for reading annotation
This commit is contained in:
1 parent
55d5cf16c9
commit
ff7496b113
12 files changed
+466
-13
No files matched your search
@@ -24,6 +24,7 @@ from copienator.annotation_actions import apply_checkbox_actions, apply_score_ov
|
||||
from copienator.annotation_data import AnnotationData, load_annotation_data
|
||||
from copienator.annotation_documents import copy_documents
|
||||
from copienator.annotation_layout import legacy_layout
|
||||
from copienator.annotation_read_cache import AnnotationReadCache
|
||||
from copienator.annotation_modifications import (
|
||||
BASELINE,
|
||||
output_removals,
|
||||
@@ -31,6 +32,7 @@ from copienator.annotation_modifications import (
|
||||
)
|
||||
from copienator.answer_info import build_answer_info
|
||||
from copienator.commands import annotating
|
||||
from copienator.commands.giving_names import update_named_return_answers
|
||||
from copienator.filesystem import staged_files
|
||||
from copienator.return_answers import save_return_answer_options
|
||||
|
||||
@@ -324,7 +326,12 @@ def run(
|
||||
return ExitCode.PARTIAL
|
||||
|
||||
status = ExitCode.PARTIAL if loaded.warnings else ExitCode.SUCCESS
|
||||
cache = AnnotationReadCache(workspace, "Bnot", loaded.data) if update_score else None
|
||||
regenerated: set[str] = set()
|
||||
for student_id in sorted(loaded.data, key=utils.natural_key):
|
||||
if cache is not None and cache.unchanged(student_id):
|
||||
print(f"Skipping unchanged Copie{student_id}")
|
||||
continue
|
||||
output_dir = workspace.annotation_dir("checks") / f"Copie{student_id}"
|
||||
only_empty = all(content["result"].get("error") == "empty-answer"
|
||||
for content in loaded.data[student_id].values())
|
||||
@@ -372,6 +379,12 @@ def run(
|
||||
)
|
||||
if result != ExitCode.SUCCESS:
|
||||
status = ExitCode.PARTIAL
|
||||
else:
|
||||
regenerated.add(student_id)
|
||||
if update_named_return_answers(workspace, "Bnot", copy_ids=regenerated) != ExitCode.SUCCESS:
|
||||
status = ExitCode.PARTIAL
|
||||
elif cache is not None:
|
||||
cache.remember(regenerated)
|
||||
return status
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user