Merge bug 617259 from the default branch production
authorBen Hearsum <bhearsum@mozilla.com>
Tue, 07 Dec 2010 09:34:59 -0500
branchproduction
changeset 3360 00ff5cf919bd57077e48dee31089b3b5ac8722d6
parent 3358 27c879cf082ee956ec3a8a39094bb3e1335602bc (current diff)
parent 3359 45fbfd1a794c40eee97f36cd156c04eec8b0836e (diff)
child 3366 25769e0e596104ebe42e6c09a7426b47e8ebae82
push id2650
push userbhearsum@mozilla.com
push dateTue, 07 Dec 2010 14:35:16 +0000
bugs617259
Merge bug 617259 from the default branch
--- a/mozilla-tests/tests_master.cfg
+++ b/mozilla-tests/tests_master.cfg
@@ -54,34 +54,11 @@ import passwords
 reload(passwords)
 from passwords import BBDB_URL
 c['db_url'] = BBDB_URL
 c['db_poll_interval'] = 60
 c['multiMaster'] = True
 
 c['mergeRequests'] = buildbotcustom.misc.mergeRequests
 
-# Give the release builders highest priority, then all branches priority over try
-def prioritizeBuilders(botmaster, builders):
-    def sortkey(builder):
-        builds = builder.getBuildable()
-        if builds:
-            req_priority = -builds[0].priority
-            submitted_at = builds[0].submittedAt
-        else:
-            req_priority = 0
-            submitted_at = None
-
-        if builder.builder_status.category.endswith('-release'):
-            priority = 0
-        elif builder.builder_status.category == 'tryserver':
-            priority = 2
-        else:
-            priority = 1
-
-        return priority, req_priority, submitted_at
-    builders.sort(key=sortkey)
-    return builders
-c['prioritizeBuilders'] = prioritizeBuilders
-
 # c is shorthand for BuildmasterConfig, so make sure they still refer to the
 # same thing
 assert c is BuildmasterConfig
--- a/mozilla-tests/universal_master_sqlite.cfg
+++ b/mozilla-tests/universal_master_sqlite.cfg
@@ -47,34 +47,11 @@ for branch in ACTIVE_BRANCHES:
 # Required for sendchange
 from buildbot.changes.pb import PBChangeSource
 c['change_source'].append(PBChangeSource())
 
 c['db_url'] = "sqlite:///state.sqlite"
 
 c['mergeRequests'] = buildbotcustom.misc.mergeRequests
 
-# Give the release builders highest priority, then all branches priority over try
-def prioritizeBuilders(botmaster, builders):
-    def sortkey(builder):
-        builds = builder.getBuildable()
-        if builds:
-            req_priority = -builds[0].priority
-            submitted_at = builds[0].submittedAt
-        else:
-            req_priority = 0
-            submitted_at = None
-
-        if builder.builder_status.category.endswith('-release'):
-            priority = 0
-        elif builder.builder_status.category == 'tryserver':
-            priority = 2
-        else:
-            priority = 1
-
-        return priority, req_priority, submitted_at
-    builders.sort(key=sortkey)
-    return builders
-c['prioritizeBuilders'] = prioritizeBuilders
-
 # c is shorthand for BuildmasterConfig, so make sure they still refer to the
 # same thing
 assert c is BuildmasterConfig
--- a/mozilla/builder_master.cfg
+++ b/mozilla/builder_master.cfg
@@ -78,36 +78,11 @@ import passwords
 reload(passwords)
 from passwords import BBDB_URL
 c['db_url'] = BBDB_URL
 c['db_poll_interval'] = 60
 c['multiMaster'] = True
 
 c['mergeRequests'] = buildbotcustom.misc.mergeRequests
 
-# Give the release builders priority over other builders
-def prioritizeBuilders(botmaster, builders):
-    def sortkey(builder):
-        builds = builder.getBuildable()
-        if builds:
-            # The builder that gets sorted first, gets run first, but the build
-            # request priorities are in ascending order (higher priority gets
-            # run next), so flip the sign of the priority so that higher
-            # priorities sort to the front
-            req_priority = -builds[0].priority
-            submitted_at = builds[0].submittedAt
-        else:
-            req_priority = 0
-            submitted_at = None
-
-        if builder.builder_status.category.startswith('release'):
-            priority = 0
-        else:
-            priority = 1
-
-        return priority, req_priority, submitted_at
-    builders.sort(key=sortkey)
-    return builders
-c['prioritizeBuilders'] = prioritizeBuilders
-
 # c is shorthand for BuildmasterConfig, so make sure they still refer to the
 # same thing
 assert c is BuildmasterConfig
--- a/mozilla/master_common.py
+++ b/mozilla/master_common.py
@@ -8,8 +8,35 @@ c['eventHorizon'] = 20
 c['buildCacheSize'] = 10
 c['changeCacheSize'] = 10000
 
 c['status'] = []
 c['slaves'] = []
 c['builders'] = []
 c['schedulers'] = []
 c['change_source'] = []
+
+# Give the release builders priority over other builders
+def prioritizeBuilders(botmaster, builders):
+    def sortkey(builder):
+        builds = builder.getBuildable(1)
+        if builds:
+            # The builder that gets sorted first, gets run first, but the build
+            # request priorities are in ascending order (higher priority gets
+            # run next), so flip the sign of the priority so that higher
+            # priorities sort to the front
+            req_priority = -builds[0].priority
+            submitted_at = builds[0].submittedAt
+        else:
+            req_priority = 0
+            submitted_at = None
+
+        if builder.builder_status.category.startswith('release'):
+            priority = 0
+        elif builder.builder_status.category.startswith('try'):
+            priority = 2
+        else:
+            priority = 1
+
+        return priority, req_priority, submitted_at
+    builders.sort(key=sortkey)
+    return builders
+c['prioritizeBuilders'] = prioritizeBuilders
--- a/mozilla/universal_master_sqlite.cfg
+++ b/mozilla/universal_master_sqlite.cfg
@@ -72,36 +72,11 @@ if ENABLE_RELEASES:
         from buildbot.changes.pb import PBChangeSource
         if len([cs for cs in c['change_source'] if isinstance(cs, PBChangeSource)]) < 1:
             c['change_source'].append(PBChangeSource())
 
 c['db_url'] = "sqlite:///state.sqlite"
 
 c['mergeRequests'] = buildbotcustom.misc.mergeRequests
 
-# Give the release builders priority over other builders
-def prioritizeBuilders(botmaster, builders):
-    def sortkey(builder):
-        builds = builder.getBuildable()
-        if builds:
-            # The builder that gets sorted first, gets run first, but the build
-            # request priorities are in ascending order (higher priority gets
-            # run next), so flip the sign of the priority so that higher
-            # priorities sort to the front
-            req_priority = -builds[0].priority
-            submitted_at = builds[0].submittedAt
-        else:
-            req_priority = 0
-            submitted_at = None
-
-        if builder.builder_status.category == 'release':
-            priority = 0
-        else:
-            priority = 1
-
-        return priority, req_priority, submitted_at
-    builders.sort(key=sortkey)
-    return builders
-c['prioritizeBuilders'] = prioritizeBuilders
-
 # c is shorthand for BuildmasterConfig, so make sure they still refer to the
 # same thing
 assert c is BuildmasterConfig