-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add ability to send arbitrary UNIX signals to processes: #477
Conversation
* Extend the Process class to handle non-killing signals * Expose this via the XML-RPC API
despite hash randomization
I just fixed a few Python 3 issues. |
Here's an example of using the RPC interface from IPython:
|
I added frontend (
|
for consistency and PEP8
I think a |
from @mcdonc on IRC (#pyramid):
|
We have had folks who wanted quick restarts put |
If the signal people use as "restartsignal" doesnt actually exit the process, they'll be in for a similarly bad time. |
Yeah, I'm totally convinced that restartsignal is not needed. |
Convincing the thousand folks who think they need it in #53 is probably going to be tricky. |
Well, give 'em the |
I remember seeing a fork that had another implementation of this same feature. I couldn't find it with GitHub search, so I cloned all the forks and grepped for Edit: Found it, see below. |
@@ -464,6 +465,82 @@ def stopAllProcesses(self, wait=True): | |||
killall.rpcinterface = self | |||
return killall # deferred | |||
|
|||
|
|||
def _getSignalFromString(self, name): |
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.
We have this in datatypes.signal_number.
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.
Oh cool! Fixed in 315b30e.
Found that other implementation: This one should be reviewed as well. One thing I noticed is that it has tests for the new |
Work is already done by process.signal()
and make sendProcessSignal return True
|
…do anything async in signalGroup, merge logic for _stopresult and _signalresult in supervisorctl
Merged to master. I took care of most of the stuff in my comment, delta mining the moriyoshi code for supervisorctl tests. |
My feeling on this is that a "restart" signal should completely stop and then start, just as it does now, so I agree with @sontek that restartsignal is not needed. I think the supporters of #53 would be happy to have a "graceful" command which can be provided by specifying a "graceful_signal". For gunicorn this would be "HUP" and Apache2 this would be "SIGUSR1". If the command "graceful-restart" is issued for a service for which "gracefulrestartsignal" is not defined, it simply does nothing and issues a warning. Similarly, "graceful-stop" can be provided the same way. The only remaining problem would be restarting groups of services where the desired behaviour would be:
So I would add a "--force" option to the graceful command which falls back to stop/start if no graceful signal is defined. |
I believe that should be the default behavior with option to do nothing if there's no graceful signal defined ( |
Just curious what version of supervisor are these changes set to be released in ? I am looking to just use the signal command and have no preference either ways about also having a 'graceful restart' config option. |
The |
Any ETA on the 3.2 release? |
…do anything async in signalGroup, merge logic for _stopresult and _signalresult in supervisorctl
Thank you for the signal implementation! I found some wrong behaviour with signals and with normal restarts too:
If the restart or signaling failed for any reason, there should be exit code 1. Am I right? |
I missed this issue. Thank you for the explanation! |
This sounds like a great way to use
Say I have a program called nginx, how would I send the signal to nginx to reload its config? |
signal
commandThis is an update of PR #228 and hopefully moves the ball forward on #179, #53, etc.
Cc: @squeed, @Weebly, @mnaberez, @sontek