Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 26, 2023
1 parent 72b1eca commit eff9ed5
Show file tree
Hide file tree
Showing 68 changed files with 77 additions and 68 deletions.
1 change: 1 addition & 0 deletions crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ fn spawn(opts: &crate::SpawnOptions) -> RecordingStreamResult<()> {

let connect_addr = opts.connect_addr();

// TODO(#4019): application-level handshake
if TcpStream::connect_timeout(&connect_addr, Duration::from_secs(1)).is_ok() {
re_log::info!(
addr = %opts.listen_addr(),
Expand Down
11 changes: 10 additions & 1 deletion crates/re_sdk/src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub struct SpawnOptions {
///
/// Unspecified by default.
pub executable_path: Option<String>,

/// Extra arguments that will be passed as-is to the Rerun Viewer process.
pub extra_args: Vec<String>,
}

// NOTE: No need for .exe extension on windows.
Expand All @@ -49,6 +52,7 @@ impl Default for SpawnOptions {
memory_limit: "75%".into(),
executable_name: RERUN_BINARY.into(),
executable_path: None,
extra_args: Vec::new(),
}
}
}
Expand Down Expand Up @@ -116,6 +120,9 @@ impl std::fmt::Debug for SpawnError {

/// Spawns a new Rerun Viewer process ready to listen for TCP connections.
///
/// If there is already a process listening on this port (Rerun or not), this function returns `Ok`
/// WITHOUT spawning a `rerun` process (!).
///
/// Refer to [`SpawnOptions`]'s documentation for configuration options.
///
/// This only starts a Viewer process: if you'd like to connect to it and start sending data, refer
Expand All @@ -140,7 +147,8 @@ pub fn spawn(opts: &SpawnOptions) -> Result<(), SpawnError> {
let memory_limit = &opts.memory_limit;
let executable_path = opts.executable_path();

if TcpStream::connect_timeout(&connect_addr, Duration::from_millis(1)).is_ok() {
// TODO(#4019): application-level handshake
if TcpStream::connect_timeout(&connect_addr, Duration::from_secs(1)).is_ok() {
re_log::info!(
addr = %opts.listen_addr(),
"A process is already listening at this address. Assuming it's a Rerun Viewer."
Expand All @@ -152,6 +160,7 @@ pub fn spawn(opts: &SpawnOptions) -> Result<(), SpawnError> {
.arg(format!("--port={port}"))
.arg(format!("--memory-limit={memory_limit}"))
.arg("--skip-welcome-screen")
.args(opts.extra_args.clone())
.spawn();

let rerun_bin = match res {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/annotation_context.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/arrows3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/asset3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/bar_chart.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/boxes2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/boxes3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/depth_image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/disconnected_space.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/line_strips2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/line_strips3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/mesh3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/pinhole.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/points2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/points3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/segmentation_image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/tensor.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/text_log.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/time_series_scalar.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/transform3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/view_coordinates.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types_core/src/archetypes/clear.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/code-examples/annotation_context_connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_connections")
.spawn(None)?;
.spawn(rerun::default_flush_timeout())?;

// Log an annotation context to assign a label and color to each class
// Create a class description with labels and color for each keypoint ID as well as some
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/annotation_context_rects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec =
rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_rects").spawn(None)?;
rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_rects").spawn(rerun::default_flush_timeout())?;

// Log an annotation context to assign a label and color to each class
rec.log_timeless(
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/annotation_context_segmentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ndarray::{s, Array, ShapeBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_segmentation")
.spawn(None)?;
.spawn(rerun::default_flush_timeout())?;

// create an annotation context to describe the classes
rec.log_timeless(
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/arrow3d_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::f32::consts::TAU;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_arrow3d").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_arrow3d").spawn(rerun::default_flush_timeout())?;

let origins = vec![rerun::Position3D::ZERO; 100];
let (vectors, colors): (Vec<_>, Vec<_>) = (0..100)
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/asset3d_out_of_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() -> anyhow::Result<()> {
};

let rec =
rerun::RecordingStreamBuilder::new("rerun_example_asset3d_out_of_tree").spawn(None)?;
rerun::RecordingStreamBuilder::new("rerun_example_asset3d_out_of_tree").spawn(rerun::default_flush_timeout())?;

rec.log_timeless("world", &rerun::ViewCoordinates::RIGHT_HAND_Z_UP)?; // Set an up-axis

Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/asset3d_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() -> anyhow::Result<()> {
anyhow::bail!("Usage: {} <path_to_asset.[gltf|glb|obj]>", args[0]);
};

let rec = rerun::RecordingStreamBuilder::new("rerun_example_asset3d_simple").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_asset3d_simple").spawn(rerun::default_flush_timeout())?;

rec.log_timeless("world", &rerun::ViewCoordinates::RIGHT_HAND_Z_UP)?; // Set an up-axis
rec.log("world/asset", &rerun::Asset3D::from_file(path)?)?;
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/bar_chart.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Create and log a bar chart
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_bar_chart").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_bar_chart").spawn(rerun::default_flush_timeout())?;

rec.log(
"bar_chart",
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/box2d_simple.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Log some very simple 2D boxes.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box2d").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box2d").spawn(rerun::default_flush_timeout())?;

rec.log(
"simple",
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/box3d_batch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Log a batch of oriented bounding boxes.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box3d_batch").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box3d_batch").spawn(rerun::default_flush_timeout())?;

rec.log(
"batch",
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/box3d_simple.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Log a single 3D box.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box3d").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_box3d").spawn(rerun::default_flush_timeout())?;

rec.log(
"simple",
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/clear_recursive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rerun::external::glam;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_clear_recursive").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_clear_recursive").spawn(rerun::default_flush_timeout())?;

#[rustfmt::skip]
let (vectors, origins, colors) = (
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/clear_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rerun::external::glam;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_clear_simple").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_clear_simple").spawn(rerun::default_flush_timeout())?;

#[rustfmt::skip]
let (vectors, origins, colors) = (
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/custom_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl rerun::Loggable for Confidence {
// ---

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_custom_data").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_custom_data").spawn(rerun::default_flush_timeout())?;

rec.log(
"left/my_confident_point_cloud",
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/depth_image_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use ndarray::{s, Array, ShapeBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_depth_image").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_depth_image").spawn(rerun::default_flush_timeout())?;

let mut image = Array::<u16, _>::from_elem((200, 300).f(), 65535);
image.slice_mut(s![50..150, 50..150]).fill(20000);
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/depth_image_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use ndarray::{s, Array, ShapeBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_depth_image").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_depth_image").spawn(rerun::default_flush_timeout())?;

let mut image = Array::<u16, _>::from_elem((200, 300).f(), 65535);
image.slice_mut(s![50..150, 50..150]).fill(20000);
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/disconnected_space.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Disconnect two spaces.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_disconnected_space").spawn(None)?;
let rec = rerun::RecordingStreamBuilder::new("rerun_example_disconnected_space").spawn(rerun::default_flush_timeout())?;

// These two points can be projected into the same space..
rec.log(
Expand Down
Loading

0 comments on commit eff9ed5

Please sign in to comment.