For start(), stop(), restart() and kill(), return True if the action could
be taken. That is True if the process wasn't already running for start(),
and for stop(), restart() and kill(), True if the process was already
running.
def start(self, name):
log.debug(u'ProcessManager.start(%s)', name)
def start(self, name):
log.debug(u'ProcessManager.start(%s)', name)
- assert name not in self.namemap
- self._call(self.services[name])
+ if name not in self.namemap:
+ self._call(self.services[name])
+ return True
+ return False
def stop(self, name):
log.debug(u'ProcessManager.stop(%s)', name)
def stop(self, name):
log.debug(u'ProcessManager.stop(%s)', name)
- assert name in self.namemap
- self.namemap[name].stop()
+ if name in self.namemap:
+ self.namemap[name].stop()
+ return True
+ return False
def restart(self, name):
log.debug(u'ProcessManager.restart(%s)', name)
def restart(self, name):
log.debug(u'ProcessManager.restart(%s)', name)
pi.restart()
# add the new PID
self.pidmap[pi.process.pid] = pi
pi.restart()
# add the new PID
self.pidmap[pi.process.pid] = pi
def kill(self, name, signum):
log.debug(u'ProcessManager.kill(%s, %s)', name, signum)
def kill(self, name, signum):
log.debug(u'ProcessManager.kill(%s, %s)', name, signum)
- assert name in self.namemap
- self.namemap[name].kill(name, stop)
+ if name in self.namemap:
+ self.namemap[name].kill(name, stop)
+ return True
+ return False
def sigchild_handler(self, signum, stack_frame=None):
log.debug(u'ProcessManager.sigchild_handler(%s)', signum)
def sigchild_handler(self, signum, stack_frame=None):
log.debug(u'ProcessManager.sigchild_handler(%s)', signum)