parlai/mturk/tasks/dumb_chat/run.py
def main():
    """
    This task consists of one local dumb chat agent and one MTurk agents,
    each MTurk agent will go through the onboarding step to provide
    information about themselves, before being put into a conversation.
    You can end the conversation by sending a message ending with
    `[DONE]` from human_1.
    """
    argparser = ParlaiParser(False, False)
    argparser.add_parlai_data_path()
    argparser.add_mturk_args()
    opt = argparser.parse_args()
    opt['task'] = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
    opt.update(task_config)

    mturk_agent_1_id = 'mturk_agent_1'

    human_agent_1_id = 'human_1'
    mturk_agent_ids = [mturk_agent_1_id]
    mturk_manager = MTurkManager(
        opt=opt,
        mturk_agent_ids=mturk_agent_ids
    )
    mturk_manager.setup_server()

    try:
        mturk_manager.start_new_run()
        mturk_manager.create_hits()

        def run_onboard(worker):
            world = MTurkMultiAgentDialogOnboardWorld(
                opt=opt,
                mturk_agent=worker
            )
            while not world.episode_done():
                world.parley()
            world.shutdown()

        # You can set onboard_function to None to skip onboarding
        mturk_manager.set_onboard_function(onboard_function=run_onboard)
        mturk_manager.ready_to_accept_workers()

        def check_worker_eligibility(worker):
            return True

        def assign_worker_roles(workers):
            for index, worker in enumerate(workers):
                worker.id = mturk_agent_ids[index % len(mturk_agent_ids)]

        def run_conversation(mturk_manager, opt, workers):
            # Create mturk agents
            mturk_agent_1 = workers[0]

            # Create the local human agents
            human_agent_1 = DumbChatAgent(opt=None)
            human_agent_1.id = human_agent_1_id

            world = MTurkMultiAgentDialogWorld(
                opt=opt,
                agents=[human_agent_1, mturk_agent_1]
            )

            while not world.episode_done():
                world.parley()

            world.shutdown()

        mturk_manager.start_task(
            eligibility_function=check_worker_eligibility,
            assign_role_function=assign_worker_roles,
            task_function=run_conversation
        )

    except BaseException:
        raise
    finally:
        mturk_manager.expire_all_unassigned_hits()
        mturk_manager.shutdown()

    This task consists of one local dumb chat agent and one MTurk agents,
    each MTurk agent will go through the onboarding step to provide
    information about themselves, before being put into a conversation.
    You can end the conversation by sending a message ending with
    `[DONE]` from human_1.
    
This task consists of one local dumb chat agent and one MTurk agents,
each MTurk agent will go through the onboarding step to provide
information about themselves, before being put into a conversation.
You can end the conversation by sending a message ending with
`[DONE]` from human_1.
This task consists of one local dumb chat agent and one MTurk agents each MTurk agent will go through the onboarding step to provide information about themselves before being put into a conversation . You can end the conversation by sending a message ending with ` [ DONE ] ` from human_1 .
def main():
    argparser = ParlaiParser(False, False)
    argparser.add_parlai_data_path()
    argparser.add_mturk_args()
    opt = argparser.parse_args()
    opt['task'] = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
    opt.update(task_config)
    mturk_agent_1_id = 'mturk_agent_1'
    human_agent_1_id = 'human_1'
    mturk_agent_ids = [mturk_agent_1_id]
    mturk_manager = MTurkManager(
        opt=opt,
        mturk_agent_ids=mturk_agent_ids
    )
    mturk_manager.setup_server()
    try:
        mturk_manager.start_new_run()
        mturk_manager.create_hits()
        def run_onboard(worker):
            world = MTurkMultiAgentDialogOnboardWorld(
                opt=opt,
                mturk_agent=worker
            )
            while not world.episode_done():
                world.parley()
            world.shutdown()
        mturk_manager.set_onboard_function(onboard_function=run_onboard)
        mturk_manager.ready_to_accept_workers()
        def check_worker_eligibility(worker):
            return True
        def assign_worker_roles(workers):
            for index, worker in enumerate(workers):
                worker.id = mturk_agent_ids[index % len(mturk_agent_ids)]
        def run_conversation(mturk_manager, opt, workers):
            mturk_agent_1 = workers[0]
            human_agent_1 = DumbChatAgent(opt=None)
            human_agent_1.id = human_agent_1_id
            world = MTurkMultiAgentDialogWorld(
                opt=opt,
                agents=[human_agent_1, mturk_agent_1]
            )
            while not world.episode_done():
                world.parley()
            world.shutdown()
        mturk_manager.start_task(
            eligibility_function=check_worker_eligibility,
            assign_role_function=assign_worker_roles,
            task_function=run_conversation
        )
    except BaseException:
        raise
    finally:
        mturk_manager.expire_all_unassigned_hits()
        mturk_manager.shutdown()
def main ( ) : argparser = ParlaiParser ( False , False ) argparser . add_parlai_data_path ( ) argparser . add_mturk_args ( ) opt = argparser . parse_args ( ) opt [ 'task' ] = os . path . basename ( os . path . dirname ( os . path . abspath ( __file__ ) ) ) opt . update ( task_config ) mturk_agent_1_id = 'mturk_agent_1' human_agent_1_id = 'human_1' mturk_agent_ids = [ mturk_agent_1_id ] mturk_manager = MTurkManager ( opt = opt , mturk_agent_ids = mturk_agent_ids ) mturk_manager . setup_server ( ) try : mturk_manager . start_new_run ( ) mturk_manager . create_hits ( ) def run_onboard ( worker ) : world = MTurkMultiAgentDialogOnboardWorld ( opt = opt , mturk_agent = worker ) while not world . episode_done ( ) : world . parley ( ) world . shutdown ( ) mturk_manager . set_onboard_function ( onboard_function = run_onboard ) mturk_manager . ready_to_accept_workers ( ) def check_worker_eligibility ( worker ) : return True def assign_worker_roles ( workers ) : for index , worker in enumerate ( workers ) : worker . id = mturk_agent_ids [ index % len ( mturk_agent_ids ) ] def run_conversation ( mturk_manager , opt , workers ) : mturk_agent_1 = workers [ 0 ] human_agent_1 = DumbChatAgent ( opt = None ) human_agent_1 . id = human_agent_1_id world = MTurkMultiAgentDialogWorld ( opt = opt , agents = [ human_agent_1 , mturk_agent_1 ] ) while not world . episode_done ( ) : world . parley ( ) world . shutdown ( ) mturk_manager . start_task ( eligibility_function = check_worker_eligibility , assign_role_function = assign_worker_roles , task_function = run_conversation ) except BaseException : raise finally : mturk_manager . expire_all_unassigned_hits ( ) mturk_manager . shutdown ( )
This task consists of one local dumb chat agent and one MTurk agents,
each MTurk agent will go through the onboarding step to provide
information about themselves, before being put into a conversation.
This task consists of one local dumb chat agent and one MTurk agents each MTurk agent will go through the onboarding step to provide information about themselves before being put into a conversation .
"""
    This task consists of one local dumb chat agent and one MTurk agents,
    each MTurk agent will go through the onboarding step to provide
    information about themselves, before being put into a conversation.
    You can end the conversation by sending a message ending with
    `[DONE]` from human_1.
    """ # You can set onboard_function to None to skip onboarding # Create mturk agents # Create the local human agents