Merge lp:~abentley/launchpad/new-score into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Approved by: Edwin Grubbs
Approved revision: no longer in the source branch.
Merged at revision: 11254
Proposed branch: lp:~abentley/launchpad/new-score
Merge into: lp:launchpad
Diff against target: 107 lines (+25/-9)
5 files modified
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+2/-2)
lib/lp/code/model/sourcepackagerecipe.py (+2/-1)
lib/lp/code/model/sourcepackagerecipebuild.py (+1/-1)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+16/-4)
lib/lp/code/templates/sourcepackagerecipebuild-index.pt (+4/-1)
To merge this branch: bzr merge lp:~abentley/launchpad/new-score
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+31178@code.launchpad.net

Commit message

Revise build scores and show in UI

Description of the change

= 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 ','

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Aaron,

This branch looks good.

-Edwin

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-29 18:36:51 +0000
@@ -625,7 +625,7 @@
625 # Secret Squirrel is checked by default.625 # Secret Squirrel is checked by default.
626 self.assertEqual(['Secret Squirrel', 'Woody'], build_distros)626 self.assertEqual(['Secret Squirrel', 'Woody'], build_distros)
627 self.assertEqual(627 self.assertEqual(
628 set([1000]),628 set([2505]),
629 set(build.buildqueue_record.lastscore for build in builds))629 set(build.buildqueue_record.lastscore for build in builds))
630630
631 def test_request_builds_archive(self):631 def test_request_builds_archive(self):
@@ -759,7 +759,7 @@
759 my-recipe759 my-recipe
760 Build status760 Build status
761 Needs building761 Needs building
762 Start in .*762 Start in .* \\(9876\\) What's this?.*
763 Estimated finish in .*763 Estimated finish in .*
764 Build details764 Build details
765 Recipe: Recipe my-recipe for Owner765 Recipe: Recipe my-recipe for Owner
766766
=== 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-29 18:36:51 +0000
@@ -225,8 +225,9 @@
225 build = getUtility(ISourcePackageRecipeBuildSource).new(distroseries,225 build = getUtility(ISourcePackageRecipeBuildSource).new(distroseries,
226 self, requester, archive)226 self, requester, archive)
227 build.queueBuild(build)227 build.queueBuild(build)
228 queue_record = build.buildqueue_record
228 if manual:229 if manual:
229 build.buildqueue_record.manualScore(1000)230 queue_record.manualScore(queue_record.lastscore + 100)
230 return build231 return build
231232
232 def getBuilds(self, pending=False):233 def getBuilds(self, pending=False):
233234
=== 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-29 18:36:51 +0000
@@ -367,4 +367,4 @@
367 return "%s-%s" % (self.id, self.build_id)367 return "%s-%s" % (self.id, self.build_id)
368368
369 def score(self):369 def score(self):
370 return 900370 return 2405 + self.build.archive.relative_build_score
371371
=== 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-29 18:36:51 +0000
@@ -265,24 +265,36 @@
265 ppa.owner, distroseries, PackagePublishingPocket.RELEASE)265 ppa.owner, distroseries, PackagePublishingPocket.RELEASE)
266266
267 def test_requestBuildScore(self):267 def test_requestBuildScore(self):
268 """Normal build requests have a relatively low queue score (900)."""268 """Normal build requests have a relatively low queue score (2405)."""
269 recipe = self.factory.makeSourcePackageRecipe()269 recipe = self.factory.makeSourcePackageRecipe()
270 build = recipe.requestBuild(recipe.daily_build_archive,270 build = recipe.requestBuild(recipe.daily_build_archive,
271 recipe.owner, list(recipe.distroseries)[0],271 recipe.owner, list(recipe.distroseries)[0],
272 PackagePublishingPocket.RELEASE)272 PackagePublishingPocket.RELEASE)
273 queue_record = build.buildqueue_record273 queue_record = build.buildqueue_record
274 queue_record.score()274 queue_record.score()
275 self.assertEqual(900, queue_record.lastscore)275 self.assertEqual(2405, queue_record.lastscore)
276276
277 def test_requestBuildManualScore(self):277 def test_requestBuildManualScore(self):
278 """Normal build requests have a higher queue score (1000)."""278 """Normal build requests have a score equivalent to binary builds."""
279 recipe = self.factory.makeSourcePackageRecipe()279 recipe = self.factory.makeSourcePackageRecipe()
280 build = recipe.requestBuild(recipe.daily_build_archive,280 build = recipe.requestBuild(recipe.daily_build_archive,
281 recipe.owner, list(recipe.distroseries)[0],281 recipe.owner, list(recipe.distroseries)[0],
282 PackagePublishingPocket.RELEASE, manual=True)282 PackagePublishingPocket.RELEASE, manual=True)
283 queue_record = build.buildqueue_record283 queue_record = build.buildqueue_record
284 queue_record.score()284 queue_record.score()
285 self.assertEqual(1000, queue_record.lastscore)285 self.assertEqual(2505, queue_record.lastscore)
286
287 def test_requestBuild_relative_build_score(self):
288 """Offsets for archives are respected."""
289 recipe = self.factory.makeSourcePackageRecipe()
290 archive = recipe.daily_build_archive
291 removeSecurityProxy(archive).relative_build_score = 100
292 build = recipe.requestBuild(
293 archive, recipe.owner, list(recipe.distroseries)[0],
294 PackagePublishingPocket.RELEASE, manual=True)
295 queue_record = build.buildqueue_record
296 queue_record.score()
297 self.assertEqual(2605, queue_record.lastscore)
286298
287 def test_requestBuildHonoursConfig(self):299 def test_requestBuildHonoursConfig(self):
288 recipe = self.factory.makeSourcePackageRecipe()300 recipe = self.factory.makeSourcePackageRecipe()
289301
=== 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-29 18:36:51 +0000
@@ -116,7 +116,10 @@
116 <tal:pending condition="context/buildqueue_record/job/status/enumvalue:WAITING">116 <tal:pending condition="context/buildqueue_record/job/status/enumvalue:WAITING">
117 <li tal:define="eta context/buildqueue_record/getEstimatedJobStartTime">117 <li tal:define="eta context/buildqueue_record/getEstimatedJobStartTime">
118 Start <tal:eta118 Start <tal:eta
119 replace="eta/fmt:approximatedate">in 3 hours</tal:eta>119 replace="eta/fmt:approximatedate">in 3 hours</tal:eta>
120 (<span tal:replace="context/buildqueue_record/lastscore"/>)
121 <a href="https://help.launchpad.net/Packaging/BuildScores"
122 target="_blank">What's this?</a>
120 </li>123 </li>
121 </tal:pending>124 </tal:pending>
122 </tal:reallypending>125 </tal:reallypending>