review.runs.read_run(path)
Read the run directory path.
Parameters
| path |
Path |
A directory with a run.toml. |
required |
Raises
|
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)