Skip to content

fix events-executor warm-up bug and add unit-tests#2591

Merged
alsora merged 8 commits intorollingfrom
asoragna/warm-up-executor
Sep 11, 2024
Merged

fix events-executor warm-up bug and add unit-tests#2591
alsora merged 8 commits intorollingfrom
asoragna/warm-up-executor

Conversation

@alsora
Copy link
Copy Markdown
Collaborator

@alsora alsora commented Jul 26, 2024

Wrote a test to verify the behavior of spin_all, that should collect work multiple times (if given enough duration) and this should allow to also get work from entities created after the node / cb group was added to the executor.

See #2589 for details

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

i think comments could be updated a bit, but this test itself makes sense to be added.

@jmachowinski
Copy link
Copy Markdown
Collaborator

This test is flawed. It builds on top of TestExecutors. The SetUp method of TestExecutors also instantiates a node and subscripers / publishers interfering with the test.

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
@alsora
Copy link
Copy Markdown
Collaborator Author

alsora commented Aug 4, 2024

@jmachowinski I moved the tests to a new file with their own, minimal, test suite

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
@alsora alsora force-pushed the asoragna/warm-up-executor branch from d2df4b0 to 77ddcd1 Compare August 4, 2024 23:57
alsora added 2 commits August 10, 2024 09:27
Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
@alsora
Copy link
Copy Markdown
Collaborator Author

alsora commented Aug 10, 2024

Thanks for the early review.
Can you please take another look?

I updated the PR:

  • fixes the "warm up" bug for the events executor
  • adds unit-tests that exhibit the problem (the tests are currently enabled only for the executors that pass them)

CI:

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

@alsora alsora changed the title add unit-test to verify that spin-all doesn't need warm-up fix events-executor warm-up bug and add unit-tests Aug 10, 2024
@ros-discourse
Copy link
Copy Markdown

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/next-client-library-wg-meeting-friday-16th-august-2024/39130/1

@MichaelOrlov
Copy link
Copy Markdown
Contributor

@jmachowinski @fujitatomoya A friendly ping for one more round of review to move forward with this PR.

@SteveMacenski
Copy link
Copy Markdown
Collaborator

Please :-)

@sloretz
Copy link
Copy Markdown
Contributor

sloretz commented Aug 29, 2024

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 29, 2024

update

✅ Branch has been successfully updated

@sloretz
Copy link
Copy Markdown
Contributor

sloretz commented Aug 29, 2024

CI (build: --packages-above-and-dependencies rclcpp test: --packages-above rclcpp)

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

@@ -0,0 +1,241 @@
// Copyright 2017 Open Source Robotics Foundation, Inc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Copyright 2017 Open Source Robotics Foundation, Inc.
// Copyright 2024 Open Source Robotics Foundation, Inc.

// Create entities, this will produce a notifier waitable event, telling the executor to refresh
// the entities collection
auto publisher = node->create_publisher<test_msgs::msg::Empty>("test_topic", rclcpp::QoS(10));
size_t callback_count = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

include <cstddef>

auto callback = [&callback_count](test_msgs::msg::Empty::ConstSharedPtr) {callback_count++;};
auto subscription =
node->create_subscription<test_msgs::msg::Empty>(
"test_topic", rclcpp::QoS(10), std::move(callback));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

include <utility>


// TODO(alsora): Enable when https://github.com/ros2/rclcpp/pull/2595 gets merged
if (
std::is_same<ExecutorType, rclcpp::executors::SingleThreadedExecutor>() ||
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

include <type_traits>

@alsora
Copy link
Copy Markdown
Collaborator Author

alsora commented Sep 6, 2024

Added missing include directives.
New CI:

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

@mjcarroll
Copy link
Copy Markdown
Member

RHEL is failing with out of disk space errors. Reported to buildfarmers.

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
@alsora alsora force-pushed the asoragna/warm-up-executor branch from 067b721 to d3ed8a6 Compare September 10, 2024 08:15
@alsora
Copy link
Copy Markdown
Collaborator Author

alsora commented Sep 10, 2024

Fixed DCO.

New CI:

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

@alsora
Copy link
Copy Markdown
Collaborator Author

alsora commented Sep 11, 2024

Merging this since the changes requests have been addressed and the RHEL failure is unrelated and known (ros2cli.pytest.missing_result)

@alsora alsora merged commit f7056c0 into rolling Sep 11, 2024
@alsora alsora deleted the asoragna/warm-up-executor branch September 11, 2024 07:08
@SteveMacenski
Copy link
Copy Markdown
Collaborator

Can we get this backported to Jazzy?

@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 11, 2024

https://github.com/Mergifyio backport jazzy

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 11, 2024

backport jazzy

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Sep 11, 2024
* add unit-test to verify that spin-all doesn't need warm-up

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* improve comment and add callback group test

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* move executor tests to a new file

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* do not require warm up iteration with events executor spin_some

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* add spin_some tests and cleanup

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* add missing include directives

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

---------

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit f7056c0)

# Conflicts:
#	rclcpp/src/rclcpp/experimental/executors/events_executor/events_executor.cpp
@doisyg
Copy link
Copy Markdown

doisyg commented Sep 12, 2024

Can we merge the backport to Jazzy and trigger a release plz ?

@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Sep 12, 2024

Ey @alsora I created the backport but there are some conflicts. do you mind to fix it ?

I can take care of the release once the backport PR is merged

alsora added a commit that referenced this pull request Sep 13, 2024
Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
ahcorde pushed a commit that referenced this pull request Sep 17, 2024
…2628)

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
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.

10 participants