Name the Reqserver processManager

This commit is contained in:
Thomas Jackson 2014-09-06 14:46:43 -07:00
parent 18e3838b89
commit 56357e7d78
2 changed files with 8 additions and 6 deletions

View File

@ -490,7 +490,7 @@ class ReqServer(object):
os.remove(dfn)
except os.error:
pass
self.process_manager = salt.utils.process.ProcessManager()
self.process_manager = salt.utils.process.ProcessManager(name='ReqServer_ProcessManager')
for ind in range(int(self.opts['worker_threads'])):
self.process_manager.add_process(MWorker,

View File

@ -116,10 +116,14 @@ class ProcessManager(object):
'''
A class which will manage processes that should be running
'''
def __init__(self):
def __init__(self, name=None):
# pid -> {tgt: foo, Process: object, args: args, kwargs: kwargs}
self._process_map = {}
self.name = name
if self.name is None:
self.name = self.__class__.__name__
def add_process(self, tgt, args=[], kwargs={}):
'''
Create a processes and args + kwargs
@ -157,13 +161,11 @@ class ProcessManager(object):
del self._process_map[pid]
def run(self, name=None):
def run(self):
'''
Load and start all available api modules
'''
if name is None:
name = self.__class__.__name__
salt.utils.appendproctitle(name)
salt.utils.appendproctitle(self.name)
# make sure to kill the subprocesses if the parent is killed
signal.signal(signal.SIGTERM, self.kill_children)