Skip to content

sinks.py

rerun.sinks

def connect(addr=None, flush_timeout_sec=2.0, recording=None)

Connect to a remote Rerun Viewer on the given ip:port.

Requires that you first start a Rerun Viewer by typing 'rerun' in a terminal.

This function returns immediately.

Parameters:

Name Type Description Default
addr str | None

The ip:port to connect to

None
flush_timeout_sec float | None

The minimum time the SDK will wait during a flush before potentially dropping data if progress is not being made. Passing None indicates no timeout, and can cause a call to flush to block indefinitely.

2.0
recording RecordingStream | None

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def save(path, recording=None)

Stream all log-data to a file.

Parameters:

Name Type Description Default
path str

The path to save the data to.

required
recording RecordingStream | None

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def disconnect(recording=None)

Closes all TCP connections, servers, and files.

Closes all TCP connections, servers, and files that have been opened with [rerun.connect], [rerun.serve], [rerun.save] or [rerun.spawn].

Parameters:

Name Type Description Default
recording RecordingStream | None

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def memory_recording(recording=None)

Streams all log-data to a memory buffer.

This can be used to display the RRD to alternative formats such as html. See: [rerun.MemoryRecording.as_html][].

Parameters:

Name Type Description Default
recording RecordingStream | None

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

Returns:

Type Description
MemoryRecording

A memory recording object that can be used to read the data.

def serve(open_browser=True, web_port=None, ws_port=None, recording=None)

Serve log-data over WebSockets and serve a Rerun web viewer over HTTP.

You can also connect to this server with the native viewer using rerun localhost:9090.

WARNING: This is an experimental feature.

This function returns immediately.

Parameters:

Name Type Description Default
open_browser bool

Open the default browser to the viewer.

True
web_port int | None

The port to serve the web viewer on (defaults to 9090).

None
ws_port int | None

The port to serve the WebSocket server on (defaults to 9877)

None
recording RecordingStream | None

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def spawn(port=9876, connect=True, recording=None)

Spawn a Rerun Viewer, listening on the given port.

This is often the easiest and best way to use Rerun. Just call this once at the start of your program.

You can also call rerun.init with a spawn=True argument.

Parameters:

Name Type Description Default
port int

The port to listen on.

9876
connect bool

also connect to the viewer and stream logging data to it.

True
recording RecordingStream | None

Specifies the rerun.RecordingStream to use if connect = True. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None