Skip to main content

review.runs.Run

review.runs.Run(
    path,
    name,
    record,
    run_sha256,
    protocol,
    unit,
    base,
    status,
    accepted,
    final_attempt,
    attempts,
    has_report,
    files,
)

A run directory, read.

Attributes

Name Type Description
path Path The directory.
name str Its name.
record dict[str, object] The parsed run.toml.
run_sha256 str SHA-256 of run.toml.
protocol str score, regeneration or canary.
unit str The unit stem.
base str The commit the run judged against.
status str completed or aborted.
accepted bool | None The verdict, None if the run has none.
final_attempt int | None The attempt of the final module, None if there is none.
attempts tuple[Attempt, …] The attempts in order.
has_report bool Whether report.md exists.
files tuple[str, …] The names of the files in the directory, sorted.

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"
)

with TemporaryDirectory() as tmp:
    (Path(tmp) / "run.toml").write_text(record)
    print(read_run(Path(tmp)).files)
('run.toml',)

Methods

Name Description
attempt The attempt n.

attempt

review.runs.Run.attempt(n)

The attempt n.

Raises

Name Type Description
ConfigurationError If the run has no such attempt.