[Buildbot] #3639: Crash when querying last finished build

Buildbot trac trac at buildbot.net
Sun Oct 30 11:28:12 UTC 2016

#3639: Crash when querying last finished build
Reporter:  kayhayen  |      Owner:
    Type:  defect    |     Status:  new
Priority:  major     |  Milestone:  undecided
 Version:  0.9.0     |   Keywords:
 the called function, builder.builder_status.getLastFinishedBuild() crashes
 like this:

 2016-10-30 12:20:51+0100 [Broker,0,] prioritizing builders;
 order unspecified
         Traceback (most recent call last):
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/buildbot/process/buildrequestdistributor.py", line 376, in
             list(existing_pending | new_builders))
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/twisted/internet/defer.py", line 1406, in unwindGenerator
             return _inlineCallbacks(None, gen, Deferred())
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/twisted/internet/defer.py", line 1260, in _inlineCallbacks
             result = g.send(result)
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/buildbot/process/buildrequestdistributor.py", line 439, in
             builders = yield defer.maybeDeferred(lambda:
         --- <exception caught here> ---
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/twisted/internet/defer.py", line 149, in maybeDeferred
             result = f(*args, **kw)
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/buildbot/process/buildrequestdistributor.py", line 440, in
             sorter(self.master, builders))
           File "/home/nuitka-buildmaster/master/master.cfg", line 1125, in
             builders.sort(key = decidePriority)
           File "/home/nuitka-buildmaster/master/master.cfg", line 1095, in
             if builder.builder_status.getLastFinishedBuild() is not None
 and \
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/buildbot/status/builder.py", line 152, in getLastFinishedBuild
             b = self.getBuild(-1)
           File "/home/nuitka-buildmaster/sandbox/local/lib/python2.7/site-
 packages/buildbot/status/builder.py", line 184, in getBuild
             number = self.nextBuildNumber + number
         exceptions.AttributeError: BuilderStatus instance has no attribute


 I have not looked into this, but this might be an indication that it was
 never run so far. Looking at the source, I didn't see "nextBuildNumber" in
 that class, I assume derived classes control it?

 What I am trying to achieve and did in 0.8.x was to prioritize failed
 builds higher, so they get built again first.

 The code I use is like this:


 from buildbot.process.results import SUCCESS

 def prioritizeBuilders(_, builders):

     def decidePriority(builder):
         score = 0

         # Prefer failed builds if all equal.
         if builder.builder_status.getLastFinishedBuild() is not None and \
            builder.builder_status.getLastFinishedBuild().getResults() !=
             score += 1

         # Prefer release builds by a lot.
         if builder.name.startswith("rel-"):
             if "stable" in builder.name:
                 score += 50
                 score += 25

             # Jessie and Wheezy are most important.
             if "jessie" in builder.name:
                 score += 5

             if "wheezy" in builder.name:
                 score += 4

         if builder.name.startswith("site-"):
             score += 100

         # TODO: Change names of builds around, so this matches.
         if "Py26" in builder.name:
             score -= 1

         if "Py32" in builder.name:
             score -= 1

         return score

     builders.sort(key = decidePriority)

     return builders


Ticket URL: <http://trac.buildbot.net/ticket/3639>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation

More information about the bugs mailing list