Make sure we wait for a gearman server

Change-Id: I4cc5f5b6fb50a77116aeede4a450bd8281a5a5a9
This commit is contained in:
Joshua Hesketh 2013-11-21 13:12:00 +11:00
parent 3baaa0d160
commit b39f8840d6
2 changed files with 5 additions and 1 deletions

View File

@ -112,12 +112,13 @@ class ZuulClient(threading.Thread):
self.global_config['zuul_server']['gearman_host'],
self.global_config['zuul_server']['gearman_port']
)
self.register_functions()
self.gearman_worker.waitForServer()
def register_functions(self):
self.log.debug("Register functions with gearman")
for function_name, plugin in self.functions.items():
self.gearman_worker.registerFunction(function_name)
self.log.debug(self.gearman_worker.functions)
def add_function(self, function_name, plugin):
self.log.debug("Add function, %s, to list" % function_name)

View File

@ -48,6 +48,9 @@ class Server(object):
self.zuul_manager = None
self.zuul_client = None
self.plugins = []
# TODO: Make me unique (random?) and we should be able to run multiple
# instances of turbo-hipster on the one host
self.worker_name = os.uname()[1]
self.tasks = {}