本文整理汇总了Python中job.Job.list方法的典型用法代码示例。如果您正苦于以下问题:Python Job.list方法的具体用法?Python Job.list怎么用?Python Job.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.list方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_job_list
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def get_job_list(self, request):
try:
options = request[0]
except (TypeError, IndexError):
options = {}
jobs_list = Job.list(self.collection,
status=options['statuses'],
type=options['job_type'])
total_jobs = jobs_list.count()
if options.get('limit'):
limit = int(options['limit'])
offset = int(options.get('offset', 0))
jobs_list = jobs_list[offset:offset + limit]
res = []
for j in jobs_list:
try:
res.append(JobFactory.make_job(j).human_dump())
except Exception:
job_id = j.get('id', '[unknown id]')
logger.exception('Failed to dump job {}'.format(job_id))
continue
return {'jobs': res,
'total': total_jobs}
示例2: _get_job
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def _get_job(self, job_id):
jobs_list = Job.list(self.collection,
id=job_id).limit(1)
if not jobs_list:
raise ValueError('Job {0} is not found'.format(job_id))
job = JobFactory.make_job(jobs_list[0])
job.collection = self.collection
return job
示例3: jobs
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def jobs(self, types=None, statuses=None, ids=None):
jobs = [JobFactory.make_job(j) for j in Job.list(self.collection,
status=statuses,
type=types,
id=ids)]
for j in jobs:
j.collection = self.collection
j._dirty = False
return jobs
示例4: get_job_list
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def get_job_list(self, request):
try:
options = request[0]
except (TypeError, IndexError):
options = {}
jobs_list = Job.list(self.collection,
status=options['statuses'],
type=options['job_type'])
total_jobs = jobs_list.count()
if options.get('limit'):
limit = int(options['limit'])
offset = int(options.get('offset', 0))
jobs_list = jobs_list[offset:offset + limit]
res = [JobFactory.make_job(j).human_dump() for j in jobs_list]
return {'jobs': res,
'total': total_jobs}
示例5: jobs_count
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def jobs_count(self, types=None, statuses=None):
return Job.list(self.collection,
status=statuses,
type=types).count()
示例6: job_list
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import list [as 别名]
def job_list():
status = request.args.get("status")
resolvedStatus = status.upper() if status and status.upper() != "ALL" else None
return success({"data": [x.json() for x in Job.list(db.session, status)]})