a0d27c7bc11dbfb0c5d54de235a45803da2d76bf,parlai/mturk/core/mturk_manager.py,MTurkManager,setup_server,#MTurkManager#Any#,537

Before Change


              "conversations requested, extra HITs will be expired once the "
              "desired conversations {}.".format(HIT_MULT, completion_type))
        key_input = input("Please press Enter to continue... ")
        print_and_log("")

        setup_aws_credentials()

        // See if there"s enough money in the account to fund the HITs requested

After Change


        fin_word = "start"
        if self.opt["count_complete"]:
            fin_word = "finish"
        shared_utils.print_and_log(
            logging.INFO,
            "\nYou are going to allow workers from Amazon Mechanical Turk to "
            "be an agent in ParlAI.\nDuring this process, Internet connection "
            "is required, and you should turn off your computer\"s auto-sleep "
            "feature.\nEnough HITs will be created to fulfill {} times the "
            "number of conversations requested, extra HITs will be expired "
            "once the desired conversations {}.".format(HIT_MULT, fin_word),
            should_print=True
        )
        key_input = input("Please press Enter to continue... ")
        shared_utils.print_and_log(logging.NOTSET, "", True)

        mturk_utils.setup_aws_credentials()

        // See if there"s enough money in the account to fund the HITs requested
        num_assignments = self.required_hits
        payment_opt = {
            "type": "reward",
            "num_total_assignments": num_assignments,
            "reward": self.opt["reward"],  // in dollars
            "unique": self.opt["unique_worker"]
        }
        total_cost = mturk_utils.calculate_mturk_cost(payment_opt=payment_opt)
        if not mturk_utils.check_mturk_balance(
                balance_needed=total_cost,
                is_sandbox=self.opt["is_sandbox"]):
            raise SystemExit("Insufficient funds")

        if total_cost > 100 or self.opt["reward"] > 1:
            confirm_string = "$%.2f" % total_cost
            shared_utils.print_and_log(
                logging.INFO,
                "You are going to create {} HITs at {} per assignment, for a "
                "total cost of {} after MTurk fees. Please enter "{}" to "
                "confirm and continue, and anything else to cancel".format(
                    self.required_hits,
                    "$%.2f" % self.opt["reward"],
                    confirm_string,
                    confirm_string
                ),
                should_print=True
            )
            check = input("Enter here: ")
            if (check != confirm_string):
                raise SystemExit("Cancelling")

        shared_utils.print_and_log(logging.INFO, "Setting up MTurk server...",
                                   should_print=True)
        mturk_utils.create_hit_config(
            task_description=self.opt["task_description"],
            unique_worker=self.opt["unique_worker"],
            is_sandbox=self.opt["is_sandbox"]
        )
        // Poplulate files to copy over to the server
        if not self.task_files_to_copy:
            self.task_files_to_copy = []
        if not task_directory_path:
            task_directory_path = os.path.join(
                self.opt["parlai_home"],
                "parlai",
                "mturk",
                "tasks",
                self.opt["task"]
            )
        self.task_files_to_copy.append(
            os.path.join(task_directory_path, "html", "cover_page.html"))
        for mturk_agent_id in self.mturk_agent_ids + ["onboarding"]:
            self.task_files_to_copy.append(os.path.join(
                task_directory_path,
                "html",
                "{}_index.html".format(mturk_agent_id)
            ))

        // Setup the server with a likely-unique app-name
        task_name = "{}-{}".format(str(uuid.uuid4())[:8], self.opt["task"])
        self.server_task_name = \
            "".join(e for e in task_name if e.isalnum() or e == "-")
        self.server_url = server_utils.setup_server(self.server_task_name,
                                                    self.task_files_to_copy)
        shared_utils.print_and_log(logging.INFO, self.server_url)

        shared_utils.print_and_log(logging.INFO, "MTurk server setup done.\n",
                                   should_print=True)

    def ready_to_accept_workers(self):
        Set up socket to start communicating to workers
        shared_utils.print_and_log(logging.INFO,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: facebookresearch/ParlAI
Commit Name: a0d27c7bc11dbfb0c5d54de235a45803da2d76bf
Time: 2017-09-19
Author: jju@fb.com
File Name: parlai/mturk/core/mturk_manager.py
Class Name: MTurkManager
Method Name: setup_server


Project Name: facebookresearch/ParlAI
Commit Name: a0d27c7bc11dbfb0c5d54de235a45803da2d76bf
Time: 2017-09-19
Author: jju@fb.com
File Name: parlai/mturk/core/mturk_manager.py
Class Name: MTurkManager
Method Name: setup_server


Project Name: facebookresearch/ParlAI
Commit Name: a0d27c7bc11dbfb0c5d54de235a45803da2d76bf
Time: 2017-09-19
Author: jju@fb.com
File Name: parlai/mturk/core/agents.py
Class Name: MTurkAgent
Method Name: _check_hit_status


Project Name: facebookresearch/ParlAI
Commit Name: a0d27c7bc11dbfb0c5d54de235a45803da2d76bf
Time: 2017-09-19
Author: jju@fb.com
File Name: parlai/mturk/core/mturk_manager.py
Class Name: MTurkManager
Method Name: create_hits