Browse Source

Don't store change_queue in QueueItem

This was causing a problem with window sizes on reconfiguration because
the ChangeQueue objects were persisting across the reload via the local
reference inside of QueueItem.  Instead of adding more complexity to
reset those on reEnqueue, drop that and instead find the change queue
via the change's project when needed.

Also fix the fact that the QueueItem pipeline reference was not being
updated (it was set to None before a re-enqueue but then not set to
the new pipeline value).

Change-Id: I7f7050bfec985972ad7a1bc89da02d7b0753b798
changes/73/68773/1
James E. Blair 8 years ago
parent
commit
4a035d9fcb
  1. 6
      zuul/model.py
  2. 11
      zuul/scheduler.py

6
zuul/model.py

@ -412,12 +412,13 @@ class ChangeQueue(object):
self._jobs |= set(self.pipeline.getJobTree(project).getJobs())
def enqueueChange(self, change):
item = QueueItem(self, self.pipeline, change)
item = QueueItem(self.pipeline, change)
self.enqueueItem(item)
item.enqueue_time = time.time()
return item
def enqueueItem(self, item):
item.pipeline = self.pipeline
if self.dependent and self.queue:
item.item_ahead = self.queue[-1]
item.item_ahead.items_behind.append(item)
@ -659,8 +660,7 @@ class BuildSet(object):
class QueueItem(object):
"""A changish inside of a Pipeline queue"""
def __init__(self, change_queue, pipeline, change):
self.change_queue = change_queue
def __init__(self, pipeline, change):
self.pipeline = pipeline
self.change = change # a changeish
self.build_sets = []

11
zuul/scheduler.py

@ -1255,19 +1255,18 @@ class BasePipelineManager(object):
item.change.branch)
self.log.info("Reported change %s status: all-succeeded: %s, "
"merged: %s" % (item.change, succeeded, merged))
change_queue = self.pipeline.getQueue(item.change.project)
if not (succeeded and merged):
self.log.debug("Reported change %s failed tests or failed "
"to merge" % (item.change))
item.change_queue.decreaseWindowSize()
change_queue.decreaseWindowSize()
self.log.debug("%s window size decreased to %s" %
(item.change_queue,
item.change_queue.window))
(change_queue, change_queue.window))
raise MergeFailure("Change %s failed to merge" % item.change)
else:
item.change_queue.increaseWindowSize()
change_queue.increaseWindowSize()
self.log.debug("%s window size increased to %s" %
(item.change_queue,
item.change_queue.window))
(change_queue, change_queue.window))
def _reportItem(self, item):
if item.reported:

Loading…
Cancel
Save