Initialization
def rerun.init(application_id, recording_id=None, spawn=False, default_enabled=True, strict=False)
Initialize the Rerun SDK with a user-chosen application id (name).
You must call this function first in order to initialize a global recording. Without an active recording, all methods of the SDK will turn into no-ops.
For more advanced use cases, e.g. multiple recordings setups, see rerun.new_recording
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
application_id |
str
|
Your Rerun recordings will be categorized by this application id, so try to pick a unique one for each application that uses the Rerun SDK. For example, if you have one application doing object detection
and another doing camera calibration, you could have
|
required |
recording_id |
Optional[str]
|
Set the recording ID that this process is logging to, as a UUIDv4. The default recording_id is based on If you are not using |
None
|
spawn |
bool
|
Spawn a Rerun Viewer and stream logging data to it.
Short for calling |
False
|
default_enabled |
bool
|
Should Rerun logging be on by default?
Can overridden with the RERUN env-var, e.g. |
True
|
strict |
bool
|
If |
False
|
def rerun.connect(addr=None, recording=None)
Connect to a remote Rerun Viewer on the given ip:port.
Requires that you first start a Rerun Viewer, e.g. with 'python -m rerun'
This function returns immediately.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
addr |
str | None
|
The ip:port to connect to |
None
|
recording |
RecordingStream | None
|
Specifies the |
None
|
def rerun.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 |
None
|
def rerun.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 |
None
|
def rerun.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 connect to this server using python -m rerun
.
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 |
None
|
def rerun.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 |
None
|
Returns:
Type | Description |
---|---|
MemoryRecording
|
A memory recording object that can be used to read the data. |