~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/browser/builder.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-06 12:11:50 UTC
  • mfrom: (14625.2.7 gina-dsc-binaries)
  • Revision ID: launchpad@pqm.canonical.com-20120106121150-e0bucmb5qeyytnn9
[r=wgrant][bug=911943] Fix SourcePackageReleaseDscBinariesUpdater:
        round chunk_size to int (and document this issue).

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from zope.lifecycleevent import ObjectCreatedEvent
31
31
 
32
32
from lp import _
 
33
from lp.app.browser.launchpadform import (
 
34
    action,
 
35
    custom_widget,
 
36
    LaunchpadEditFormView,
 
37
    LaunchpadFormView,
 
38
    )
 
39
from lp.app.widgets.owner import HiddenUserWidget
 
40
from lp.buildmaster.interfaces.builder import (
 
41
    IBuilder,
 
42
    IBuilderSet,
 
43
    )
 
44
from lp.buildmaster.model.buildqueue import BuildQueue
 
45
from lp.services.database.decoratedresultset import DecoratedResultSet
 
46
from lp.services.database.lpstorm import IStore
 
47
from lp.services.propertycache import cachedproperty
33
48
from lp.services.webapp import (
34
49
    ApplicationMenu,
35
50
    canonical_url,
42
57
    stepthrough,
43
58
    )
44
59
from lp.services.webapp.breadcrumb import Breadcrumb
45
 
from lp.app.browser.launchpadform import (
46
 
    action,
47
 
    custom_widget,
48
 
    LaunchpadEditFormView,
49
 
    LaunchpadFormView,
50
 
    )
51
 
from lp.app.widgets.owner import HiddenUserWidget
52
 
from lp.buildmaster.interfaces.builder import (
53
 
    IBuilder,
54
 
    IBuilderSet,
55
 
    )
56
 
from lp.services.propertycache import cachedproperty
57
60
from lp.soyuz.browser.build import (
58
61
    BuildNavigationMixin,
59
62
    BuildRecordsView,
144
147
    @cachedproperty
145
148
    def builders(self):
146
149
        """All active builders"""
147
 
        return list(self.context.getBuilders())
 
150
        def do_eager_load(builders):
 
151
            # Prefetch the jobs' data.
 
152
            queues = IStore(BuildQueue).find(
 
153
                BuildQueue,
 
154
                BuildQueue.builderID.is_in(
 
155
                    builder.id for builder in builders))
 
156
            BuildQueue.preloadSpecificJobData(queues)
 
157
 
 
158
        return list(DecoratedResultSet(
 
159
            list(self.context.getBuilders()), pre_iter_hook=do_eager_load))
148
160
 
149
161
    @property
150
162
    def number_of_registered_builders(self):