本文整理汇总了Python中Job.Job.arch方法的典型用法代码示例。如果您正苦于以下问题:Python Job.arch方法的具体用法?Python Job.arch怎么用?Python Job.arch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job.Job
的用法示例。
在下文中一共展示了Job.arch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_job
# 需要导入模块: from Job import Job [as 别名]
# 或者: from Job.Job import arch [as 别名]
def add_job(self, name, version, priority, dist, mailto=None, arch=None):
"""Add a job"""
if not arch:
arch = self.cfg.arch[0]
if not Dists().get_dist(dist, arch):
RebuilddLog.error("Couldn't find dist/arch in the config file for %s_%s on %s/%s, don't adding it" \
% (name, version, dist, arch))
return False
pkgs = Package.selectBy(name=name, version=version)
if pkgs.count():
# If several packages exists, just take the first
pkg = pkgs[0]
else:
# Maybe we found no packages, so create a brand new one!
pkg = Package(name=name, version=version, priority=priority)
jobs_count = Job.selectBy(package=pkg, dist=dist, arch=arch, mailto=mailto, status=JobStatus.WAIT).count()
if jobs_count:
RebuilddLog.error("Job already existing for %s_%s on %s/%s, don't adding it" \
% (pkg.name, pkg.version, dist, arch))
return False
job = Job(package=pkg, dist=dist, arch=arch)
job.status = JobStatus.WAIT
job.arch = arch
job.mailto = mailto
log = Log(job=job)
RebuilddLog.info("Added job for %s_%s on %s/%s for %s" \
% (name, version, dist, arch, mailto))
return True