Return the exit code a required process through roslaunch#2082
Return the exit code a required process through roslaunch#2082lucasw wants to merge 4 commits intoros:noetic-develfrom
Conversation
92fad90 to
b28da16
Compare
6f45ed9 to
0acad1b
Compare
|
Made some cleanup and existing tests pass. A new test that launches a node with required=true then forces it to exit non-zero, then inspects roslaunch exit code is the next step. Any pointers to an existing roslaunch test that would be a good template for this would be very welcome, otherwise I'll figure it out eventually. I'll hold on to the remaining extra prints until I'm done with that, a few I think it makes sense to keep. |
|
Just tested this patch ported to melodic. Works for me! I did notice that the roslaunch xml node has to be marked as |
|
would love to see this in melodic. Is there something I can do to help get this merged? |
… a regular parent launch process, child and remote processes need looking at. May solve ros#919
0acad1b to
43e5388
Compare
|
Added a unit test, can run manually with |
Try running lifecycle_test.launch - fails but doesn't result in a non-zero exit code (see ros/ros_comm#2082). Fix the test in a separate PR.
Try running lifecycle_test.launch (after adding a needed node to it) - works but doesn't result in a non-zero exit code if it does fail (see ros/ros_comm#2082). Turn it into a rostest in separate PR.
Try running lifecycle_test.launch (after adding a needed node to it) - works but doesn't result in a non-zero exit code if it does fail (see ros/ros_comm#2082). Turn it into a rostest in separate PR.
|
Can the |
MichaelGrupp
left a comment
There was a problem hiding this comment.
I left some review comments from my side, because I would also like to get the correct exit code from roslaunch. But I'm not a maintainer.
@sloretz Can you please also check the PR again?
| try: os.unlink(options.pid_fn) | ||
| except os.error: pass | ||
|
|
||
| print('exiting from main() {}'.format(exit_code)) |
There was a problem hiding this comment.
This looks like a debug print that can be removed - people who are interested in the exit code of the executable can get this from the shell.
| sigterm_timeout=options.sigterm_timeout) | ||
| c.run() | ||
| exit_code = c.exit_code | ||
| logger.warn('child node {} done {}'.format(options.child_name, exit_code)) |
There was a problem hiding this comment.
Why is this a warning? Looks more like a debug thing to me.
|
|
||
| if options.child_name: | ||
| logger.info('starting in child mode') | ||
| logger.info('starting in child mode {}'.format(options.child_name)) |
There was a problem hiding this comment.
Doesn't starting {} in child mode make more sense?
| import sys | ||
| # import time | ||
| import unittest | ||
| # import yaml |
There was a problem hiding this comment.
remove unnecessary imports
| # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| # POSSIBILITY OF SUCH DAMAGE. | ||
| # | ||
| # Revision $Id: test_roslaunch_command_line_online.py 6411 2009-10-02 21:32:01Z kwc $ |
There was a problem hiding this comment.
this revision string looks like a copied thing that can be removed
| #!/usr/bin/env python | ||
| # Software License Agreement (BSD License) | ||
| # | ||
| # Copyright (c) 2014, The Johns Hopkins University |
There was a problem hiding this comment.
The copyright notices look like they were pasted from somewhere else (2014 JHU, 2009 Willow) - do they make sense? I guess here the maintainers need to tell how this should be handled.
There was a problem hiding this comment.
Looks like I copied it from test_roslaunch_ros_args.py.
Copyright (c) 2008, Willow Garage, Inc isn't true either, should it be Open Robotics 2021, or my name?
| self.logger.info("process monitor is done spinning, initiating full shutdown") | ||
| self.stop() | ||
| printlog_bold("done") | ||
| printlog_bold("roslaunch runner done") |
There was a problem hiding this comment.
I would leave this as it is, it's unrelated to the feature.
| printerrlog('='*80+"REQUIRED process [%s] has died!\n%s\nInitiating shutdown!\n"%(p.name, exit_code_str)+'='*80) | ||
| self.is_shutdown = True | ||
| if p.exit_code != 0: | ||
| msg = 'Going to exit due to code {}'.format(p.exit_code) |
There was a problem hiding this comment.
This should also include the p.name of the dead process:
msg = 'Going to exit due to non-zero exit code ({}) of required process {}'.format(p.exit_code, p.name)| p.start() | ||
| p.spin() | ||
| exit_code = p.exit_code | ||
| print('ending server mode {}'.format(exit_code)) |
There was a problem hiding this comment.
Also here, is this print needed?
e88055b to
279cdb2
Compare
Try running lifecycle_test.launch (after adding a needed node to it) - works but doesn't result in a non-zero exit code if it does fail (see ros/ros_comm#2082). Turn it into a rostest in separate PR.
|
Thank you for the PR! Unfortunately I don't think we should merge this one. ROS Noetic will reach end-of-life on May 31st, 2025. Every change comes with a risk of introducing regressions, and there isn't much time left to fix them. I'm closing pull requests that add features so that the remaining time is allocated towards bug fixes and compatibility with newer Ubuntu distros. |
Return the exit code to the caller of a required process at least for a regular parent launch process, child and remote processes need looking at.
May solve #919