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
This commit is contained in:
James E. Blair 2014-01-23 13:10:48 -08:00
parent 7603a37725
commit 4a035d9fcb
2 changed files with 8 additions and 9 deletions

View File

@ -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 = []

View File

@ -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: