本文整理汇总了Python中models.Job.get_running_jobs方法的典型用法代码示例。如果您正苦于以下问题:Python Job.get_running_jobs方法的具体用法?Python Job.get_running_jobs怎么用?Python Job.get_running_jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.get_running_jobs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: running_jobs
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import get_running_jobs [as 别名]
def running_jobs(request):
if request.user.is_authenticated():
# hack to get numbers to update
get_all_jobs(request.user.credentials.all())
temp = len(Job.get_running_jobs(user=request.user))
return {"running_jobs": temp}
else:
return {"running_jobs": None}
示例2: get_all_jobs
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import get_running_jobs [as 别名]
def get_all_jobs(credentials):
updates = [Job.get_oldest_update_time(credential=x) for x in credentials]
# TUNABLE: change time constraint
if any((timezone.now() - x).seconds > 60 for x in updates):
jobs = get_jobs(credentials)
else:
jobs = []
for cred in credentials:
objs = Job.get_running_jobs(credential=cred)
jobs.append({
"name": cred.cluster.name,
"columns": WANTED_COLS,
"jobs": [x.format() for x in objs],
})
return jobs