From 9208dc1c0a859642deece4f4be5f43fae065c945 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 8 Jun 2016 16:43:55 -0400 Subject: [PATCH] Make isJobRegistered for gearman optional With openstack-infra we actually validate our jobs exist before merging them into our zuul configuration. As a result, the registration check in zuul is redundant. So provide a way for the check to be enable / disabled. Change-Id: I06f2221770e04f958ce7ac4cfe8d5d92d7164cac Signed-off-by: Paul Belanger --- doc/source/zuul.rst | 5 +++++ zuul/launcher/gearman.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/source/zuul.rst b/doc/source/zuul.rst index 98e4bb8a2a..07b777a2fe 100644 --- a/doc/source/zuul.rst +++ b/doc/source/zuul.rst @@ -49,6 +49,11 @@ gearman Port on which the Gearman server is listening. ``port=4730`` +**check_job_registration** + Check to see if job is registered with Gearman or not. When True + a build result of NOT_REGISTERED will be return if job is not found. + ``check_job_registration=True`` + gearman_server """""""""""""" diff --git a/zuul/launcher/gearman.py b/zuul/launcher/gearman.py index f3b867ce93..3556b4540c 100644 --- a/zuul/launcher/gearman.py +++ b/zuul/launcher/gearman.py @@ -164,6 +164,11 @@ class Gearman(object): port = config.get('gearman', 'port') else: port = 4730 + if config.has_option('gearman', 'check_job_registration'): + self.job_registration = config.getboolean( + 'gearman', 'check_job_registration') + else: + self.job_registration = True self.gearman = ZuulGearmanClient(self) self.gearman.addServer(server, port) @@ -351,7 +356,8 @@ class Gearman(object): build.__gearman_job = gearman_job self.builds[uuid] = build - if not self.isJobRegistered(gearman_job.name): + if self.job_registration and not self.isJobRegistered( + gearman_job.name): self.log.error("Job %s is not registered with Gearman" % gearman_job) self.onBuildCompleted(gearman_job, 'NOT_REGISTERED') @@ -502,7 +508,7 @@ class Gearman(object): # us where the job is running. return False - if not self.isJobRegistered(name): + if self.job_registration and not self.isJobRegistered(name): return False desc_uuid = str(uuid4().hex)