【问题标题】:Is there any way or workaround to schedule Amazon Mechanical Turk HITs?是否有任何方法或解决方法来安排 Amazon Mechanical Turk HIT?
【发布时间】:2019-01-30 12:20:45
【问题描述】:

我需要一个特定的 HIT 来在每个星期五早上运行。有什么方法可以做到这一点或使用外部平台(IFTTT,zapier 都不起作用)来做到这一点?在我看来,这是一个非常基本的功能。

【问题讨论】:

    标签: amazon mechanicalturk


    【解决方案1】:

    FWIW,我想出了如何将 Zapier 与 MTurk 一起使用。如果您使用付费计划,则可以利用 AWS Lambda 应用程序触发一些代码,这些代码将在 MTurk 上创建 HIT。为此,您需要一个与您的 MTurk 账户关联的 AWS 账户。完成后,您可以创建一个 Lambda 函数,其中包含以下用于在 MTurk 上创建 HIT 的代码:

    import json
    import boto3
    
    def lambda_handler(event, context):
        print(event)
    
        ###################################
        # Step 1: Create a client
        ###################################
        endpoint = "https://mturk-requester.us-east-1.amazonaws.com"
        mturk = boto3.client(
        service_name='mturk',
        region_name='us-east-1',
        endpoint_url=endpoint)
    
        ###################################
        # Step 2: Define the task
        ###################################
        html = '''
            <**********************************
            My task HTML
            ***********************************>
        '''.format(event['<my parameter>'])
    
        question_xml = '''
        <HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
        <HTMLContent><![CDATA[{}]]></HTMLContent>
        <FrameHeight>0</FrameHeight>
        </HTMLQuestion>'''.format(html)
    
        task_attributes = {
        'MaxAssignments': 3,
        'LifetimeInSeconds': 60 * 60 * 5, # Stay active for 5 hours
        'AssignmentDurationInSeconds': 60 * 10, # Workers have 10 minutes to respond
        'Reward': '0.03',
        'Title': '<Task title>',
        'Keywords': '<keywords>',
        'Description': '<Task description>'
        }
    
        ###################################
        # Step 3: Create the HIT
        ###################################
        response = mturk.create_hit(
        **task_attributes,
        Question=question_xml
        )
        hit_type_id = response['HIT']['HITTypeId']
        print('Created HIT {} in HITType {}'.format(response['HIT']['HITId'], hit_type_id))
    

    请注意,您需要为您的 Lambda 使用的角色授予对 MTurk 的访问权限。从那里您可以创建一个 IAM 用户供 Zapier 在调用您的 Lambda 时使用,并将其链接到您的 Zapier 账户。现在您可以设置您的操作,以使用您想在事件中传递的任何参数调用该 Lambda 函数。

    如果您想将 HIT 的结果返回到您的 Zap 中,这将更加复杂,因为 Zapier 不太适合 MTurk HIT 的异步特性。我在下面整理了一篇关于如何执行此操作的博客文章: https://www.daveschultzconsulting.com/2019/07/18/using-mturk-with-zapier/

    【讨论】:

    【解决方案2】:

    MTurk API 中没有内置功能来完成 HIT 的预定启动。必须通过自定义编程来完成。

    如果您正在寻找交钥匙解决方案,可以通过TurkPrime 使用选项卡 5(设置命中和付款)中的计划启动时间来完成计划

    【讨论】:

    • 非常感谢!这更接近我的需要,但似乎 TurkPrime 不提供定期时间表。我希望它每周发生一次,但只设置一次:)
    • @janjackson 您可以使用他们的意见箱 (feedback.turkprime.com/feature-requests) 提出要求
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多