~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/buildpackagejob.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-01 12:03:28 UTC
  • mfrom: (14612.3.1 feeds-stories)
  • Revision ID: launchpad@pqm.canonical.com-20120101120328-4nypd4mqnjzk62a7
[r=wgrant][no-qa] Move feeds stories from lp.services.session to
        lp.services.feeds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
__metaclass__ = type
22
22
from lp.buildmaster.interfaces.builder import IBuilderSet
23
23
from lp.buildmaster.model.buildfarmjob import BuildFarmJobOldDerived
24
24
from lp.registry.interfaces.pocket import PackagePublishingPocket
25
 
from lp.services.database.bulk import load_related
26
 
from lp.services.database.lpstorm import IStore
27
25
from lp.services.database.sqlbase import sqlvalues
28
26
from lp.soyuz.enums import (
29
27
    ArchivePurpose,
64
62
        We override this to provide a delegate specific to package builds."""
65
63
        self.build_farm_job = BuildFarmBuildJob(self.build)
66
64
 
67
 
    @staticmethod
68
 
    def preloadBuildFarmJobs(jobs):
69
 
        from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
70
 
        return list(IStore(BinaryPackageBuild).find(
71
 
            BinaryPackageBuild,
72
 
            [BuildPackageJob.id.is_in([job.id for job in jobs]),
73
 
             BuildPackageJob.build_id == BinaryPackageBuild.id]))
74
 
 
75
65
    def score(self):
76
66
        """See `IBuildPackageJob`."""
77
67
        # Define a table we'll use to calculate the score based on the time
166
156
        """See `IBuildFarmJob`."""
167
157
        return self.build.is_virtualized
168
158
 
169
 
    @classmethod
170
 
    def preloadJobsData(cls, jobs):
171
 
        from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
172
 
        from lp.services.job.model.job import Job
173
 
        load_related(Job, jobs, ['job_id'])
174
 
        builds = load_related(BinaryPackageBuild, jobs, ['build_id'])
175
 
        getUtility(IBinaryPackageBuildSet).preloadBuildsData(list(builds))
176
 
 
177
159
    @staticmethod
178
160
    def addCandidateSelectionCriteria(processor, virtualized):
179
161
        """See `IBuildFarmJob`."""