Merge lp:~sinzui/launchpad/packaging-timeout-bug-523886 into lp:launchpad

Proposed by Curtis Hovey on 2010-02-18
Status: Merged
Merged at revision: not available
Proposed branch: lp:~sinzui/launchpad/packaging-timeout-bug-523886
Merge into: lp:launchpad
Diff against target: 103 lines (+17/-17)
2 files modified
lib/lp/registry/browser/distroseries.py (+14/-14)
lib/lp/registry/browser/tests/packaging-views.txt (+3/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/packaging-timeout-bug-523886
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code 2010-02-18 Approve on 2010-02-19
Review via email: mp+19660@code.launchpad.net
To post a comment you must log in.
Curtis Hovey (sinzui) wrote :

This is my branch to make +packaging and +needs-packaging faster.

    lp:~sinzui/launchpad/packaging-timeout-bug-523886
    Diff size: 104
    Launchpad bug: https://bugs.launchpad.net/bugs/523886
    Test command: ./bin/test -vv -t packaging-views
    Pre-implementation: bac
    Target release: 10.02

 make +packaging and +needs-packaging faster
--------------------------------------------------------------------

OOPS-1510EB595 and OOPS-1510ED677 show too much data was called. Though the
core objects are cached, there is a lot of repetition in the queries because
the UI is checking the presence of secondary objects.

The first fix it to reduce the batch size because these pages have too much
information to comprehend. If necessary, try to cache the bug and translation
information.

Rules
-----

    * Reduce the batch size of both view to 20, which is more than enough
      work for one person to see.
    * Consider caching the bug supervisor, bug tracker, branch and templates

    ADDENDUM
    * I looked at the queries and in the case of +needs-packaging there
      were no extra db lookups in template, but there were a tremendous
      number of person/team lookups. I created an empty view with an
      empty template so got a large number of person/team lookups
      to render the header a footer. I will report this as a separate bug.
    * I changed the base view for the two affected views because they
      do not use the base features anymore.
    * Cleaned up some issues reported by lint.

QA
--

    * Visit https://launchpad.net/ubuntu/lucid/+needs-packaging
    * Verify 20 packages are listed and that the page does not timeout
    * Visit https://launchpad.net/ubuntu/lucid/+packaging
    * Verify 20 packages are listed and that the page does not timeout

Lint
----

Linting changed files:
  lib/lp/registry/browser/distroseries.py
  lib/lp/registry/browser/tests/packaging-views.txt

Test
----

    * lib/lp/registry/browser/tests/packaging-views.txt
      * Updated the test to verify that the default batch size is 20.

Implementation
--------------

    * lib/lp/registry/browser/distroseries.py
      * Changed the batch size to 20.

Paul Hummer (rockstar) wrote :

Looks good. Thanks for the branch!

Guilherme Salgado (salgado) wrote :

Looks good to me

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/registry/browser/distroseries.py'
2--- lib/lp/registry/browser/distroseries.py 2010-02-03 08:43:42 +0000
3+++ lib/lp/registry/browser/distroseries.py 2010-02-18 21:50:33 +0000
4@@ -55,7 +55,7 @@
5 from canonical.launchpad.webapp.menu import (
6 ApplicationMenu, Link, NavigationMenu, enabled_with_permission)
7 from canonical.launchpad.webapp.publisher import (
8- canonical_url, stepthrough, stepto)
9+ canonical_url, LaunchpadView, stepthrough, stepto)
10 from canonical.widgets.itemswidgets import LaunchpadDropdownWidget
11 from lp.soyuz.interfaces.queue import IPackageUploadSet
12 from lp.registry.browser import MilestoneOverlayMixin
13@@ -133,6 +133,7 @@
14
15 class DistroSeriesBreadcrumb(Breadcrumb):
16 """Builds a breadcrumb for an `IDistroSeries`."""
17+
18 @property
19 def text(self):
20 return self.context.named_version
21@@ -447,15 +448,14 @@
22
23 assert owner is not None
24 distroseries = self.context.newSeries(
25- name = data['name'],
26- displayname = data['displayname'],
27- title = data['title'],
28- summary = data['summary'],
29- description = data['description'],
30- version = data['version'],
31- parent_series = data['parent_series'],
32- owner = owner
33- )
34+ name=data['name'],
35+ displayname=data['displayname'],
36+ title=data['title'],
37+ summary=data['summary'],
38+ description=data['description'],
39+ version=data['version'],
40+ parent_series=data['parent_series'],
41+ owner=owner)
42 notify(ObjectCreatedEvent(distroseries))
43 self.next_url = canonical_url(distroseries)
44 return distroseries
45@@ -465,7 +465,7 @@
46 return canonical_url(self.context)
47
48
49-class DistroSeriesPackagesView(DistroSeriesView):
50+class DistroSeriesPackagesView(LaunchpadView):
51 """A View to show series package to upstream package relationships."""
52
53 label = 'All series packages linked to upstream project series'
54@@ -475,12 +475,12 @@
55 def cached_packagings(self):
56 """The batched upstream packaging links."""
57 packagings = self.context.getPriorizedlPackagings()
58- navigator = BatchNavigator(packagings, self.request, size=100)
59+ navigator = BatchNavigator(packagings, self.request, size=20)
60 navigator.setHeadings('packaging', 'packagings')
61 return navigator
62
63
64-class DistroSeriesNeedsPackagesView(DistroSeriesView):
65+class DistroSeriesNeedsPackagesView(LaunchpadView):
66 """A View to show series package to upstream package relationships."""
67
68 label = 'Packages that need upstream packaging links'
69@@ -490,6 +490,6 @@
70 def cached_unlinked_packages(self):
71 """The batched `ISourcePackage`s that needs packaging links."""
72 packages = self.context.getPriorizedUnlinkedSourcePackages()
73- navigator = BatchNavigator(packages, self.request, size=100)
74+ navigator = BatchNavigator(packages, self.request, size=20)
75 navigator.setHeadings('package', 'packages')
76 return navigator
77
78=== modified file 'lib/lp/registry/browser/tests/packaging-views.txt'
79--- lib/lp/registry/browser/tests/packaging-views.txt 2010-02-03 08:43:42 +0000
80+++ lib/lp/registry/browser/tests/packaging-views.txt 2010-02-18 21:50:33 +0000
81@@ -359,11 +359,11 @@
82 The packages that most need more information to send bugs upstream, build
83 packages, and sync translations are listed first. A distro series can have
84 thousands of upstream packaging links. The view provides a batch navigator
85-to access the packagings. The default batch size is 100.
86+to access the packagings. The default batch size is 20.
87
88 >>> batch_navigator = view.cached_packagings
89 >>> batch_navigator.default_size
90- 100
91+ 20
92
93 >>> print batch_navigator.heading
94 packagings
95@@ -392,7 +392,7 @@
96
97 >>> batch_navigator = view.cached_unlinked_packages
98 >>> batch_navigator.default_size
99- 100
100+ 20
101
102 >>> print batch_navigator.heading
103 packages