本文整理汇总了Python中Job.Job.getReturnData方法的典型用法代码示例。如果您正苦于以下问题:Python Job.getReturnData方法的具体用法?Python Job.getReturnData怎么用?Python Job.getReturnData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job.Job
的用法示例。
在下文中一共展示了Job.getReturnData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Job import Job [as 别名]
# 或者: from Job.Job import getReturnData [as 别名]
def main(self):
print "ResultFetcher starting up"
while True:
t = time.time()
data = self.r_server.zrangebyscore("Running_Queue", 0, t)
for d in data:
self.runParamDict = pickle.loads(d)
if self.runParamDict['ClassType'] == 'Local':
j = Job(configDict=self.runParamDict)
jobStr = 'local job'
else:
j = RemoteJob(configDict=self.runParamDict)
jobStr = 'remote job'
print "Polling %s for '%s'" % (jobStr, self.runParamDict['Filename'])
retCode = j.isFinished()
if retCode > 0:
if retCode == 1: # case: no except
print "Job complete for '%s'" % self.runParamDict['Filename']
try:
j.getReturnData()
except AttributeError: # pass if j without getReturnData() e.g. local
pass
else:
print "Exception for '%s'!!!" % self.runParamDict['Filename']
self.r_server.rpush("Result_Queue", pickle.dumps(self.runParamDict))
else:
pollTime = time.time() + self.runParamDict['PollPeriod'] * 60
self.r_server.zadd("Running_Queue", pickle.dumps(self.runParamDict), pollTime)
self.runParamDict = None
self.r_server.zremrangebyscore("Running_Queue", 0, t)
time.sleep(60) # hard wait (since no blocking method on ordered sets)