rerun-io / rerun

Visualize streams of multimodal data. Free, fast, easy to use, and simple to integrate. Built in Rust.
https://rerun.io/
Apache License 2.0
6.49k stars 320 forks source link

Support for `rr.spawn(serve=True)` for multiprocess web-viewing #7768

Open teh-cmc opened 2 weeks ago

teh-cmc commented 2 weeks ago

Users want to be able to log to the web-viewer from multiple processes, just like they do with the native viewer.

This requires an intermediate proxy, so all the data can go through a single websocket port, which the web-viewer then knows to poll. The solution today is to manually start a tcp+websocket server with rerun --serve, then just use rr.connect() in all your clients.

That manual step is annoying, and AFAICT, could be automated away by augmenting rr.spawn().

All rr.spawn() does is basically fork_exec("rerun --port={port}"). We could add an extra serve: bool parameter, and then rr.spawn(serve=True) would bottom out in fork_exec("rerun --port={port} --serve"). Assuming our usual policy of "silently re-use the existing instance in case of conflicted ports", that means every client could just call rr.spawn(serve=True) and voila, all the processes are logging to the same web-viewer.

Related:

teh-cmc commented 1 week ago

And now that I'm documenting the application model (#919), I'm realizing that doing this would provide a level of consistency that would allow me to concisely state:

rr.spawn(serve=False) = rerun &
rr.spawn(serve=True)  = rerun --serve &

and that would be very nice.