launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20204
[Merge] lp:~cjwatson/launchpad/remove-person-settings-enf-populator into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-person-settings-enf-populator into lp:launchpad.
Commit message:
Remove completed PersonSettings.expanded_notification_footers population job.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-person-settings-enf-populator/+merge/291006
Remove completed PersonSettings.expanded_notification_footers population job. It completed on all instances ages ago.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-person-settings-enf-populator into lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2016-03-02 14:03:42 +0000
+++ lib/lp/scripts/garbo.py 2016-04-05 15:55:09 +0000
@@ -70,10 +70,7 @@
)
from lp.hardwaredb.model.hwdb import HWSubmission
from lp.registry.model.commercialsubscription import CommercialSubscription
-from lp.registry.model.person import (
- Person,
- PersonSettings,
- )
+from lp.registry.model.person import Person
from lp.registry.model.product import Product
from lp.registry.model.teammembership import TeamMembership
from lp.services.config import config
@@ -1438,29 +1435,6 @@
"""
-class PersonSettingsENFPopulator(BulkPruner):
- """Populates PersonSettings.expanded_notification_footers."""
-
- target_table_class = PersonSettings
- ids_to_prune_query = """
- SELECT person
- FROM PersonSettings
- WHERE expanded_notification_footers IS NULL
- """
-
- def __call__(self, chunk_size):
- """See `ITunableLoop`."""
- result = self.store.execute("""
- UPDATE PersonSettings
- SET expanded_notification_footers = FALSE
- WHERE person IN (
- SELECT * FROM
- cursor_fetch('%s', %d) AS f(person integer))
- """ % (self.cursor_name, chunk_size))
- self._num_removed = result.rowcount
- 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.
@@ -1745,7 +1719,6 @@
LoginTokenPruner,
ObsoleteBugAttachmentPruner,
OldTimeLimitedTokenDeleter,
- PersonSettingsENFPopulator,
POTranslationPruner,
PreviewDiffPruner,
ProductVCSPopulator,
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2016-03-02 14:03:42 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2016-04-05 15:55:09 +0000
@@ -16,10 +16,7 @@
import time
from pytz import UTC
-from storm.exceptions import (
- LostObjectError,
- NoneError,
- )
+from storm.exceptions import LostObjectError
from storm.expr import (
In,
Like,
@@ -73,9 +70,7 @@
from lp.registry.interfaces.accesspolicy import IAccessPolicySource
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.teammembership import TeamMembershipStatus
-from lp.registry.model.codeofconduct import SignedCodeOfConduct
from lp.registry.model.commercialsubscription import CommercialSubscription
-from lp.registry.model.person import PersonSettings
from lp.registry.model.teammembership import TeamMembership
from lp.scripts.garbo import (
AntiqueSessionPruner,
@@ -129,10 +124,7 @@
TestCase,
TestCaseWithFactory,
)
-from lp.testing.dbuser import (
- dbuser,
- switch_dbuser,
- )
+from lp.testing.dbuser import switch_dbuser
from lp.testing.layers import (
DatabaseLayer,
LaunchpadScriptLayer,
@@ -1394,49 +1386,6 @@
self._test_LiveFSFilePruner(
'application/octet-stream', 0, expected_count=1)
- def test_PersonSettingsENFPopulator(self):
- switch_dbuser('testadmin')
- store = IMasterStore(PersonSettings)
- people_enf_none = []
- people_enf_false = []
- people_enf_true = []
- for _ in range(2):
- person = self.factory.makePerson()
- try:
- person.expanded_notification_footers = None
- except NoneError:
- # Now enforced by DB NOT NULL constraint; backfilling is no
- # longer necessary.
- return
- people_enf_none.append(person)
- person = self.factory.makePerson()
- person.expanded_notification_footers = False
- people_enf_false.append(person)
- person = self.factory.makePerson()
- person.expanded_notification_footers = True
- people_enf_true.append(person)
- settings_count = store.find(PersonSettings).count()
- self.runDaily()
- switch_dbuser('testadmin')
-
- # No rows have been deleted.
- self.assertEqual(settings_count, store.find(PersonSettings).count())
-
- def _assert_enf_by_person(person, expected):
- record = store.find(
- PersonSettings, PersonSettings.person == person.id).one()
- self.assertEqual(expected, record.expanded_notification_footers)
-
- # Rows with expanded_notification_footers=None have been backfilled.
- for person in people_enf_none:
- _assert_enf_by_person(person, False)
-
- # Other rows have been left alone.
- for person in people_enf_false:
- _assert_enf_by_person(person, False)
- for person in people_enf_true:
- _assert_enf_by_person(person, True)
-
class TestGarboTasks(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
Follow ups