From 2a9c9d4fe302125113e9eec2fcec8a21c8996273 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Wed, 22 Mar 2023 13:53:01 +0800 Subject: [PATCH 1/3] Remove unnecessary `unwrap` that cause a panic --- apis/python/node/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apis/python/node/src/lib.rs b/apis/python/node/src/lib.rs index d50069c6..fa580972 100644 --- a/apis/python/node/src/lib.rs +++ b/apis/python/node/src/lib.rs @@ -104,10 +104,7 @@ impl Node { #[pyfunction] fn start_runtime() -> Result<()> { - dora_runtime::main() - .wrap_err("Python Dora Runtime failed.") - .unwrap(); - Ok(()) + dora_runtime::main().wrap_err("Python Dora Runtime failed.") } #[pymodule] From 4ab7858483111ce3d2ebf117d4617f920708c064 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Wed, 22 Mar 2023 13:55:51 +0800 Subject: [PATCH 2/3] Remove unnecessary typo in traceback --- binaries/runtime/src/operator/python.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaries/runtime/src/operator/python.rs b/binaries/runtime/src/operator/python.rs index 0a7a3171..ecdc74f2 100644 --- a/binaries/runtime/src/operator/python.rs +++ b/binaries/runtime/src/operator/python.rs @@ -19,7 +19,7 @@ use tokio::sync::mpsc::Sender; fn traceback(err: pyo3::PyErr) -> eyre::Report { let traceback = Python::with_gil(|py| err.traceback(py).and_then(|t| t.format().ok())); if let Some(traceback) = traceback { - eyre::eyre!("{err}:\n{traceback}") + eyre::eyre!("{err}{traceback}") } else { eyre::eyre!("{err}") } From 8ad1a74b7a24690b9617650b81d0acc51335db47 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Wed, 22 Mar 2023 14:32:11 +0800 Subject: [PATCH 3/3] Better debugging messages --- apis/python/node/src/lib.rs | 2 +- binaries/runtime/src/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apis/python/node/src/lib.rs b/apis/python/node/src/lib.rs index fa580972..168c2ea7 100644 --- a/apis/python/node/src/lib.rs +++ b/apis/python/node/src/lib.rs @@ -104,7 +104,7 @@ impl Node { #[pyfunction] fn start_runtime() -> Result<()> { - dora_runtime::main().wrap_err("Python Dora Runtime failed.") + dora_runtime::main().wrap_err("Dora Runtime raised an error.") } #[pymodule] diff --git a/binaries/runtime/src/lib.rs b/binaries/runtime/src/lib.rs index afbe84e4..c612465c 100644 --- a/binaries/runtime/src/lib.rs +++ b/binaries/runtime/src/lib.rs @@ -136,7 +136,10 @@ async fn run( } => { match event { OperatorEvent::Error(err) => { - bail!(err.wrap_err(format!("operator {operator_id} failed"))) + bail!(err.wrap_err(format!( + "operator {}/{operator_id} raised an error", + node.id() + ))) } OperatorEvent::Panic(payload) => { bail!("operator {operator_id} panicked: {payload:?}");