bencher.utils_rerun

Rerun SDK integration for bencher — capture live recordings.

This module requires the rerun-sdk package. For functions that work with pre-recorded .rrd files without the SDK, see utils_rrd.py.

Architecture

Displaying rerun data inside a Panel/Bokeh report requires two pieces:

  1. Data capturecapture_rerun_rrd() drains the in-memory rerun recording to a complete .rrd file on disk. Using rr.save() (which streams to an open file) does NOT work because the file is still being written when the viewer tries to fetch it. Always call rr.log(...) first, then capture_rerun_rrd() / capture_rerun_window().

  2. Viewerrrd_file_to_pane() (in utils_rrd.py) writes a small HTML page that loads the @rerun-io/web-viewer from CDN and points it at the .rrd file. Both the viewer page and the data are served by the Panel server at /rrd_static/, keeping everything on the same HTTP origin (no CORS, no extra ports).

Functions

_ensure_rerun_init()

Ensure a rerun recording exists, creating one if needed.

capture_rerun_rrd(→ str)

Save the current rerun recording to an .rrd file and return the path.

rerun_to_pane([width, height, recording])

Render the current rerun recording as an inline HTML pane.

capture_rerun_window(→ str)

Capture the current rerun recording and return the .rrd file path.

Module Contents

bencher.utils_rerun._ensure_rerun_init()

Ensure a rerun recording exists, creating one if needed.

bencher.utils_rerun.capture_rerun_rrd(recording: rerun.RecordingStream | None = None) str

Save the current rerun recording to an .rrd file and return the path.

Data must be logged BEFORE calling this function so that the in-memory recording has content to drain. Calls rr.init() automatically if no recording exists yet.

bencher.utils_rerun.rerun_to_pane(width: int = 950, height: int = 712, recording: rerun.RecordingStream | None = None)

Render the current rerun recording as an inline HTML pane.

bencher.utils_rerun.capture_rerun_window(recording: rerun.RecordingStream | None = None, **_kwargs) str

Capture the current rerun recording and return the .rrd file path.

Data must be logged BEFORE calling this function so that the in-memory recording has content to drain. The returned path is stored by ResultRerun; rendering into an HTML viewer pane happens later via ResultRerun.to_container().

Viewer dimensions (width/height) are now taken from the ResultRerun descriptor. Passing them here is deprecated and they will be ignored.