Browse Source

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
tags/3.4.0
James E. Blair 5 months ago
parent
commit
e2887fea70
1 changed files with 2 additions and 5 deletions
  1. 2
    5
      zuul/manager/__init__.py

+ 2
- 5
zuul/manager/__init__.py View File

@@ -90,10 +90,7 @@ class PipelineManager(object):
90 90
         items = [i for i in items
91 91
                  if i.change.project == item.change.project and
92 92
                  i.live]
93
-        for idx, val in enumerate(items):
94
-            if item == val:
95
-                return idx
96
-        return len(items)
93
+        return items.index(item)
97 94
 
98 95
     def isChangeAlreadyInPipeline(self, change):
99 96
         # Checks live items in the pipeline
@@ -701,7 +698,7 @@ class PipelineManager(object):
701 698
         if failing_reasons:
702 699
             self.log.debug("%s is a failing item because %s" %
703 700
                            (item, failing_reasons))
704
-        if not dequeued and self.sched.use_relative_priority:
701
+        if item.live and not dequeued and self.sched.use_relative_priority:
705 702
             priority = item.getNodePriority()
706 703
             for node_request in item.current_build_set.node_requests.values():
707 704
                 if node_request.relative_priority != priority:

Loading…
Cancel
Save