rosbag2
rosbag2 copied to clipboard
Fix split by time. (backport #1022)
humble backport of https://github.com/ros2/rosbag2/pull/1022
@Kaju-Bubanja @MichaelOrlov i could use review on this. (this is good for humble user.)
LGTM
lgtm
@MichaelOrlov i will leave this to you. this obviously fixes the critical problem for humble users without breaking ABI.
@fujitatomoya, Could you please also take a look at why ros2bag
tests fail? It seems to be something related to the Python imports.
@fujitatomoya I don't mind about this PR if it is fixing problem and not breaking ABI/API.
I found that one line change from the original PR is missing in line
https://github.com/ros2/rosbag2/blob/04afde654f153a02539f83bcaac75811f3e83e0f/rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp#L319
was changed to the
const auto duration = message_timestamp - metadata_.files.back().starting_time;
If it wasn't intentionally skipped please add those changes.
@MichaelOrlov we cannot take that line. this has been addressed by https://github.com/ros2/rosbag2/pull/1098, otherwise split_bag_metadata_has_full_duration
fails.
@MichaelOrlov can we know which test failed, the log is really long. could not find the specific test failure. if that is the python import, that would be unrelated.
@fujitatomoya It fails with the following output
Click to expand
2024-04-17T19:32:57.3786356Z Starting >>> ros2bag
2024-04-17T19:32:58.5114970Z --- output: ros2bag
2024-04-17T19:32:58.5115445Z ============================= test session starts ==============================
2024-04-17T19:32:58.5116031Z platform linux -- Python 3.10.12, pytest-8.1.1, pluggy-1.4.0
2024-04-17T19:32:58.5116569Z cachedir: /__w/rosbag2/rosbag2/ros_ws/build/ros2bag/.pytest_cache
2024-04-17T19:32:58.5117163Z rootdir: /__w/rosbag2/rosbag2/ros_ws/src/ww3gvnpn3ab/rosbag2/ros2bag
2024-04-17T19:32:58.5117595Z configfile: pytest.ini
2024-04-17T19:32:58.5119222Z plugins: launch_testing_ros-0.19.7, launch_testing-1.0.5, ament_copyright-0.12.10, ament_pep257-0.12.10, ament_flake8-0.12.10, ament_lint-0.12.10, mock-3.14.0, colcon-core-0.15.1, rerunfailures-14.0, repeat-0.9.3, cov-5.0.0, timeout-2.1.0
2024-04-17T19:32:58.5120465Z collected 0 items / 1 error
2024-04-17T19:32:58.5120655Z
2024-04-17T19:32:58.5120809Z ==================================== ERRORS ====================================
2024-04-17T19:32:58.5121272Z ____________________________ ERROR collecting test _____________________________
2024-04-17T19:32:58.5121915Z /usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py:501: in __call__
2024-04-17T19:32:58.5122557Z return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
2024-04-17T19:32:58.5123263Z /usr/local/lib/python3.10/dist-packages/pluggy/_manager.py:119: in _hookexec
2024-04-17T19:32:58.5123872Z return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2024-04-17T19:32:58.5124579Z /usr/local/lib/python3.10/dist-packages/_pytest/python.py:225: in pytest_collect_file
2024-04-17T19:32:58.5125267Z module: Module = ihook.pytest_pycollect_makemodule(
2024-04-17T19:32:58.5125896Z /usr/local/lib/python3.10/dist-packages/_pytest/config/compat.py:79: in fixed_hook
2024-04-17T19:32:58.5126396Z return hook(**kw)
2024-04-17T19:32:58.5126851Z /usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py:501: in __call__
2024-04-17T19:32:58.5127467Z return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
2024-04-17T19:32:58.5128157Z /usr/local/lib/python3.10/dist-packages/pluggy/_manager.py:119: in _hookexec
2024-04-17T19:32:58.5128757Z return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2024-04-17T19:32:58.5129416Z ../../../../build/launch_testing/launch_testing/pytest/hooks.py:188: in pytest_pycollect_makemodule
2024-04-17T19:32:58.5130003Z entrypoint = find_launch_test_entrypoint(path)
2024-04-17T19:32:58.5130584Z ../../../../build/launch_testing/launch_testing/pytest/hooks.py:178: in find_launch_test_entrypoint
2024-04-17T19:32:58.5131138Z module = import_path(path, root=None)
2024-04-17T19:32:58.5131781Z E TypeError: import_path() missing 1 required keyword-only argument: 'consider_namespace_packages'
2024-04-17T19:32:58.5132558Z --- generated xml file: /__w/rosbag2/rosbag2/ros_ws/build/ros2bag/pytest.xml ---
2024-04-17T19:32:58.5133097Z =========================== short test summary info ============================
2024-04-17T19:32:58.5133831Z ERROR test - TypeError: import_path() missing 1 required keyword-only argument: 'consider_namespace_packages'
2024-04-17T19:32:58.5134529Z !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
2024-04-17T19:32:58.5134987Z =============================== 1 error in 0.13s ===============================
2024-04-17T19:32:58.5135345Z ---
2024-04-17T19:32:58.5135589Z Failed <<< ros2bag [1.17s, exited with code 2]
https://ci.ros2.org/job/ci_windows/21596/ is unrelated.
@MichaelOrlov can you merge this backport PR to humble?