Skip to content

Commit

Permalink
Fix the python build when running without web_viewer enabled (#1856)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs authored Apr 14, 2023
1 parent 13c96bb commit b4190d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ pub use rerun::{
coordinates::{Axis3, Handedness, Sign, SignedAxis3},
};

#[cfg(feature = "web_viewer")]
use re_web_viewer_server::WebViewerServerPort;
#[cfg(feature = "web_viewer")]
use re_ws_comms::RerunServerPort;

use crate::{arrow::get_registered_component_names, python_session::PythonSession};
Expand Down Expand Up @@ -305,6 +307,7 @@ fn connect(addr: Option<String>) -> PyResult<()> {
}

#[must_use = "the tokio_runtime guard must be kept alive while using tokio"]
#[cfg(feature = "web_viewer")]
fn enter_tokio_runtime() -> tokio::runtime::EnterGuard<'static> {
use once_cell::sync::Lazy;
static TOKIO_RUNTIME: Lazy<tokio::runtime::Runtime> =
Expand Down Expand Up @@ -341,6 +344,8 @@ fn serve(open_browser: bool, web_port: Option<u16>, ws_port: Option<u16>) -> PyR

#[cfg(not(feature = "web_viewer"))]
{
_ = web_port;
_ = ws_port;
_ = open_browser;
Err(PyRuntimeError::new_err(
"The Rerun SDK was not compiled with the 'web_viewer' feature",
Expand All @@ -362,7 +367,7 @@ fn start_web_viewer_server(port: u16) -> PyResult<()> {

#[cfg(not(feature = "web_viewer"))]
{
_ = open_browser;
_ = port;
Err(PyRuntimeError::new_err(
"The Rerun SDK was not compiled with the 'web_viewer' feature",
))
Expand Down
2 changes: 2 additions & 0 deletions rerun_py/src/python_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use re_log_types::{
RecordingId, RecordingInfo, RecordingSource, RowId, Time, TimePoint,
};

#[cfg(feature = "web_viewer")]
use re_web_viewer_server::WebViewerServerPort;
use rerun::sink::LogSink;
// ----------------------------------------------------------------------------
Expand All @@ -16,6 +17,7 @@ pub enum PythonSessionError {
#[error("The Rerun SDK was not compiled with the '{0}' feature")]
FeatureNotEnabled(&'static str),

#[cfg(feature = "web_viewer")]
#[error("Could not start the WebViewerServer: '{0}'")]
WebViewerServerError(#[from] re_web_viewer_server::WebViewerServerError),
}
Expand Down

1 comment on commit b4190d8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: b4190d8 Previous: 13c96bb Ratio
datastore/num_rows=1000/num_instances=1000/packed=false/insert/default 2847751 ns/iter (± 34856) 2925152 ns/iter (± 316127) 0.97
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/default 370 ns/iter (± 2) 370 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/default 260 ns/iter (± 0) 260 ns/iter (± 0) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/default 422 ns/iter (± 0) 422 ns/iter (± 0) 1
datastore/num_rows=1000/num_instances=1000/packed=false/range/default 2999476 ns/iter (± 28180) 3043142 ns/iter (± 99446) 0.99
datastore/num_rows=1000/num_instances=1000/gc/default 2420591 ns/iter (± 2880) 2445693 ns/iter (± 7904) 0.99
mono_points_arrow/generate_message_bundles 26826839 ns/iter (± 744096) 30722506 ns/iter (± 1597081) 0.87
mono_points_arrow/generate_messages 114183438 ns/iter (± 852589) 126403609 ns/iter (± 1285930) 0.90
mono_points_arrow/encode_log_msg 143765178 ns/iter (± 895926) 153803332 ns/iter (± 1347963) 0.93
mono_points_arrow/encode_total 289393350 ns/iter (± 1281828) 311618858 ns/iter (± 2211347) 0.93
mono_points_arrow/decode_log_msg 178514877 ns/iter (± 697647) 189564710 ns/iter (± 1521711) 0.94
mono_points_arrow/decode_message_bundles 59669624 ns/iter (± 798964) 65621108 ns/iter (± 1694835) 0.91
mono_points_arrow/decode_total 237518838 ns/iter (± 1321654) 257951266 ns/iter (± 3662200) 0.92
mono_points_arrow_batched/generate_message_bundles 19774388 ns/iter (± 1034473) 20185950 ns/iter (± 1792327) 0.98
mono_points_arrow_batched/generate_messages 4163255 ns/iter (± 97644) 4122678 ns/iter (± 121283) 1.01
mono_points_arrow_batched/encode_log_msg 1380681 ns/iter (± 5217) 1373566 ns/iter (± 23586) 1.01
mono_points_arrow_batched/encode_total 26578968 ns/iter (± 890823) 26744874 ns/iter (± 1286387) 0.99
mono_points_arrow_batched/decode_log_msg 783030 ns/iter (± 3452) 775195 ns/iter (± 4575) 1.01
mono_points_arrow_batched/decode_message_bundles 7757235 ns/iter (± 148031) 7342490 ns/iter (± 105293) 1.06
mono_points_arrow_batched/decode_total 8510259 ns/iter (± 113219) 8339273 ns/iter (± 100887) 1.02
batch_points_arrow/generate_message_bundles 193400 ns/iter (± 503) 196481 ns/iter (± 949) 0.98
batch_points_arrow/generate_messages 5210 ns/iter (± 17) 5049 ns/iter (± 46) 1.03
batch_points_arrow/encode_log_msg 259841 ns/iter (± 852) 258727 ns/iter (± 1953) 1.00
batch_points_arrow/encode_total 483714 ns/iter (± 1722) 488076 ns/iter (± 4209) 0.99
batch_points_arrow/decode_log_msg 211450 ns/iter (± 914) 209579 ns/iter (± 1120) 1.01
batch_points_arrow/decode_message_bundles 1903 ns/iter (± 8) 1879 ns/iter (± 8) 1.01
batch_points_arrow/decode_total 219484 ns/iter (± 638) 220401 ns/iter (± 1753) 1.00
arrow_mono_points/insert 2318550289 ns/iter (± 8821190) 2556873571 ns/iter (± 10169217) 0.91
arrow_mono_points/query 1205785 ns/iter (± 8743) 1170238 ns/iter (± 13280) 1.03
arrow_batch_points/insert 1153646 ns/iter (± 3141) 1164617 ns/iter (± 10801) 0.99
arrow_batch_points/query 14318 ns/iter (± 46) 14442 ns/iter (± 111) 0.99
arrow_batch_vecs/insert 26389 ns/iter (± 76) 26589 ns/iter (± 105) 0.99
arrow_batch_vecs/query 325304 ns/iter (± 981) 325939 ns/iter (± 731) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.