0
我遇到了一个非常奇怪的问题。我能够正确地向亚马逊Mechanical Turk提交HIT。我有一个cron不断检查是否有任何工作准备好进行审查。然而,当一项工作完成时,我没有收到它,但是HIT被处理掉了(在函数内部完成的工作来检查它)。奇怪的是,这个问题并不总是发生,而是经常发生。rTurk无法从Amazon Mechanical Turk获得结果
这是函数的代码审查点击:
def self.review_hits
hits = RTurk::Hit.all_reviewable
p "HITS"
p hits
puts "REVIEWABLE HITS: " + hits.count.to_s
hits_results = {}
unless hits.empty?
hits.each do |hit|
puts "IN EACH HIT"
p hit
results = []
hit.expire!
# Get results for each HIT assignment
hit.assignments.each do |assignment|
# Check if the assignmment has been submitted. It can be the case where the maximum waiting time
# for the job to finish expired and there remain assignments that are not submitted
if assignment.status == 'Submitted'
p "STATUS 1"
p assignment.status
temp = {}
temp[:worker_id] = assignment.worker_id
temp[:answer] = assignment.answers
p "STATUS 2"
p assignment.status
assignment.approve!
results << temp
end
end
begin
hit.dispose!
rescue
end
hits_results[hit.id] = {}
hits_results[hit.id][:results] = results
end
# Let Rails know that there are new results
AmazonTurkHit.store_results(hits_results)
end
端
所以放 “审查的HITS:” 是0,但HIT设置。有谁知道为什么?