866
866
return resulting_tuple[0]
868
def preloadBuildsData(self, builds):
870
from lp.soyuz.model.distroarchseries import (
873
from lp.registry.model.distroseries import (
876
from lp.registry.model.distribution import (
879
from lp.soyuz.model.archive import Archive
880
from lp.registry.model.person import Person
881
self._prefetchBuildData(builds)
882
distro_arch_series = load_related(
883
DistroArchSeries, builds, ['distro_arch_series_id'])
884
package_builds = load_related(
885
PackageBuild, builds, ['package_build_id'])
886
archives = load_related(Archive, package_builds, ['archive_id'])
887
load_related(Person, archives, ['ownerID'])
888
distroseries = load_related(
889
DistroSeries, distro_arch_series, ['distroseriesID'])
891
Distribution, distroseries, ['distributionID'])
868
893
def getByBuildFarmJobs(self, build_farm_jobs):
869
894
"""See `ISpecificBuildFarmJobSource`."""
870
895
if len(build_farm_jobs) == 0:
873
898
build_farm_job_ids = [
874
899
build_farm_job.id for build_farm_job in build_farm_jobs]
876
def eager_load(rows):
878
from lp.soyuz.model.distroarchseries import (
881
from lp.registry.model.distroseries import (
884
from lp.registry.model.distribution import (
887
from lp.soyuz.model.archive import Archive
888
from lp.registry.model.person import Person
889
self._prefetchBuildData(rows)
890
distro_arch_series = load_related(
891
DistroArchSeries, rows, ['distro_arch_series_id'])
892
package_builds = load_related(
893
PackageBuild, rows, ['package_build_id'])
894
archives = load_related(Archive, package_builds, ['archive_id'])
895
load_related(Person, archives, ['ownerID'])
896
distroseries = load_related(
897
DistroSeries, distro_arch_series, ['distroseriesID'])
899
Distribution, distroseries, ['distributionID'])
900
901
resultset = Store.of(build_farm_jobs[0]).using(*clause_tables).find(
901
902
BinaryPackageBuild,
902
903
BinaryPackageBuild.package_build == PackageBuild.id,
903
904
PackageBuild.build_farm_job == BuildFarmJob.id,
904
905
BuildFarmJob.id.is_in(build_farm_job_ids))
905
return DecoratedResultSet(resultset, pre_iter_hook=eager_load)
906
return DecoratedResultSet(
907
resultset, pre_iter_hook=self.preloadBuildsData)
907
909
def getPendingBuildsForArchSet(self, archseries):
908
910
"""See `IBinaryPackageBuildSet`."""