Answer architecture round 3: 0 🔴, 1 🟡; test routing's plan and archive sources, read the newest outcomes file for a rerun's rung, and note the archive reads Rung's wording
This commit is contained in:
@@ -37,11 +37,19 @@ def read_threads(chunk: FinishedChunk) -> list[bytes] | Failure:
|
||||
|
||||
|
||||
def latest_worker(project_archive: pathlib.Path, transcript: str) -> str | Failure | None:
|
||||
"""The worker the latest verdict archived for the transcript's chunk names; None before its first verdict."""
|
||||
"""The worker the latest outcome archived for the transcript's chunk names; None before its first verdict.
|
||||
|
||||
Stamps run to the second, so the newest outcomes file decides, and in it the last outcome naming a worker.
|
||||
"""
|
||||
try:
|
||||
with open(transcript, "rb") as handle:
|
||||
folder = chunk_folder(project_archive, handle.read())
|
||||
found = sorted(stamped for outcomes in folder.glob("*.outcomes.md") for stamped in workers(outcomes.read_text(encoding="utf-8")))
|
||||
if not folder.is_dir():
|
||||
return None
|
||||
files = sorted((path for path in folder.iterdir() if path.name.endswith(".outcomes.md")), key=lambda path: path.stat().st_mtime_ns, reverse=True)
|
||||
for path in files:
|
||||
if found := workers(path.read_text(encoding="utf-8")):
|
||||
return found[-1][1]
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read the archive {project_archive}: {failure}")
|
||||
return found[-1][1] if found else None
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user