Browse Source

Handle builds without gearman jobs

Zuul creates fake Build objects for jobs that it skips due to
merge conflicts and other such situations.  If Zuul decides to
cancel such a build, we should handle it gracefully instead of
throwing an exception.

Also log received gearman job handles to better correlate builds
with gearman debug logs.

Change-Id: I1cd14c8249ac4c68e797430b2b4941f2eeee2acf
changes/11/76611/4
James E. Blair 8 years ago
parent
commit
9f1245869b
  1. 9
      zuul/launcher/gearman.py

9
zuul/launcher/gearman.py

@ -321,12 +321,21 @@ class Gearman(object):
gearman_job)
self.onBuildCompleted(gearman_job, 'NO_HANDLE')
self.log.debug("Received handle %s for %s" % (gearman_job.handle,
build))
return build
def cancel(self, build):
self.log.info("Cancel build %s for job %s" % (build, build.job))
build.canceled = True
try:
job = build.__gearman_job # noqa
except AttributeError:
self.log.debug("Build %s has no associated gearman job" % build)
return
if build.number is not None:
self.log.debug("Build %s has already started" % build)
self.cancelRunningBuild(build)

Loading…
Cancel
Save