Return a typed verdict from the judge
This commit is contained in:
@@ -18,7 +18,7 @@ def run_cycle(root, project, task, premises, models, paths):
|
||||
verdict = judge_through_interrupts(root, project, task, premises, models, session, path, paths)
|
||||
if isinstance(verdict, Stop):
|
||||
return verdict
|
||||
if verdict["finished"]:
|
||||
if verdict.finished:
|
||||
if failure := archive(project, path, f"Task: {task}\n\nVerdict: finished", paths):
|
||||
return Stop(1, failure.reason)
|
||||
delete_session(session)
|
||||
@@ -32,10 +32,10 @@ def judge_through_interrupts(root, project, task, premises, models, session, pat
|
||||
if isinstance(entries, Failure):
|
||||
return Stop(1, entries.reason)
|
||||
verdict = judge(root, task, premises, render(entries), models.judge)
|
||||
if isinstance(verdict, Stop) or not verdict["interrupt"]:
|
||||
if isinstance(verdict, Stop) or not verdict.interrupt:
|
||||
return verdict
|
||||
if failure := archive(project, path, f"Task: {task}\n\nVerdict: interrupt\n\n{verdict['question']}", paths):
|
||||
if failure := archive(project, path, f"Task: {task}\n\nVerdict: interrupt\n\n{verdict.question}", paths):
|
||||
return Stop(1, failure.reason)
|
||||
if stop := interrupt(root, session.id, models.worker, path, verdict["question"], paths):
|
||||
if stop := interrupt(root, session.id, models.worker, path, verdict.question, paths):
|
||||
return stop
|
||||
|
||||
|
||||
Reference in New Issue
Block a user