This looks pretty good. I have one commenting suggestion below which isn't terribly important, and one potentially important performance question at the bottom of the diff below.
Is there any chance of a cold cache use of this method causing performance issues? I'm not saying it will, just asking. I have no idea how large the query fired for this could be.
Aaron--
This looks pretty good. I have one commenting suggestion below which isn't terribly important, and one potentially important performance question at the bottom of the diff below.
> === modified file 'lib/lp/ archiveuploader /tests/ test_uploadproc essor.py' archiveuploader /tests/ test_uploadproc essor.py 2011-01-27 16:13:58 +0000 archiveuploader /tests/ test_uploadproc essor.py 2011-01-27 16:13:59 +0000 ler(self. uploadprocessor , self.incoming_ folder, .process( ) txn.commit( ) geRecipeBuild_ fail(self) : ecipeBuild( ) ls(BuildStatus. FAILEDTOUPLOAD, build.status) ls(None, build.builder) t(None, build.duration) t(None, build.upload_log) geRecipeBuild_ fail_mail( self): ecipeBuild( ) ].replace( '\n\t', ' ') 'Failed to upload', subject) payload( decode= True) 'Upload Log: http', body) validStatus( self):
> --- lib/lp/
> +++ lib/lp/
> @@ -2012,11 +2022,23 @@
> BuildUploadHand
> leaf_name)
> self.layer.
> + return build
> +
> + def testSourcePacka
> + build = self.doFailureR
> self.assertEqua
> self.assertEqua
> self.assertIsNo
> self.assertIsNo
>
> + def testSourcePacka
> + self.doFailureR
> + (mail,) = pop_notifications()
> + subject = mail['Subject'
> + self.assertIn(
> + body = mail.get_
> + self.assertIn(
> +
> def testBuildWithIn
> # Builds with an invalid (non-UPLOADING) status should trigger
> # a warning but be left alone.
A comment to the effect geRecipeBuild_ fail_mail would be good.
+ # When a recipe fails it should include the log in the mail.
in testSourcePacka
> @@ -192,9 +191,23 @@ ('PackageUpload Source' , 'packageupload' ) ('PackageUpload Build', 'packageupload' ) self): model.sourcepac kagerecipebuild import ( cipeBuild) model.sourcepac kagerelease import SourcePackageRe lease self).find( cipeBuild, cipeBuild. id == lease.source_ package_ recipe_ build_id, lease.id == urce.sourcepack agereleaseID, urce.packageupl oad == self.id).one() ('PackageUpload Custom' , 'packageupload' ) `.""" uild()
> # PackageUploadSource objects which are related.
> sources = SQLMultipleJoin
> joinColumn=
> + # Does not include source builds.
> builds = SQLMultipleJoin
> joinColumn=
>
> + def getSourceBuild(
> + #avoid circular import
> + from lp.code.
> + SourcePackageRe
> + from lp.soyuz.
> + return Store.of(
> + SourcePackageRe
> + SourcePackageRe
> + SourcePackageRe
> + SourcePackageRe
> + PackageUploadSo
> + PackageUploadSo
> +
> # Also the custom files associated with the build.
> customfiles = SQLMultipleJoin
> joinColumn=
> @@ -488,6 +501,10 @@
> """See `IPackageUpload
> return self.builds
>
> + @cachedproperty
> + def from_build(self):
> + return bool(self.builds) or self.getSourceB
> +
Is there any chance of a cold cache use of this method causing performance issues? I'm not saying it will, just asking. I have no idea how large the query fired for this could be.