Download scripts/_lib.py from ppak10/Agentic-SLS-Telemetry: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/datasets/ppak10/Agentic-SLS-Telemetry/resolve/main/scripts/_lib.py
- Command line
-
hf download hf://datasets/ppak10/Agentic-SLS-Telemetry/scripts/_lib.py
-
curl -L -o _lib.py https://huggingface.co/datasets/ppak10/Agentic-SLS-Telemetry/resolve/main/scripts/_lib.py
1.95 kB
| """Shared paths and helpers for the extract scripts. | |
| Raw data lives in this dataset's own source/ tree (source-based layout, | |
| 2026-07-16); extract scripts read source/ and write to data/. | |
| """ | |
| import json | |
| from pathlib import Path | |
| ROOT = Path(__file__).parent.parent | |
| DATA_DIR = ROOT / "data" | |
| # Since 2026-07-16 this dataset is source-based: raw inputs live in OUR OWN | |
| # source/ tree (written by the recorder repo's `sls-export` / | |
| # `sls-deliver-frames`). data/exports in the recorder repo is retired. | |
| # AGENTIC_ROOT still points at the containing recorder repo (submodule, | |
| # two climbs) — used only for the transient frame buffer of builds not yet | |
| # delivered into source/frames/ zips. | |
| AGENTIC_ROOT = ROOT.parent.parent | |
| SOURCE_DIR = ROOT / "source" | |
| EXPORTS_DIR = SOURCE_DIR / "recorder" # builds/events/frames jsonl + sensors.csv | |
| TELEMETRY_DIR = SOURCE_DIR / "telemetry" # {NNN}.parquet raw ticks | |
| POSITION_DIR = SOURCE_DIR / "position_hf" # {NNN}.parquet | |
| FRAMES_BUFFER = AGENTIC_ROOT / "data" / "frames" # pre-delivery loose frames | |
| def iter_jsonl(path: Path): | |
| """Stream a JSONL file row-by-row. Skips blank lines.""" | |
| with path.open(encoding="utf-8") as f: | |
| for line in f: | |
| line = line.strip() | |
| if not line: | |
| continue | |
| yield json.loads(line) | |
| def load_build_to_profile_name() -> dict[int, str]: | |
| """Read upstream events.jsonl, return {build_id: printProfileName}. | |
| Uses the `build_start` event's `payload.printProfileName` field. Builds | |
| that never logged a build_start event (the recorder joined mid-run) are | |
| omitted from the map. | |
| """ | |
| events_path = EXPORTS_DIR / "events.jsonl" | |
| out: dict[int, str] = {} | |
| for ev in iter_jsonl(events_path): | |
| if ev.get("kind") != "build_start": | |
| continue | |
| name = (ev.get("payload") or {}).get("printProfileName") | |
| if name: | |
| out[ev["build_id"]] = name | |
| return out | |