Amazon MTurk:无法删除状态为“可审查”的HIT

时间:2019-11-25 23:21:07

标签: amazon-web-services boto3 mechanicalturk

我正在使用here提供的脚本从Amazon Mechanical Turk平台删除已部署的HIT。但是,mturk客户端出现以下异常:

An error occurred (RequestError) when calling the DeleteHIT operation: This HIT is currently in the state 'Reviewable'.  This operation can be called with a status of: Reviewing, Reviewable (1574723552282 s)

对我来说,错误消息本身似乎是错误的。有人对此行为有解释吗?

1 个答案:

答案 0 :(得分:0)

尝试类似的方法,我在某个地方找到了它,它可以解决您的问题,

# if hit is reviewable and has assignments, approve assignments
        if status == 'Reviewable':
            assignments = mturk.list_assignments_for_hit(HITId=hit['HITId'], AssignmentStatuses=['Submitted'])
            if assignments['NumResults'] > 0:
                for assign in assignments['Assignments']:
                    mturk.approve_assignment(AssignmentId=assign['AssignmentId'])

        try:
            mturk.delete_hit(HITId=hit['HITId'])
        except:
            print('Not deleted')