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

[Humble] Fix split by time. (backport #1022) #1616

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

fujitatomoya
Copy link
Contributor

humble backport of #1022

@fujitatomoya fujitatomoya requested a review from a team as a code owner April 17, 2024 18:59
@fujitatomoya fujitatomoya requested review from MichaelOrlov and james-rms and removed request for a team April 17, 2024 18:59
@fujitatomoya
Copy link
Contributor Author

@Kaju-Bubanja @MichaelOrlov i could use review on this. (this is good for humble user.)

@Barry-Xu-2018
Copy link
Contributor

LGTM

@Kaju-Bubanja
Copy link
Contributor

lgtm

@fujitatomoya
Copy link
Contributor Author

@MichaelOrlov i will leave this to you. this obviously fixes the critical problem for humble users without breaking ABI.

@MichaelOrlov MichaelOrlov changed the title Fix split by time. (backport #1022) [Humble] Fix split by time. (backport #1022) Apr 18, 2024
Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

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

@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

const auto duration = message_timestamp - metadata_.starting_time;

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
Copy link
Contributor

@fujitatomoya, Could you please also take a look at why ros2bag tests fail? It seems to be something related to the Python imports.

@fujitatomoya
Copy link
Contributor Author

@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

const auto duration = message_timestamp - metadata_.starting_time;

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 #1098, otherwise split_bag_metadata_has_full_duration fails.

@fujitatomoya
Copy link
Contributor Author

@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.

@MichaelOrlov
Copy link
Contributor

@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]

Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

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

@fujitatomoya LGTM with green CI.
Thanks for the explanation about missed delta for "duration" variable, and reference to the #1098. Make sense to me.
As regards to the ros2bag failure.
I've tried to checkout your branch and build and test it on my local environment. The ros2bag package in particularly compiles and passes tests without errors.
Approving then.

@fujitatomoya
Copy link
Contributor Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@fujitatomoya
Copy link
Contributor Author

  • Windows Build Status

@fujitatomoya
Copy link
Contributor Author

https://ci.ros2.org/job/ci_windows/21596/ is unrelated.

@MichaelOrlov can you merge this backport PR to humble?

@MichaelOrlov MichaelOrlov merged commit eafdaa0 into ros2:humble Apr 24, 2024
13 of 14 checks passed
emersonknapp added a commit that referenced this pull request Jun 10, 2024
* Link and compile against rosbag2_storage_mcap: Fixed issue 1492 (#1496) (#1498)

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 7fcb703)

Co-authored-by: Alejandro Hernández Cordero <[email protected]>

* [humble] Bugfix for incorrect playback rate changes when pressing buttons (backport #1513) (#1515)

* Bugfix for incorrect playback rate changes when pressing buttons (#1513)

- Playback rate expected to be changed by 10% with each
increase/decrease step.
- Use +0.1 and -0.1 in decrease/increase rate formula instead of
multiply by factor of the 1.1 and 0.9 respectively.

Signed-off-by: Michael Orlov <[email protected]>
(cherry picked from commit 95f78b6)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/player.cpp

* Address merge conflicts after auto-backporting

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* call cv.wait_until only if necessary. (#1521) (#1523)

* call cv.wait_until only if necessary.

Signed-off-by: Tomoya Fujita <[email protected]>

* add comment to avoid extra delay for performance.

Signed-off-by: Tomoya Fujita <[email protected]>

---------

Signed-off-by: Tomoya Fujita <[email protected]>
(cherry picked from commit a16704b)

Co-authored-by: Tomoya Fujita <[email protected]>

* [humble] Install signal handlers in recorder only inside record method (backport #1464) (#1526)

* Install signal handlers in recorder only inside record method (#1464)

Signed-off-by: Michael Orlov <[email protected]>
(cherry picked from commit 195e406)

# Conflicts:
#	rosbag2_py/src/rosbag2_py/_transport.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* [humble] `Recording stopped` prints only once. (backport #1530) (#1535)

* `Recording stopped` prints only once. (#1530)

Signed-off-by: Tomoya Fujita <[email protected]>
(cherry picked from commit 73b0772)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/recorder.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* [humble] Give proper log message for `--start-paused` (backport #1537) (#1541)

* Add proper message for --start-paused (#1537)

Signed-off-by: Christoph Froehlich <[email protected]>
(cherry picked from commit 317286c)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/recorder.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* 0.15.9 (#1551)

* 0.15.9

Signed-off-by: Audrow Nash <[email protected]>

* Update rosbag2_transport/CHANGELOG.rst

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Audrow Nash <[email protected]>

---------

Signed-off-by: Audrow Nash <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* [humble] Add default initialization for CompressionOptions (backport #1539) (#1546)

* Add default initialization for CompressionOptions (#1539)

* feat: add sane defaults for CompressionOptions

Signed-off-by: Arne Böckmann <[email protected]>

* Update rosbag2_compression/include/rosbag2_compression/compression_options.hpp

Co-authored-by: Tomoya Fujita <[email protected]>
Signed-off-by: Arne Böckmann <[email protected]>

---------

Signed-off-by: Arne Böckmann <[email protected]>
Co-authored-by: Arne Böckmann <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
(cherry picked from commit 931bf54)

# Conflicts:
#	rosbag2_compression/include/rosbag2_compression/compression_options.hpp

* Address merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Arne B <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* Fix/zstd vendor does not find system zstd (#1111) (#1560)

cmake did not find the Findzstd.cmake in cmake/Modules

Since we cannot use pkg-config for some Windows issues, the parsing of
the version is done by looking for the string in zstd.h.

Signed-off-by: Matthias Schoepfer <[email protected]>
(cherry picked from commit e7e7269)

Co-authored-by: DasRoteSkelett <[email protected]>

* [humble] Use rw_lock to protect mcap metadata lists. (backport #1561) (#1567)

* Use rw_lock to protect mcap metadata lists. (#1561)

* use rw_lock to protect mcap metadata lists.

Signed-off-by: Tomoya Fujita <[email protected]>

* introduce MCAPStorage::write_lock_free private method.

Signed-off-by: Tomoya Fujita <[email protected]>

---------

Signed-off-by: Tomoya Fujita <[email protected]>
(cherry picked from commit 90d1da8)

# Conflicts:
#	rosbag2_storage_mcap/src/mcap_storage.cpp

* Resolve merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* Add /bigobj to MSVC compiles. (#1571)

Signed-off-by: Chris Lalancette <[email protected]>

* Fix split by time. (backport #1022) (#1616)

Signed-off-by: Tomoya Fujita <[email protected]>

* [humble] Add BagSplitInfo service call on bag close (backport #1422) (#1637)

* Add BagSplitInfo service call on bag close (#1422)

- Note: The `BagSplitInfo::opened_file` will have empty string to
indicate that it was "bag close" and not bag split event.

Signed-off-by: Michael Orlov <[email protected]>
(cherry picked from commit ba199d0)

# Conflicts:
#	rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp

* Fix merge conflicts

- Ensure that writer_ is destructed before intercepted fake_metadata_

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* [Humble] Resolve recording option problem (backport #1649) (#1651)

* Resolve recording option problem (#1649)

Signed-off-by: Barry Xu <[email protected]>
(cherry picked from commit 4914ab3)

# Conflicts:
#	ros2bag/ros2bag/verb/record.py

* Fix cherry-pick conflicts for mergify/bp/humble/pr-1649 (#1652)

Signed-off-by: Barry Xu <[email protected]>

---------

Signed-off-by: Barry Xu <[email protected]>
Co-authored-by: Barry Xu <[email protected]>

* [humble] Add --log-level to ros2 bag play and record (#1655)

* Add --log-level to ros2 bag play and record

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Roman Sokolkov <[email protected]>

* Fix missing import

Signed-off-by: Roman Sokolkov <[email protected]>

---------

Signed-off-by: Roman Sokolkov <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

* [humble] Bugfix for writer not being able to open again after closing (backport #1599) (#1653)

* [iron] Bugfix for writer not being able to open again after closing (backport #1599) (#1635)

* re-applies fixes from #1590 to rolling. Also removes new message definition in sequential writer test for multiple open operations. Also clears topic_names_to_message_definitions_ and handles message_definitions_s underlying container similarly. Lastly, also avoids reset of factory in the compression writer, adds unit test there too.

Signed-off-by: Yannick Schulz <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>

* removes unused compressor_ member from compresser writer class. Also delegates rest of the closing behavior to the base class in close method, as it is handled in the open and write methods of the compression writer

Signed-off-by: Yannick Schulz <[email protected]>

* Remove unrelated delta

- message_definitions_ was intentionally allocated on the stack and
should persist between writer close() and open() because it represents
cache for message definitions which is not changes.

Signed-off-by: Michael Orlov <[email protected]>

* Don't call virtual methods from destructors

Signed-off-by: Michael Orlov <[email protected]>

* Cleanup 'rosbag2_directory_next' after the test run

Signed-off-by: Michael Orlov <[email protected]>

* Protect Writer::open(..) and Writer::close() with mutex on upper level

- Rationale: To avoid race conditions if open(..) and close() could be
ever be called from different threads.

Signed-off-by: Michael Orlov <[email protected]>

* Bugfix for WRITE_SPLIT callback not called for the last compressed file

Signed-off-by: Michael Orlov <[email protected]>

* Bugfix for lost messages from cache when closing compression writer

Signed-off-by: Michael Orlov <[email protected]>

* Address build failure by using rcpputils::fs instead of std::filesystem

- Note: On Iron we haven't migrated to the std::filesystem and using
rcpputils::fs

Signed-off-by: Michael Orlov <[email protected]>

* Adopt failing 'open_succeeds_twice' test for Iron

Signed-off-by: Michael Orlov <[email protected]>

* Return from writer's open() immediately if storage already open

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Yannick Schulz <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Yannick Schulz <[email protected]>
(cherry picked from commit a360d9b)

# Conflicts:
#	rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
#	rosbag2_cpp/src/rosbag2_cpp/writer.cpp
#	rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <[email protected]>

* Fix for segfault in open_twice test

- Ensure that writer_ is destructed before intercepted fake_metadata_

Signed-off-by: Michael Orlov <[email protected]>

* Fix for "open_succeeds_twice" test failure on second run

- Use std::filesystem for temp files and folders operation. For some
reason rcpputils::fs::delete_all(folder_name) wasn't able to delete temp
folder with subfolders.

Signed-off-by: Michael Orlov <[email protected]>

* Adopt changes in TestRosbag2CPPAPI::minimal_writer_example for humble

- The `serialized_msg2` is not owning the serialized data after the
first call writer.write(serialized_msg2,..). i.e. need to use another
message or another API in test. This is not a bug - this is by design.

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Audrow Nash <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
Signed-off-by: Tomoya Fujita <[email protected]>
Signed-off-by: Barry Xu <[email protected]>
Signed-off-by: Roman Sokolkov <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Audrow Nash <[email protected]>
Co-authored-by: Arne B <[email protected]>
Co-authored-by: DasRoteSkelett <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
Co-authored-by: Barry Xu <[email protected]>
Co-authored-by: Roman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong duration and missing topics/frames after ros2 bag convert
4 participants