~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=allenap][no-qa] Add
 PlainPackageCopyJob.getIncompleteJobsForArchive() method which will return
 all the WAITING, RUNNING or FAILED copy jobs for the passed archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
361
361
            result.setdefault(job.package_name, job)
362
362
        return result
363
363
 
 
364
    @classmethod
 
365
    def getIncompleteJobsForArchive(cls, archive):
 
366
        """See `IPlainPackageCopyJobSource`."""
 
367
        jobs = IStore(PackageCopyJob).find(
 
368
            PackageCopyJob,
 
369
            PackageCopyJob.target_archive == archive,
 
370
            PackageCopyJob.job_type == cls.class_job_type,
 
371
            Job.id == PackageCopyJob.job_id,
 
372
            Job._status.is_in(
 
373
                [JobStatus.WAITING, JobStatus.RUNNING, JobStatus.FAILED])
 
374
            )
 
375
        return DecoratedResultSet(jobs, cls)
 
376
 
364
377
    @property
365
378
    def target_pocket(self):
366
379
        return PackagePublishingPocket.items[self.metadata['target_pocket']]