Record with each archived verdict the setup that ran it, what each model spent by kind, and the human's reversals
CI / tests (pull_request) Failing after 2m12s
CI / tests (pull_request) Failing after 2m12s
This commit is contained in:
@@ -3,7 +3,7 @@ import pathlib
|
||||
|
||||
from transcript_archive.location import chunk_folder, FILE_SUFFIX, transcript_of
|
||||
from failure import Failure
|
||||
from transcript_archive.outcomes import FINISHED_AT, workers
|
||||
from transcript_archive.outcomes import FINISHED_AT, spent_stamps, workers
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -66,3 +66,14 @@ def latest_worker(project_archive: pathlib.Path, transcript: str) -> str | Failu
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read the archive {project_archive}: {failure}")
|
||||
return None
|
||||
|
||||
|
||||
def last_spent(project_archive: pathlib.Path, transcript: str) -> str | Failure:
|
||||
"""The UTC stamp of the latest outcome in the transcript's chunk that records a spend; empty before any. Stamps share one format, so the greatest is the latest."""
|
||||
try:
|
||||
with open(transcript, "rb") as handle:
|
||||
folder = chunk_folder(project_archive, handle.read())
|
||||
stamps = [stamp for path in chunk_outcomes(folder) for stamp in spent_stamps(path.read_text(encoding="utf-8"))]
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read the archive {project_archive}: {failure}")
|
||||
return max(stamps, default="")
|
||||
|
||||
Reference in New Issue
Block a user