NVIDIA-NeMo/RL #5048
(part 2 of a stack that starts at #5011;
#5049 builds on it).
All permalinks pin the PR head 8c75341b.
rollout_checkpointing.trace (off by default). When on, the controller writes one JSON line
per rollout event to rollout_trace.jsonl in the log folder.The PR adds a small writer, RolloutTrace,
and one hook on the ledger, set_event_sink.
Every time the ledger changes a try's state, it calls the hook, so the ledger's 15 change points need no logging code of their own.
The train pump, weight sync, snapshotter and restorer add six more events.
Each line has the wall-clock time t and a run id that is new per process, so two runs can share one file.
The numbers are made up but every event and field name is real. To get a stop's thrown-away time, take each
attempt_abandoned with reason: "restart" (line 5) and find that try's last
attempt_dispatched (line 1). The thrown-away time runs from that dispatch to the snapshot's
cut_time (line 3), here 40 โ 12 = 28 s. The design doc gives this rule
(design doc L230-238).
The totals that existed before
(restarted_rollouts,
restore timings)
would say only "1 rollout restarted".
Nothing below is implemented. The PR is 694 added lines; 348 of them are one test file and 126 are the writer. No existing writer in the repo fits better. The review checked these:
QueueListener, which prints a traceback on every failed write;So the savings come from writing less, not from reusing more.
The writer's thread stays. The PR writes each line from a background thread, so the event loop never waits on the disk. Timed with 2 million events on a laptop SSD, the event loop spends 2.5 ยตs per event with the thread and 3.6 ยตs writing each line directly. At the 1B example's 1,150 events per step that is nothing. At a million events per step (hundreds of thousands of rollouts) it is about a second per step, and every direct write is a system call on the event loop, which on a shared filesystem can stall far longer. Removing the thread would save about 40 lines, but it is not worth that risk.
The cuts the review does ask for, about 55โ65 lines:
| Ask | Lines | Comment |
|---|---|---|
| Test file: one table test for the ledger event orders, drop a check that overlaps the off-by-default test, move the cancelled-vs-failed check next to the rollout-manager test that owns it | โ โ40 to โ50 | C9, C8 |
| Design doc: replace the event table (already wrong in three places) with a short section on how to turn tracing on and read the file | โ โ14 | C6 |
Event list written out in five places: keep one list, in the trace.py docstring, and point to it from the rest | โ โ8 | C7 |
Small cleanups: a redundant enabled check, a getattr fallback that never runs | โ โ3 | C5, C11 |
| Additions: skip the ledger copy when tracing is off; skip re-reporting a try abandoned before the stop; a test for the "failed" label | โ +10 | C2, C3, C8 |
๐ฌ C3 โ rollout_recovery.py:841-847C4 โ rollout_recovery.py:863-872
The review comments above are pending until the review is published; until then the links open only for the reviewer.