-
Notifications
You must be signed in to change notification settings - Fork 142
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
Re-spawn a process only if returncode != 0
#514
base: rolling
Are you sure you want to change the base?
Conversation
e47e56a
to
17ce532
Compare
Signed-off-by: Darko Lukic <lukicdarkoo@gmail.com>
Signed-off-by: Darko Lukic <lukicdarkoo@gmail.com>
e2d0885
to
8d38cbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukicdarkoo I see you use respawn
as means to retry on failure. I could argue that someone may want to use respawn
to keep some process alive no matter what (current behavior in master
), or to reset some process' state so long as it exits gracefully (opposite to the behavior in this patch).
With that in mind, I'd suggest we add support for a condition to respawn
in addition to plain booleans, instead of hard-coding this check. @ivanpauno @wjwwood for feedback.
@@ -152,7 +152,7 @@ def generate_launch_description(): | |||
return LaunchDescription([ | |||
|
|||
ExecuteProcess( | |||
cmd=[sys.executable, '-c', "print('action')"], | |||
cmd=[sys.executable, '-c', "print('action'); false"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukicdarkoo hmm, false
is not a valid Python literal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not the best way to make it crash :) I will change it
Signed-off-by: Darko Lukic <lukicdarkoo@gmail.com>
75d203f
to
108ad50
Compare
@lukicdarkoo have you considered:
? |
Sounds very good to me, but I understood that @ivanpauno and @wjwwood have to agree or contribute to the idea? |
Sounds fair, but how do you get the return code in the condition? |
Hmm. Didn't put a lot of thought to it. Temporarily pushing it to |
That works, but it's really weird IMO. |
Right, but that'd make it impossible to leverage the feature from non-Python launch files. I'm onboard with accepting callbacks for user convenience, but we have to accept a condition as well i.e. a construct that actually lives in |
Okay, pushing it to |
Same. |
@lukicdarkoo will you be moving forward with this? |
@lukicdarkoo friendly ping |
I believe there is a missing condition
returncode != 0
when respawning a process. I have a process that finishes cleanly after a short time, but the launcher keeps respawning it. With the condition (returncode != 0
) it works fine.