本文整理汇总了Python中lp.services.database.interfaces.IStore.first方法的典型用法代码示例。如果您正苦于以下问题:Python IStore.first方法的具体用法?Python IStore.first怎么用?Python IStore.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lp.services.database.interfaces.IStore
的用法示例。
在下文中一共展示了IStore.first方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iterReady
# 需要导入模块: from lp.services.database.interfaces import IStore [as 别名]
# 或者: from lp.services.database.interfaces.IStore import first [as 别名]
def iterReady(cls):
"""Iterate through all ready PackageCopyJobs.
Even though it's slower, we repeat the query each time in order that
very long queues of mass syncs can be pre-empted by other jobs.
"""
seen = set()
while True:
jobs = IStore(PackageCopyJob).find(
PackageCopyJob,
PackageCopyJob.job_type == cls.class_job_type,
PackageCopyJob.job == Job.id,
Job.id.is_in(Job.ready_jobs),
Not(Job.id.is_in(seen)),
)
jobs.order_by(PackageCopyJob.copy_policy)
job = jobs.first()
if job is None:
break
seen.add(job.job_id)
yield cls(job)