|
@@ -81,7 +81,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
|
|
|
def getPID(self):
|
|
|
""" Return the PID of supervisord
|
|
|
-
|
|
|
+
|
|
|
@return int PID
|
|
|
"""
|
|
|
self._update('getPID')
|
|
@@ -147,7 +147,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
@return boolean result always return True unless error
|
|
|
"""
|
|
|
self._update('restart')
|
|
|
-
|
|
|
+
|
|
|
self.supervisord.options.mood = SupervisorStates.RESTARTING
|
|
|
return True
|
|
|
|
|
@@ -162,7 +162,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
self.supervisord.options.process_config_file(do_usage=False)
|
|
|
except ValueError, msg:
|
|
|
raise RPCError(Faults.CANT_REREAD, msg)
|
|
|
-
|
|
|
+
|
|
|
added, changed, removed = self.supervisord.diff_to_active()
|
|
|
|
|
|
added = [group.name for group in added]
|
|
@@ -242,9 +242,9 @@ class SupervisorNamespaceRPCInterface:
|
|
|
process = group.processes.get(process_name)
|
|
|
if process is None:
|
|
|
raise RPCError(Faults.BAD_NAME, name)
|
|
|
-
|
|
|
+
|
|
|
return group, process
|
|
|
-
|
|
|
+
|
|
|
def startProcess(self, name, wait=True):
|
|
|
""" Start a process
|
|
|
|
|
@@ -292,7 +292,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
|
|
|
if not wait or not startsecs:
|
|
|
return True
|
|
|
-
|
|
|
+
|
|
|
t = time.time()
|
|
|
runtime = (t - started[0])
|
|
|
state = process.get_state()
|
|
@@ -332,7 +332,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
|
|
|
startall = make_allfunc(processes, isNotRunning, self.startProcess,
|
|
|
wait=wait)
|
|
|
-
|
|
|
+
|
|
|
startall.delay = 0.05
|
|
|
startall.rpcinterface = self
|
|
|
return startall # deferred
|
|
@@ -383,12 +383,12 @@ class SupervisorNamespaceRPCInterface:
|
|
|
if msg is not None:
|
|
|
raise RPCError(Faults.FAILED, msg)
|
|
|
stopped.append(1)
|
|
|
-
|
|
|
+
|
|
|
if wait:
|
|
|
return NOT_DONE_YET
|
|
|
else:
|
|
|
return True
|
|
|
-
|
|
|
+
|
|
|
if process.get_state() not in (ProcessStates.STOPPED,
|
|
|
ProcessStates.EXITED):
|
|
|
return NOT_DONE_YET
|
|
@@ -407,7 +407,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
@return boolean result Always return true unless error.
|
|
|
"""
|
|
|
self._update('stopProcessGroup')
|
|
|
-
|
|
|
+
|
|
|
group = self.supervisord.process_groups.get(name)
|
|
|
|
|
|
if group is None:
|
|
@@ -419,7 +419,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
|
|
|
killall = make_allfunc(processes, isRunning, self.stopProcess,
|
|
|
wait=wait)
|
|
|
-
|
|
|
+
|
|
|
killall.delay = 0.05
|
|
|
killall.rpcinterface = self
|
|
|
return killall # deferred
|
|
@@ -431,7 +431,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
@return boolean result Always return true unless error.
|
|
|
"""
|
|
|
self._update('stopAllProcesses')
|
|
|
-
|
|
|
+
|
|
|
processes = self._getAllProcesses()
|
|
|
|
|
|
killall = make_allfunc(processes, isRunning, self.stopProcess,
|
|
@@ -506,7 +506,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
start = int(process.laststart)
|
|
|
stop = int(process.laststop)
|
|
|
now = int(time.time())
|
|
|
-
|
|
|
+
|
|
|
state = process.get_state()
|
|
|
spawnerr = process.spawnerr or ''
|
|
|
exitstatus = process.exitstatus or 0
|
|
@@ -528,7 +528,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
'stderr_logfile':stderr_logfile,
|
|
|
'pid':process.pid,
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
description = self._interpretProcessInfo(info)
|
|
|
info['description'] = description
|
|
|
return info
|
|
@@ -590,7 +590,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
group, process = self._getGroupAndProcess(name)
|
|
|
|
|
|
logfile = getattr(process.config, '%s_logfile' % channel)
|
|
|
-
|
|
|
+
|
|
|
if logfile is None or not os.path.exists(logfile):
|
|
|
return ['', 0, False]
|
|
|
|
|
@@ -601,7 +601,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
Provides a more efficient way to tail the (stdout) log than
|
|
|
readProcessStdoutLog(). Use readProcessStdoutLog() to read
|
|
|
chunks and tailProcessStdoutLog() to tail.
|
|
|
-
|
|
|
+
|
|
|
Requests (length) bytes from the (name)'s log, starting at
|
|
|
(offset). If the total log size is greater than (offset +
|
|
|
length), the overflow flag is set and the (offset) is
|
|
@@ -625,7 +625,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
Provides a more efficient way to tail the (stderr) log than
|
|
|
readProcessStderrLog(). Use readProcessStderrLog() to read
|
|
|
chunks and tailProcessStderrLog() to tail.
|
|
|
-
|
|
|
+
|
|
|
Requests (length) bytes from the (name)'s log, starting at
|
|
|
(offset). If the total log size is greater than (offset +
|
|
|
length), the overflow flag is set and the (offset) is
|
|
@@ -703,7 +703,7 @@ class SupervisorNamespaceRPCInterface:
|
|
|
return NOT_DONE_YET
|
|
|
|
|
|
return results
|
|
|
-
|
|
|
+
|
|
|
clearall.delay = 0.05
|
|
|
clearall.rpcinterface = self
|
|
|
return clearall # deferred
|
|
@@ -713,8 +713,8 @@ class SupervisorNamespaceRPCInterface:
|
|
|
If non-7-bit data is sent (unicode), it is encoded to utf-8
|
|
|
before being sent to the process' stdin. If chars is not a
|
|
|
string or is not unicode, raise INCORRECT_PARAMETERS. If the
|
|
|
- process is not running, raise NOT_RUNNING. If the process'
|
|
|
- stdin cannot accept input (e.g. it was closed by the child
|
|
|
+ process is not running, raise NOT_RUNNING. If the process'
|
|
|
+ stdin cannot accept input (e.g. it was closed by the child
|
|
|
process), raise NO_FILE.
|
|
|
|
|
|
@param string name The process name to send to (or 'group:name')
|
|
@@ -748,9 +748,9 @@ class SupervisorNamespaceRPCInterface:
|
|
|
return True
|
|
|
|
|
|
def sendRemoteCommEvent(self, type, data):
|
|
|
- """ Send an event that will be received by event listener
|
|
|
+ """ Send an event that will be received by event listener
|
|
|
subprocesses subscribing to the RemoteCommunicationEvent.
|
|
|
-
|
|
|
+
|
|
|
@param string type String for the "type" key in the event header
|
|
|
@param string data Data for the event body
|
|
|
@return boolean Always return True unless error
|