INNER CODE UNIT · Python
python_run
kevinpbuckley/VibeUE · Content/Python/vibeue.py:259
def python_run(run_id, pid=None):
"""The persisted record for a specific runId from python-<pid>-runs.jsonl (a dict), or None if it
is not present (it may have been trimmed — the history keeps the last ~200 runs / ~2 MB)."""
try:
with open(_runs_path(pid), "r", encoding="utf-8") as handle:
lines = handle.readlines()
except OSError:
return None
for line in reversed(lines):
line = line.strip()
if not line:
continue
try:
record = json.loads(line)
except ValueError:
continue
if record.get("runId") == run_id:
return record