rTurk无法从Amazon Mechanical Turk获得结果

时间:2014-10-20 08:55:04

标签: ruby amazon-web-services amazon mechanicalturk

我遇到了一个非常奇怪的问题。我能够正确地向亚马逊机械土耳其人提交HIT。我有一个cron,一直在检查是否有任何工作准备好进行审查。但是,当一个工作完成后,我没有收到它,但HIT被处理掉了(在功能内部做了什么来审查它)。奇怪的是,这个问题并不总是发生,但经常发生。

这是审查HIT的功能代码:

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

因此看跌期权“REVIEWABLE HITS:”为0但是HIT被处理掉了。有谁知道为什么?

1 个答案:

答案 0 :(得分:0)

经过一段时间变得疯狂之后,我意识到这个问题非常愚蠢......我有两个系统正在运行的实例,一个在生产中,一个在暂存,但都有相同的AWS账户,所以有时HIT被抓住了由另一个系统... :))