← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/new-score into lp:launchpad/devel

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/new-score into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


= Summary =
Fix bug #610960: recipe build scores should be higher

== Proposed fix ==
Score manual builds at 2505, like a similar binary build would be scored.
Score automatic builds at 2405, so manual builds take precedence.

== Pre-implementation notes ==
Discussed with bigjools.

== Implementation details ==
Honour the relative_build_score attribute of archives.

Show the build score on the build page (like binary builds.)

== Tests ==
bin/test -t render_index -t requestBuild test_sourcepackagerecipe

== Demo and Q/A ==
Create a build.  Its score should be shown as 2505.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/model/tests/test_sourcepackagerecipe.py
  lib/lp/code/templates/sourcepackagerecipebuild-index.pt
  lib/lp/code/model/sourcepackagerecipebuild.py
  lib/lp/code/model/sourcepackagerecipe.py
  lib/lp/code/browser/tests/test_sourcepackagerecipe.py

./lib/lp/code/model/tests/test_sourcepackagerecipe.py
     216: E231 missing whitespace after ','
     240: E231 missing whitespace after ','
     248: E231 missing whitespace after ','
     255: E231 missing whitespace after ','
     263: E231 missing whitespace after ','
     301: E231 missing whitespace after ','
     361: E231 missing whitespace after ','
     658: Line exceeds 78 characters.
./lib/lp/code/model/sourcepackagerecipebuild.py
      46: E231 missing whitespace after ','
./lib/lp/code/model/sourcepackagerecipe.py
     184: E301 expected 1 blank line, found 0
./lib/lp/code/browser/tests/test_sourcepackagerecipe.py
     243: E231 missing whitespace after ','
-- 
https://code.launchpad.net/~abentley/launchpad/new-score/+merge/31178
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/new-score into lp:launchpad/devel.
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2010-07-26 06:21:45 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2010-07-28 17:21:51 +0000
@@ -759,7 +759,7 @@
             my-recipe
             Build status
             Needs building
-            Start in .*
+            Start in .* \\(9876\\) What's this?.*
             Estimated finish in .*
             Build details
             Recipe:        Recipe my-recipe for Owner

=== modified file 'lib/lp/code/model/sourcepackagerecipe.py'
--- lib/lp/code/model/sourcepackagerecipe.py	2010-07-21 14:41:26 +0000
+++ lib/lp/code/model/sourcepackagerecipe.py	2010-07-28 17:21:51 +0000
@@ -225,8 +225,9 @@
         build = getUtility(ISourcePackageRecipeBuildSource).new(distroseries,
             self, requester, archive)
         build.queueBuild(build)
+        queue_record = build.buildqueue_record
         if manual:
-            build.buildqueue_record.manualScore(1000)
+            queue_record.manualScore(queue_record.lastscore + 100)
         return build
 
     def getBuilds(self, pending=False):

=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py	2010-07-14 09:35:20 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py	2010-07-28 17:21:51 +0000
@@ -367,4 +367,4 @@
         return "%s-%s" % (self.id, self.build_id)
 
     def score(self):
-        return 900
+        return 2405 + self.build.archive.relative_build_score

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py	2010-07-22 08:39:05 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py	2010-07-28 17:21:51 +0000
@@ -265,24 +265,36 @@
                 ppa.owner, distroseries, PackagePublishingPocket.RELEASE)
 
     def test_requestBuildScore(self):
-        """Normal build requests have a relatively low queue score (900)."""
+        """Normal build requests have a relatively low queue score (2405)."""
         recipe = self.factory.makeSourcePackageRecipe()
         build = recipe.requestBuild(recipe.daily_build_archive,
             recipe.owner, list(recipe.distroseries)[0],
             PackagePublishingPocket.RELEASE)
         queue_record = build.buildqueue_record
         queue_record.score()
-        self.assertEqual(900, queue_record.lastscore)
+        self.assertEqual(2405, queue_record.lastscore)
 
     def test_requestBuildManualScore(self):
-        """Normal build requests have a higher queue score (1000)."""
+        """Normal build requests have a score equivalent to binary builds."""
         recipe = self.factory.makeSourcePackageRecipe()
         build = recipe.requestBuild(recipe.daily_build_archive,
             recipe.owner, list(recipe.distroseries)[0],
             PackagePublishingPocket.RELEASE, manual=True)
         queue_record = build.buildqueue_record
         queue_record.score()
-        self.assertEqual(1000, queue_record.lastscore)
+        self.assertEqual(2505, queue_record.lastscore)
+
+    def test_requestBuild_relative_build_score(self):
+        """Offsets for archives are respected."""
+        recipe = self.factory.makeSourcePackageRecipe()
+        archive = recipe.daily_build_archive
+        removeSecurityProxy(archive).relative_build_score = 100
+        build = recipe.requestBuild(
+            archive, recipe.owner, list(recipe.distroseries)[0],
+            PackagePublishingPocket.RELEASE, manual=True)
+        queue_record = build.buildqueue_record
+        queue_record.score()
+        self.assertEqual(2605, queue_record.lastscore)
 
     def test_requestBuildHonoursConfig(self):
         recipe = self.factory.makeSourcePackageRecipe()

=== modified file 'lib/lp/code/templates/sourcepackagerecipebuild-index.pt'
--- lib/lp/code/templates/sourcepackagerecipebuild-index.pt	2010-07-21 10:48:23 +0000
+++ lib/lp/code/templates/sourcepackagerecipebuild-index.pt	2010-07-28 17:21:51 +0000
@@ -116,7 +116,10 @@
       <tal:pending condition="context/buildqueue_record/job/status/enumvalue:WAITING">
         <li tal:define="eta context/buildqueue_record/getEstimatedJobStartTime">
           Start <tal:eta
-            replace="eta/fmt:approximatedate">in 3 hours</tal:eta>
+          replace="eta/fmt:approximatedate">in 3 hours</tal:eta>
+          (<span tal:replace="context/buildqueue_record/lastscore"/>)
+          <a href="https://help.launchpad.net/Packaging/BuildScores";
+             target="_blank">What's this?</a>
         </li>
       </tal:pending>
       </tal:reallypending>