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

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

Merged
merged 8 commits into from
Sep 11, 2024

Conversation

alsora
Copy link
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
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.

rclcpp/test/rclcpp/executors/test_executors.cpp Outdated Show resolved Hide resolved
@jmachowinski
Copy link
Contributor

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

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
Contributor

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

@SteveMacenski
Copy link
Collaborator

Please :-)

@sloretz
Copy link
Contributor

sloretz commented Aug 29, 2024

@Mergifyio update

Copy link
Contributor

mergify bot commented Aug 29, 2024

update

✅ Branch has been successfully updated

@sloretz
Copy link
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
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
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
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
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
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
Member

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

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
@alsora
Copy link
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
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
3 checks passed
@alsora alsora deleted the asoragna/warm-up-executor branch September 11, 2024 07:08
@SteveMacenski
Copy link
Collaborator

Can we get this backported to Jazzy?

@ahcorde
Copy link
Contributor

ahcorde commented Sep 11, 2024

https://github.com/Mergifyio backport jazzy

Copy link
Contributor

mergify bot commented Sep 11, 2024

backport jazzy

✅ Backports have been created

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

doisyg commented Sep 12, 2024

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

@ahcorde
Copy link
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