← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/drop-previewdiff-garbo into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/drop-previewdiff-garbo into lp:launchpad with lp:~stevenk/launchpad/populate-previewdiff-merge_proposal as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/drop-previewdiff-garbo/+merge/162914

Drop the PopulatePreviewDiffMergePropsal garbo job.
-- 
https://code.launchpad.net/~stevenk/launchpad/drop-previewdiff-garbo/+merge/162914
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/drop-previewdiff-garbo into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2013-05-08 02:24:33 +0000
+++ database/schema/security.cfg	2013-03-25 23:39:42 +0000
@@ -2248,7 +2248,6 @@
 public.openidconsumerassociation        = SELECT, DELETE
 public.openidconsumernonce              = SELECT, DELETE
 public.person                           = SELECT, DELETE
-public.previewdiff                      = SELECT, UPDATE
 public.product                          = SELECT, UPDATE
 public.pofiletranslator                 = SELECT, INSERT, UPDATE, DELETE
 public.potranslation                    = SELECT, DELETE

=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2013-05-08 02:24:33 +0000
+++ lib/lp/scripts/garbo.py	2013-05-08 02:24:34 +0000
@@ -58,13 +58,8 @@
     MAX_SAMPLE_SIZE,
     )
 from lp.code.interfaces.revision import IRevisionSet
-from lp.code.model.branchmergeproposal import BranchMergeProposal
 from lp.code.model.codeimportevent import CodeImportEvent
 from lp.code.model.codeimportresult import CodeImportResult
-from lp.code.model.diff import (
-    Diff,
-    PreviewDiff,
-    )
 from lp.code.model.revision import (
     RevisionAuthor,
     RevisionCache,
@@ -1343,43 +1338,6 @@
         transaction.commit()
 
 
-class PopulatePreviewDiffMergeProposal(TunableLoop):
-
-    maximum_chunk_size = 5000
-
-    def __init__(self, log, abort_time=None):
-        super(PopulatePreviewDiffMergeProposal, self).__init__(log, abort_time)
-        self.start_at = 1
-        self.store = IMasterStore(BranchMergeProposal)
-
-    def findBranchMergeProposalIDs(self):
-        return self.store.find(
-            (BranchMergeProposal.id),
-            BranchMergeProposal.preview_diff_id != None,
-            BranchMergeProposal.id >= self.start_at).order_by(
-                BranchMergeProposal.id)
-
-    def isDone(self):
-        return self.findBranchMergeProposalIDs().is_empty()
-
-    def __call__(self, chunk_size):
-        bmp_ids = list(self.findBranchMergeProposalIDs()[:chunk_size])
-        columns = dict(
-            [(PreviewDiff.merge_proposal_id, BranchMergeProposal.id),
-             (PreviewDiff.date_created, LibraryFileAlias.date_created)])
-        self.store.execute(
-            BulkUpdate(
-                columns, table=PreviewDiff,
-                values=[BranchMergeProposal, Diff, LibraryFileAlias],
-                where=And(
-                    BranchMergeProposal.id.is_in(bmp_ids),
-                    PreviewDiff.diff_id == Diff.id,
-                    Diff.diff_text == LibraryFileAlias.id,
-                    PreviewDiff.id == BranchMergeProposal.preview_diff_id)))
-        self.start_at = bmp_ids[-1] + 1
-        transaction.commit()
-
-
 class BaseDatabaseGarbageCollector(LaunchpadCronScript):
     """Abstract base class to run a collection of TunableLoops."""
     script_name = None  # Script name for locking and database user. Override.
@@ -1634,7 +1592,6 @@
         UnusedSessionPruner,
         DuplicateSessionPruner,
         BugHeatUpdater,
-        PopulatePreviewDiffMergeProposal,
         ]
     experimental_tunable_loops = []
 

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2013-05-08 02:24:33 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2013-02-01 03:45:53 +0000
@@ -1167,21 +1167,6 @@
             [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],
             self.getAccessPolicyTypes(product))
 
-    def test_PopulatePreviewDiffMergeProposal(self):
-        switch_dbuser('testadmin')
-        diffs = [self.factory.makePreviewDiff() for i in range(5)]
-        expected_bmps = [diff.merge_proposal_id for diff in diffs]
-        expected_dates = [diff.diff.diff_text.date_created for diff in diffs]
-        for diff in diffs:
-            diff.merge_proposal.preview_diff = diff
-            diff.merge_proposal = None
-            diff.date_created = None
-        self.runHourly()
-        self.assertContentEqual(
-            expected_bmps, [diff.merge_proposal_id for diff in diffs])
-        self.assertEqual(
-            expected_dates, [diff.date_created for diff in diffs])
-
     def test_PopulateLatestPersonSourcePackageReleaseCache(self):
         switch_dbuser('testadmin')
         # Make some same test data - we create published source package