Merge lp:~cjwatson/launchpad/packageset-score into lp:launchpad
| Status: | Merged | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Approved by: | Francesco Banconi on 2012-05-16 | ||||||||
| Approved revision: | no longer in the source branch. | ||||||||
| Merged at revision: | 15264 | ||||||||
| Proposed branch: | lp:~cjwatson/launchpad/packageset-score | ||||||||
| Merge into: | lp:launchpad | ||||||||
| Diff against target: |
815 lines (+262/-362) 10 files modified
database/schema/patch-2209-18-0.sql (+2/-0) lib/lp/buildmaster/tests/test_buildqueue.py (+17/-1) lib/lp/security.py (+5/-1) lib/lp/soyuz/configure.zcml (+6/-1) lib/lp/soyuz/doc/buildd-scoring.txt (+0/-262) lib/lp/soyuz/interfaces/packageset.py (+11/-2) lib/lp/soyuz/model/buildpackagejob.py (+12/-6) lib/lp/soyuz/model/packageset.py (+3/-1) lib/lp/soyuz/tests/test_buildpackagejob.py (+206/-83) lib/lp/soyuz/tests/test_doc.py (+0/-5) |
||||||||
| To merge this branch: | bzr merge lp:~cjwatson/launchpad/packageset-score | ||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Raphaël Badin (community) | 2012-05-16 | Approve on 2012-05-16 | |
| Francesco Banconi (community) | code* | 2012-05-16 | Approve on 2012-05-16 |
|
Review via email:
|
|||
Commit Message
Allow members of launchpad-
Description of the Change
== Summary ==
Make it possible to adjust build scores by packagesets, so that we can favour builds that are more likely to be needed to build images. See bug 990219.
== Proposed fix ==
In a previous branch, I added a score column on Packageset. This adds the code to make use of it, and a webservice method restricted to launchpad-
== Pre-implementation notes ==
I discussed this briefly with William Grant on IRC; the notes are in the bug. I discussed the permission handling with Curtis Hovey.
== Implementation details ==
The main awkwardness was where to put the webservice method to set the score, since nothing else in Packageset is restricted to launchpad-
If a package is in multiple package sets, it gets the maximum of their scores, not (say) the sum. The latter seems likely to be overkill.
As usual, I had to spend some time reducing LoC. I did some refactoring of test_buildpacka
== Tests ==
bin/test -vvct TestBuildPackag
== Demo and Q/A ==
Add hello to some packageset on dogfood and set that packageset's score to something non-zero. Upload hello to quantal on dogfood with urgency=low. Its initial score should be the RELEASE/main/low default of 2505 plus the packageset score.
Double-check, for good measure, that a user not in launchpad-
== Lint ==
Just one:
./database/
8: Line exceeds 80 characters.
This is a COMMENT statement, where the convention appears to be to not wrap.
| Raphaël Badin (rvb) wrote : | # |
Great work! As Francesco said, congrats for turning the doc tests into proper unit tests.
[0]
551 + for sourcename in (
552 + "gedit",
553 + "firefox",
554 + "cobblers",
555 + "thunderpants",
556 + "apg",
557 + "vim",
558 + "gcc",
559 + "bison",
560 + "flex",
561 + "postgres",
562 + ):
You've made this code much more compact and readable but maybe you can go one step further and avoid having the list defined in the loop statement: please consider using this construct:
sourcenames = [
"gedit",
"firefox",
[...]
"cobblers",
"thunderpants"
]
for sourcename in sourcenames:
[...]
[1]
614 + # 1500 (RELEASE) + 1000 (main) + 5 (low) = 2505.
615 + job = self.makeBuildJ
616 + self.assertEqua
Maybe you could use:
self.assertEqual(
SCORE_
job.score())
instead of putting the integer value (2505). This would help document the code in the other tests similar to this one where no comment is present and it also would avoid hardcoding the integer values in the tests. I know these values are probably not gonna change soon but I think it's still a healthy way to write more explicit tests
[2]
I think you're missing a test to make sure that 'score' can be read through the api. Strickly speaking, it's tested in test_score_
| Colin Watson (cjwatson) wrote : | # |
Thanks for your review and suggestions. I believe I've implemented all
of these now, along with some further changes to speed up the webservice
tests.
If you're happy with this, could you set the MP status to Approved and
then I can land it? (I can't do that myself as I'm not in ~launchpad.)
| Julian Edwards (julian-edwards) wrote : | # |
Great, thanks for removing the doctest, that's awesome!
However, the new PackageSet.score is a terrible name :( The comparable field on IArchive is called relative_
I have filed bug 1000570 to track this.
| Colin Watson (cjwatson) wrote : | # |
The property name (aside from the DB column name) is now fixed courtesy of a later merge from this branch.

This branch looks great Colin, thank you! agejob` .
I am a little confused about how to actually demo your changes, and I think that's mostly my fault due to my my lack of experience with the API.
However, the tests pass, and I liked a lot how you reduced LoC by removing a doctests file and refactoring `test_buildpack
Approved, and waiting for Raphaël suggestions.