本文整理汇总了Python中job.Job.set方法的典型用法代码示例。如果您正苦于以下问题:Python Job.set方法的具体用法?Python Job.set怎么用?Python Job.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: put
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import set [as 别名]
def put(self):
logging.info('put single job received')
data_string = self.request.body
logging.info(data_string)
decoded = json.loads(data_string)
if decoded.has_key('jobs'):
count_jobs = len(decoded['jobs'])
if count_jobs > 1:
logging.info("more than 1 job, abort")
self.error(204)
return
jobs = []
for job in decoded['jobs']:
temp = Job(key_name=str(job['jobId']), parent=currentIteration)
temp.set(job)
# Lookup Job in DB and see if already running
# if not running overwrite and send 200 else 500
q = Job.all()
q.filter("jobId =", temp.jobId)
result = q.get()
if result is not None:
# if result.vmIp != self.request.remote_addr:
# logging.info('job already running from other vm, abort')
# self.error(500)
# return
if result.finished:
continue #skip job
if result.iteration != temp.iteration:
continue #skip job
temp.vmIp = self.request.remote_addr
jobs.append(temp)
else:
self.error(204)
for job in jobs:
job.put()
logging.info('put job['+str(job.jobId)+'] into datastore')
if job.finished:
memcache.delete(GetAllJobs.cachekey)
logging.info('memcache deleted!!!!')