Skip to main content

review.runs.read_run

review.runs.read_run(path)

Read the run directory path.

Parameters

Name Type Description Default
path Path A directory with a run.toml. required

Returns

Name Type Description
Run Run The run.

Raises

Name Type Description
ConfigurationError If there is no readable run.toml or it lacks unit, protocol, status or [base].

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from babregen.review.runs import read_run

record = (
    'unit = "calc"\nprotocol = "score"\nstatus = "completed"\n'
    'accepted = false\n[base]\ncommit = "' + "a" * 40 + '"\n'
    '[final]\nattempt = 1\n[[attempt]]\nn = 1\nwrote_module = true\n'
    "evaluations_passed = 5\nevaluations_failed = 5\nevaluations_errors = 0\n"
)
with TemporaryDirectory() as tmp:
    (Path(tmp) / "run.toml").write_text(record)
    run = read_run(Path(tmp))
    print(run.protocol, run.final_attempt, run.final.evaluations_failed)
score 1 5