Skip to content

EMRY-023: File watch + v1 JSONL tail - #65

Merged
vxfemboy merged 2 commits into
mainfrom
emry-023-file-watch
Jun 25, 2026
Merged

EMRY-023: File watch + v1 JSONL tail#65
vxfemboy merged 2 commits into
mainfrom
emry-023-file-watch

Conversation

@vxfemboy

Copy link
Copy Markdown
Member

Closes #18 (EMRY-023). Branched off main. First emry-ingest work.

What

crates/emry-ingest/src/watch.rsJsonlTailer offset-polls a metrics.jsonl file and parses appended rows into Event::MetricsBatch:

  • Lenient parse (epoch/phase default) so minimal third-party / v1 files with just step + values parse.
  • Holds partial trailing lines until newline-complete; restarts on truncation/rotation; per-line UTF-8 decode skipping+counting garbage.
  • labels() exposes discovered metric names so the TUI can resolve them from the file.
  • run_watch is the thin, resilient poll loop.

Design: polling, not inotify

Deliberate — the target is HPC (SLURM / NFS), where inotify is unreliable over network filesystems. Offset polling is robust there and dep-free; latency is bounded by the poll interval (fine for a human-watched dashboard).

Verification

  • ./scripts/pre-commit-rust.sh green: clippy -D warnings, 10 ingest tests, watch.rs 97.8% lines, total 96.78%
  • Tests: Emry rows, minimal third-party rows, append-across-polls offset tracking, partial-line hold, garbage/blank skip+count, truncation restart, invalid-UTF-8 skip, run_watch stop

Review-driven fixes

  • Per-line UTF-8 decode (a bad line is skipped, not fatal to the poll).
  • run_watch retries transient I/O errors instead of dying (NFS robustness).

Scope

Live emry watch → TUI wiring is EMRY-025.

vxfemboy added 2 commits June 25, 2026 07:46
JsonlTailer offset-polls a metrics.jsonl file and parses appended rows into
Event::MetricsBatch, leniently (epoch/phase default, so minimal third-party
files parse). Holds partial trailing lines until complete, restarts on
truncation/rotation, skips+counts garbage lines, exposes labels() for the TUI.
run_watch is the thin poll loop. Polling (not inotify) is deliberate: robust
over NFS on HPC. Live TUI wiring lands in EMRY-025.
- poll() decodes each line independently; an invalid-UTF-8 line is skipped and
  counted instead of aborting the whole poll (third-party files mustn't take
  down the watcher).
- run_watch swallows transient poll errors and retries rather than terminating
  on the first I/O hiccup (NFS/HPC robustness).
@vxfemboy
vxfemboy merged commit 9e0d327 into main Jun 25, 2026
3 checks passed
@vxfemboy
vxfemboy deleted the emry-023-file-watch branch July 2, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EMRY-023: File watch + v1 JSONL tail

1 participant