Merge lp:~jtv/launchpad/bug-539499 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/bug-539499
Merge into: lp:launchpad
Diff against target: 21 lines (+3/-1)
1 file modified
lib/lp/translations/model/translationtemplatesbuildjob.py (+3/-1)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-539499
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+21637@code.launchpad.net

Commit message

Fix broken slave build id in TranslationTemplatesBuildJob.

Description of the change

= Bug 539499 =

This is a quick interim fix.

TranslationTemplatesBuildJob.getName was meant to produce a slave build id based on branch name and BuildQueue id. TranslationTemplatesBuildBehavior.verifySlaveBuildID checked it for consistency.

Unfortunately getName accidentally used Job.id—a stupid mistake but not unthinkable given the complexity of the build-farm infrastructure. In fact I had been pushing to ditch the whole system of getName/verifySlaveBuildID specializations in favour of a single pair of consistent functions for this.

In case you're wondering where the test is: it's in lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py: test_verifySlaveBuildID_success. It's the perfect setup for detecting this problem. It failed to fail only because when that particular test ran, the Job.id happened to be the same as the BuildQueue.id. (As a test with a temporarily hacked-up extra check confirms).

Instead of hacking up a kludge to protect the test against failure to detect just this specific mistake, I propose I go in and clean up the entire getName/verifySlaveBuildID setup. We need a single pair of implementations using a hash of BuildQueue.id and a few other properties, as discussed on launchpad-dev. It's both safer and easier.

Jeroen

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/model/translationtemplatesbuildjob.py'
2--- lib/lp/translations/model/translationtemplatesbuildjob.py 2010-03-16 07:47:55 +0000
3+++ lib/lp/translations/model/translationtemplatesbuildjob.py 2010-03-18 12:39:22 +0000
4@@ -21,6 +21,7 @@
5 from lp.buildmaster.interfaces.buildfarmjob import (
6 BuildFarmJobType, ISpecificBuildFarmJobClass)
7 from lp.buildmaster.model.buildfarmjob import BuildFarmJob
8+from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet
9 from lp.buildmaster.model.buildqueue import BuildQueue
10 from lp.code.interfaces.branchjob import IRosettaUploadJobSource
11 from lp.buildmaster.interfaces.buildfarmbranchjob import IBuildFarmBranchJob
12@@ -62,7 +63,8 @@
13
14 def getName(self):
15 """See `IBuildFarmJob`."""
16- return '%s-%d' % (self.branch.name, self.job.id)
17+ buildqueue = getUtility(IBuildQueueSet).getByJob(self.job)
18+ return '%s-%d' % (self.branch.name, buildqueue.id)
19
20 def getTitle(self):
21 """See `IBuildFarmJob`."""