226
227
return cls(branch_job)
230
def getByJobs(cls, jobs):
231
"""See `IBuildFarmJob`.
233
Overridden here to search via a BranchJob, rather than a Job.
235
store = IStore(BranchJob)
236
job_ids = [job.id for job in jobs]
237
branch_jobs = store.find(
238
BranchJob, BranchJob.jobID.is_in(job_ids))
239
return [cls(branch_job) for branch_job in branch_jobs]
242
def preloadJobsData(cls, jobs):
244
from lp.code.model.branch import Branch
245
from lp.registry.model.product import Product
246
from lp.code.model.branchcollection import GenericBranchCollection
247
from lp.services.job.model.job import Job
248
contexts = [job.context for job in jobs]
249
load_related(Job, contexts, ['jobID'])
250
branches = load_related(Branch, contexts, ['branchID'])
251
GenericBranchCollection.preloadDataForBranches(branches)
252
load_related(Product, branches, ['productID'])
229
255
def getByBranch(cls, branch):
230
256
"""See `ITranslationTemplatesBuildJobSource`."""
231
257
store = IStore(BranchJob)