Add a bunch of debugging info
Change-Id: Idda0e7e79fa29aa458947356ddaed9d47d0a1d46
This commit is contained in:
parent
b305b4e3e6
commit
6eb5fdcd8d
@ -28,7 +28,7 @@ class ZuulManager(threading.Thread):
|
||||
To do this it implements its own gearman worker waiting for events on
|
||||
that manager. """
|
||||
|
||||
log = logging.getLogger("worker_manager.GearmanManager")
|
||||
log = logging.getLogger("worker_manager.ZuulManager")
|
||||
|
||||
def __init__(self, config, tasks):
|
||||
super(ZuulManager, self).__init__()
|
||||
@ -115,10 +115,12 @@ class ZuulClient(threading.Thread):
|
||||
self.register_functions()
|
||||
|
||||
def register_functions(self):
|
||||
self.debug.log("Register functions with gearman")
|
||||
for function_name, plugin in self.functions.items():
|
||||
self.gearman_worker.registerFunction(function_name)
|
||||
|
||||
def add_function(self, function_name, plugin):
|
||||
self.debug.log("Add function, %s, to list" % function_name)
|
||||
self.functions[function_name] = plugin
|
||||
|
||||
def stop(self):
|
||||
@ -144,4 +146,5 @@ class ZuulClient(threading.Thread):
|
||||
|
||||
def _handle_job(self):
|
||||
""" We have a job, give it to the right plugin """
|
||||
self.log.debug("We have a job, we'll launch the task now.")
|
||||
self.functions[self.job.name].start_job(self.job)
|
||||
|
@ -66,6 +66,7 @@ class Server(object):
|
||||
|
||||
def load_plugins(self):
|
||||
""" Load the available plugins from task_plugins """
|
||||
self.log.debug('Loading plugins')
|
||||
# Load plugins
|
||||
for plugin in self.config['plugins']:
|
||||
self.plugins.append({
|
||||
@ -75,9 +76,11 @@ class Server(object):
|
||||
plugin['name']),
|
||||
'plugin_config': plugin
|
||||
})
|
||||
self.log.debug('Plugin %s loaded' % plugin['name'])
|
||||
|
||||
def start_gearman_workers(self):
|
||||
""" Run the tasks """
|
||||
self.log.debug('Starting gearman workers')
|
||||
self.zuul_client = worker_manager.ZuulClient(self.config,
|
||||
self.worker_name)
|
||||
|
||||
@ -102,6 +105,7 @@ class Server(object):
|
||||
self.zuul_manager.start()
|
||||
|
||||
def exit_handler(self, signum):
|
||||
self.log.debug('Exiting...')
|
||||
signal.signal(signal.SIGUSR1, signal.SIG_IGN)
|
||||
for task_name, task in self.tasks.items():
|
||||
task.stop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user