Don't calculate priority of non-live items

Two earlier adjustments to the dynamic node priority removed
non-live items from the count of items in the queue and then
protected against the case where processOneItem attempted to
calculate the priority of a non-live item.  Instead, just avoid
calling getNodePriority from processOneItem if the item is not
live (it has no node requests), and for efficiency, remove the
safety check in getNodePriority which should no longer be
necessary.

Change-Id: Ibcf26664f3721961d8e767776f2128ec4298ffd0
This commit is contained in:
James E. Blair 2018-12-03 08:32:28 -08:00
parent 9f849e1f99
commit e2887fea70
1 changed files with 2 additions and 5 deletions

View File

@ -90,10 +90,7 @@ class PipelineManager(object):
items = [i for i in items
if i.change.project == item.change.project and
i.live]
for idx, val in enumerate(items):
if item == val:
return idx
return len(items)
return items.index(item)
def isChangeAlreadyInPipeline(self, change):
# Checks live items in the pipeline
@ -701,7 +698,7 @@ class PipelineManager(object):
if failing_reasons:
self.log.debug("%s is a failing item because %s" %
(item, failing_reasons))
if not dequeued and self.sched.use_relative_priority:
if item.live and not dequeued and self.sched.use_relative_priority:
priority = item.getNodePriority()
for node_request in item.current_build_set.node_requests.values():
if node_request.relative_priority != priority: