Skip to content

Server

rerun.server

Server

A Rerun server instance.

This class allows you to start and manage a Rerun server programmatically. The server hosts recordings and serves them via HTTP, and provides access to the catalog through a client connection. When the object goes out of scope the server is automatically shut down.

The server can be used as a context manager, which will automatically shut down the server when exiting the context.

Example
import rerun as rr

# Start a server with some datasets
with rr.server.Server(port=9876, datasets={"my_data": ["path/to/data.rrd"]}) as server:
    client = server.client()

    # Use the client to interact with the catalog
    dataset = client.get_dataset("my_data")
__enter__
def __enter__() -> Self

Enter the context manager, returning the server instance.

__exit__
def __exit__(
    exc_type: type[BaseException] | None,
    exc_value: BaseException | None,
    traceback: TracebackType | None,
) -> None

Exit the context manager, shutting down the server.

__init__
def __init__(
    *,
    host: str = "0.0.0.0",
    port: int | None = None,
    datasets: dict[
        str,
        str | PathLike[str] | Sequence[str | PathLike[str]],
    ]
    | None = None,
    tables: dict[str, PathLike[str]] | None = None,
    addr: str = "0.0.0.0",
) -> None

Create a new Rerun server instance and start it.

The server will host recordings and serve them via HTTP. If datasets are provided, they will be loaded and made available when the server starts.

PARAMETER DESCRIPTION
host

The IP address to bind the server to.

TYPE: str DEFAULT: '0.0.0.0'

port

The port to bind the server to, or None to select a random available port.

TYPE: int | None DEFAULT: None

datasets

Optional dictionary specifying dataset to load in the server at startup. Values in the dictionary may be either of: - a single path: must be a directory, all the RRDs it contains will be registered - a sequence of paths: each path must be a RRD file, which will all be registered

TYPE: dict[str, str | PathLike[str] | Sequence[str | PathLike[str]]] | None DEFAULT: None

tables

Optional dictionary mapping table names to lance file paths which will be loaded and made available when the server starts.

TYPE: dict[str, PathLike[str]] | None DEFAULT: None

addr

Deprecated: Renamed to host

TYPE: str DEFAULT: '0.0.0.0'

address deprecated
def address() -> str
Deprecated

Renamed to url.

client
def client() -> CatalogClient

Get a CatalogClient connected to this server.

The client can be used to interact with the server's catalog, including querying datasets and tables.

Note: the datafusion package is required to use the client. The client initialization will fail with an error if the package is not installed.

RETURNS DESCRIPTION
CatalogClient

A client for interacting with the server's catalog.

RAISES DESCRIPTION
RuntimeError

If the server is not running.

host
def host() -> str

Get the host (IP) that we've bound the server to.

is_running
def is_running() -> bool

Check if the server is currently running.

RETURNS DESCRIPTION
bool

True if the server is running, False otherwise.

shutdown
def shutdown() -> None

Stop the server.

After calling this method, the server will no longer be accessible.

RAISES DESCRIPTION
RuntimeError

If the server is not running.

url
def url() -> str

Get the URL of the server to which clients can connect.