Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flushing race in new multi-recording SDK #2125

Merged
merged 2 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,16 @@ impl RecordingStream {
return;
};

// TODO(cmc): The `Goodbye` message is our last remaining message piece that is neither
// idempotent, stateless, nor order insensitive... so make sure to get all the pending
// tables into the pipe first.

// 1. Flush the batcher down the table channel
this.batcher.flush_blocking();

// 2. Drain all pending tables from the batcher's channel _before_ any other future command
this.cmds_tx.send(Command::PopPendingTables).ok();

this.cmds_tx
.send(Command::RecordMsg(LogMsg::Goodbye(
this.info.recording_id.clone(),
Expand Down
23 changes: 23 additions & 0 deletions examples/python/minimal_options/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3

"""Demonstrates the most barebone usage of the Rerun SDK, with standard options."""


import argparse

import numpy as np
import rerun as rr

parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.")
rr.script_add_args(parser)
args, unknown = parser.parse_known_args()
[__import__("logging").warning(f"unknown arg: {arg}") for arg in unknown]

rr.script_setup(args, "minimal_options")

positions = np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-5, 5, 10j)]]]).T
colors = np.vstack([rgb.ravel() for rgb in np.mgrid[3 * [slice(0, 255, 10j)]]]).astype(np.uint8).T

rr.log_points("my_points", positions=positions, colors=colors)

rr.script_teardown(args)
2 changes: 2 additions & 0 deletions examples/python/minimal_options/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy
rerun-sdk
1 change: 1 addition & 0 deletions examples/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-r dicom/requirements.txt
-r dna/requirements.txt
-r minimal/requirements.txt
-r minimal_options/requirements.txt
-r mp_pose/requirements.txt
-r multiprocessing/requirements.txt
-r multithreading/requirements.txt
Expand Down
2 changes: 2 additions & 0 deletions scripts/run_python_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main() -> None:
requirements = [
"examples/python/api_demo/requirements.txt",
"examples/python/car/requirements.txt",
"examples/python/minimal_options/requirements.txt",
"examples/python/multithreading/requirements.txt",
"examples/python/plots/requirements.txt",
"examples/python/text_logging/requirements.txt",
Expand All @@ -61,6 +62,7 @@ def main() -> None:
# Trivial examples that don't require weird dependencies, or downloading data
("examples/python/api_demo/main.py", ["--demo", "all"]),
("examples/python/car/main.py", []),
("examples/python/minimal_options/main.py", []),
("examples/python/multithreading/main.py", []),
("examples/python/plots/main.py", []),
("examples/python/text_logging/main.py", []),
Expand Down