Skip to main content

review.runs.evaluation_failures

review.runs.evaluation_failures(run, n=None)

The failing evaluations of an attempt of run.

Parameters

Name Type Description Default
run Run The run. required
n int | None The attempt; the final attempt if omitted. None

Returns

Name Type Description
tuple[Failure, …] tuple[Failure, …]: What evaluations-<n>.txt lists; empty if the run has no such attempt or the file is missing.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from babregen.review.runs import read_run

record = (
    'unit = "calc"\nprotocol = "score"\nstatus = "completed"\n'
    '[base]\ncommit = "' + "a" * 40 + '"\n[final]\nattempt = 1\n'
    "[[attempt]]\nn = 1\nwrote_module = true\n"
)
from babregen.review.runs import evaluation_failures

text = "babregen: failing evaluations\nFAILED t.py::a\n    t.py:3: boom\n"
with TemporaryDirectory() as tmp:
    (Path(tmp) / "run.toml").write_text(record)
    (Path(tmp) / "evaluations-1.txt").write_text(text)
    print(evaluation_failures(read_run(Path(tmp)))[0].nodeid)
t.py::a