Skip to content

Server

rerun.server

class 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")
def __enter__()

Enter the context manager, returning the server instance.

def __exit__(exc_type, exc_value, traceback)

Exit the context manager, shutting down the server.

def __init__(*, host='0.0.0.0', port=None, datasets=None, tables=None, addr='0.0.0.0')

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'

def address() deprecated
Deprecated

Renamed to url.

def client()

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.

def host()

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

def is_running()

Check if the server is currently running.

RETURNS DESCRIPTION
bool

True if the server is running, False otherwise.

def shutdown()

Stop the server.

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

RAISES DESCRIPTION
RuntimeError

If the server is not running.

def url()

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