launch icon indicating copy to clipboard operation
launch copied to clipboard

feat(include_launch_description): only check required arguments in the local launch file

Open Owen-Liuyuxuan opened this issue 2 years ago • 8 comments

Description

In a feature request issue on https://github.com/ros2/launch/issues/745. It suggests that the argument checking mechanism in include_launch_description.py introduces unnecessary overhead for launching large systems.

In this PR, a mechanism is implemented so that the best-effort argument checking is only performed inside the local launch file instance and checks on each included sub-launch file are only performed once.

Methods

Add an argument to the get_launch_arguments_with_include_launch_description_actions function.

Testing

Tested with autoware. If the launch file is OK, we could now launch significantly faster. If the launch file has un-declared arguments even if it is hidden in the sub-sub included files, the launch system can identify the problem and stop the launch operation cleanly (it also keeps up with the cases in CI).

Feedback is welcome.

Owen-Liuyuxuan avatar Dec 04 '23 08:12 Owen-Liuyuxuan

@Owen-Liuyuxuan Could you check the failing CI? https://build.ros2.org/job/Rpr__launch__ubuntu_jammy_amd64/311/testReport/launch.test.launch.actions/test_include_launch_description/test_include_launch_description_launch_arguments/

shmpwk avatar Dec 04 '23 15:12 shmpwk

@Owen-Liuyuxuan Could you check the failing CI? https://build.ros2.org/job/Rpr__launch__ubuntu_jammy_amd64/311/testReport/launch.test.launch.actions/test_include_launch_description/test_include_launch_description_launch_arguments/

Working on methods to pass this case while keeping the complexity manageable.

Owen-Liuyuxuan avatar Dec 05 '23 01:12 Owen-Liuyuxuan

For more context, how significant of a speedup are you seeing by only checking the required args?

audrow avatar Dec 12 '23 16:12 audrow

For more context, how significant of a speedup are you seeing by only checking the required args?

This image showcases how it accelerates the logging simulation of the OSC [autoware] (https://github.com/autowarefoundation/autoware). Numbers are time spent in the execute function of include_launch_description.py in seconds. image

To reproduce:

  1. Build Autoware.
  2. Manually update the launch file and log the time info.
  3. Analyse the launch.log and find the most time-consuming parts.

Intuition: Autoware has become a rather huge system with many optional launchable sub-systems. The original code will unfold more than 100k parameters at checking the first launch script (and these parameters will be checked recursively many times by tons of subfiles/sub-subfiles). This update can significantly improve launch speed for huge launch system.

Owen-Liuyuxuan avatar Dec 13 '23 04:12 Owen-Liuyuxuan

Any updates on the review process? Thanks a lot for the maintenance of the code.

The new commits from main for new the ROS version breaks the CI again. Need to figure out what is new.

Owen-Liuyuxuan avatar Mar 29 '24 02:03 Owen-Liuyuxuan

Merge commit does not produce any new reports and the CI fails. I will have to push some dummy commit here.

by April 2. The CI errors does not look like to be related to the PR. Waiting for updates.

Would love to hear more information about the CI here, it does not look like related to the PR .

Sorry for the mention @mjcarroll @clalancette .

Owen-Liuyuxuan avatar Apr 02 '24 07:04 Owen-Liuyuxuan

Added a branch on my personal repo https://github.com/Owen-Liuyuxuan/launch/tree/feat/augment_check_skipping_install for temporary installation.

git clone https://github.com/Owen-Liuyuxuan/launch.git
git checkout feat/augment_check_skipping_install
./install2ros.sh

Owen-Liuyuxuan avatar Apr 05 '24 02:04 Owen-Liuyuxuan