Browse Source

Add more logging to zuul merger process

Add logging to the zuul merger process that includes change numbers so
that threads of execution can be easily tracked from the zuul server log
files to the zuul merger log files.

Change-Id: Ic591f3941d6fe84874e16c8309a101a2918979a2
changes/85/79385/2
Clark Boylan 8 years ago
parent
commit
4c6566b9d5
  1. 8
      zuul/merger/merger.py
  2. 2
      zuul/merger/server.py
  3. 14
      zuul/scheduler.py

8
zuul/merger/merger.py

@ -195,7 +195,7 @@ class Merger(object):
try:
self.log.info("Updating local repository %s", project)
repo.update()
except:
except Exception:
self.log.exception("Unable to update %s", project)
def _mergeChange(self, item, ref):
@ -282,6 +282,12 @@ class Merger(object):
recent = {}
commit = None
for item in items:
if item.get("number") and item.get("patchset"):
self.log.debug("Merging for change %s,%s." %
(item["number"], item["patchset"]))
elif item.get("newrev") and item.get("oldrev"):
self.log.debug("Merging for rev %s with oldrev %s." %
(item["newrev"], item["oldrev"]))
commit = self._mergeItem(item, recent)
if not commit:
return None

2
zuul/merger/server.py

@ -90,8 +90,10 @@ class MergeServer(object):
job = self.worker.getJob()
try:
if job.name == 'merger:merge':
self.log.debug("Got merge job.")
self.merge(job)
elif job.name == 'merger:update':
self.log.debug("Got update job.")
self.update(job)
else:
self.log.error("Unable to handle job %s" % job.name)

14
zuul/scheduler.py

@ -1110,6 +1110,16 @@ class BasePipelineManager(object):
def _makeMergerItem(self, item):
# Create a dictionary with all info about the item needed by
# the merger.
number = None
patchset = None
oldrev = None
newrev = None
if hasattr(item.change, 'number'):
number = item.change.number
patchset = item.change.patchset
elif hasattr(item.change, 'newrev'):
oldrev = item.change.oldrev
newrev = item.change.newrev
return dict(project=item.change.project.name,
url=self.pipeline.trigger.getGitUrl(
item.change.project),
@ -1117,6 +1127,10 @@ class BasePipelineManager(object):
refspec=item.change.refspec,
branch=item.change.branch,
ref=item.current_build_set.ref,
number=number,
patchset=patchset,
oldrev=oldrev,
newrev=newrev,
)
def prepareRef(self, item):

Loading…
Cancel
Save