本文整理汇总了Python中job.Job.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Job.execute方法的具体用法?Python Job.execute怎么用?Python Job.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import execute [as 别名]
def search(query):
job = Job(query) #use name prep from job init
result = cache.get(job.hashtag)
if not result:
result = json.dumps(job.execute())
cache.add(job.hashtag, result)
return result
示例2: execute_job
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import execute [as 别名]
def execute_job(jobfile):
j = Job(None)
j.loadyaml(jobfile)
if j.jobtype == "unittest":
print "--------------------------------------------------"
print "started test:\t" + j.name
ret_status = j.execute()
return j,ret_status
else:
return j, []
示例3: evaluate
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import execute [as 别名]
def evaluate():
matrix = numpy.array(list(csv.reader(open("eval.csv","rb"),delimiter=','))).astype('string')
retrieved = []
for i in range(1,len(matrix)):
hashtag = matrix[i][1]
logger.info(hashtag)
logger.info("expected urls: %s %s %s" % (matrix[i][3], matrix[i][4], matrix[i][5]))
job = Job(hashtag)
urls = job.execute()
url1Retrieved = 0
url2Retrieved = 0
url3Retrieved = 0
for url in urls:
#print url
if (url == matrix[i][3] ):
url1Retrieved = 1
if (url == matrix[i][4] ):
url2Retrieved = 1
if (url == matrix[i][5] ):
url3Retrieved = 1
if (matrix[i][5] == ''):
length = 2
else:
length = 3
recall = float(url1Retrieved+url2Retrieved+url3Retrieved)/length
# if url1Retrieved+url2Retrieved+url3Retrieved > 0:
# recall = 1
# else:
# recall = 0
logger.info("Recall of %s: %f" % (hashtag, recall))
retrieved.append(recall)
print retrieved