fix: enhance error handling in RPC benchmark client for aimrt_py (#113)
* fix: enhance error handling in RPC benchmark client * chore: remove unused pybind11 includes Clean up unused dependencies from the Python runtime type support headers to streamline the codebase and improve maintainability. * fix: improve error logging for GetFooData failures Enhance logging by using ToString() for status to provide clearer failure messages, aiding in troubleshooting and debugging.
This commit is contained in:
parent
b41416c95e
commit
94e0446de1
@ -209,8 +209,13 @@ class BenchmarkRpcClientModule(aimrt_py.ModuleBase):
|
|||||||
status, _ = self.proxy.GetFooData(ctx, req)
|
status, _ = self.proxy.GetFooData(ctx, req)
|
||||||
task_end_time = time.perf_counter_ns()
|
task_end_time = time.perf_counter_ns()
|
||||||
|
|
||||||
assert status.Code() == aimrt_py.RpcStatusRetCode.OK, f"GetFooData failed: {status}"
|
if status.Code() != aimrt_py.RpcStatusRetCode.OK:
|
||||||
assert task_end_time > task_start_time, "Task end time is less than start time"
|
aimrt_py.error(self.logger, f"GetFooData failed: {status.ToString()}")
|
||||||
|
continue
|
||||||
|
if task_end_time <= task_start_time:
|
||||||
|
aimrt_py.error(self.logger, f"Task end time {task_end_time} is less than start time {task_start_time}")
|
||||||
|
continue
|
||||||
|
|
||||||
self.perf_data.append((task_end_time - task_start_time) / 1e3) # us
|
self.perf_data.append((task_end_time - task_start_time) / 1e3) # us
|
||||||
|
|
||||||
if plan['perf_mode'] == 'fixed-freq':
|
if plan['perf_mode'] == 'fixed-freq':
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
#include "aimrt_module_c_interface/util/type_support_base.h"
|
#include "aimrt_module_c_interface/util/type_support_base.h"
|
||||||
#include "aimrt_module_cpp_interface/util/string.h"
|
#include "aimrt_module_cpp_interface/util/string.h"
|
||||||
|
|
||||||
#include "pybind11/functional.h"
|
|
||||||
#include "pybind11/stl.h"
|
|
||||||
|
|
||||||
namespace aimrt::runtime::python_runtime {
|
namespace aimrt::runtime::python_runtime {
|
||||||
|
|
||||||
class PyPbTypeSupport {
|
class PyPbTypeSupport {
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "aimrt_module_cpp_interface/util/string.h"
|
#include "aimrt_module_cpp_interface/util/string.h"
|
||||||
#include "aimrt_module_ros2_interface/util/ros2_rcl_serialized_message_adapter.h"
|
#include "aimrt_module_ros2_interface/util/ros2_rcl_serialized_message_adapter.h"
|
||||||
|
|
||||||
#include "pybind11/functional.h"
|
|
||||||
#include "pybind11/stl.h"
|
|
||||||
#include "rosidl_runtime_cpp/message_type_support_decl.hpp"
|
|
||||||
|
|
||||||
#include "python_runtime/ros2_type_support_utils.h"
|
#include "python_runtime/ros2_type_support_utils.h"
|
||||||
|
|
||||||
namespace aimrt::runtime::python_runtime {
|
namespace aimrt::runtime::python_runtime {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "rosidl_runtime_c/u16string.h"
|
#include "rosidl_runtime_c/u16string.h"
|
||||||
#include "rosidl_runtime_c/u16string_functions.h" // IWYU pragma: keep
|
#include "rosidl_runtime_c/u16string_functions.h" // IWYU pragma: keep
|
||||||
#include "rosidl_typesupport_introspection_c/field_types.h"
|
#include "rosidl_typesupport_introspection_c/field_types.h"
|
||||||
|
#include "rosidl_typesupport_introspection_c/identifier.h"
|
||||||
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
||||||
|
|
||||||
namespace aimrt::runtime::python_runtime {
|
namespace aimrt::runtime::python_runtime {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "pybind11/pybind11.h" // IWYU pragma: keep
|
#include "pybind11/pybind11.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include "rosidl_typesupport_introspection_c/identifier.h"
|
|
||||||
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
#include "rosidl_typesupport_introspection_c/message_introspection.h"
|
||||||
|
|
||||||
namespace aimrt::runtime::python_runtime {
|
namespace aimrt::runtime::python_runtime {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user