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設置。有誰知道爲什麼?