def run_task(opt): """ Note: launch_config opt should be something like: parlai.crowdsourcing.tasks.turn_annotations_static.launch_config.LaunchConfig """ launch_config_file = opt.get('launch_config') launch_module = import_module(launch_config_file) launch_config = launch_module.LaunchConfig db, arg_string = setup_mephisto(launch_config) if 'sandbox' not in launch_config.PROVIDER: block_workers(opt, db, launch_config.REQUESTER) build_task() operator = Operator(db) operator.parse_and_launch_run_wrapper(shlex.split(arg_string), extra_args={}) operator.wait_for_runs_then_shutdown()
f'--task-description "\\"{task_description}\\"" ' "--task-reward 0.5 " f"--task-tags {hit_keywords} " f"--maximum-units-per-worker 0 " # Num of units a worker is allowed to do, 0 is infinite f"--allowed-concurrent 1 " # Workers can only do one task at a time, or onboarding may break ) extra_args = { "pairings_filepath": args['pairings_filepath'], "block_on_onboarding_fail": True, "block_qualification": f"acute_eval_{int(time.time())}_block", # num times to use the same conversation pair "annotations_per_pair": args["annotations_per_pair"], "random_seed": 42, # random seed "subtasks_per_unit": args[ "subtasks_per_unit" ], # num comparisons to show within one unit "num_matchup_pairs": args[ "num_matchup_pairs" ], # num pairs of conversations to be compared # question phrasing "s1_choice": "I would prefer to talk to <Speaker 1>", "s2_choice": "I would prefer to talk to <Speaker 2>", "eval_question": "Who would you prefer to talk to for a long conversation?", "assignment_duration_in_seconds": 600, } operator = Operator(db) operator.parse_and_launch_run_wrapper(shlex.split(ARG_STRING), extra_args=extra_args) operator.wait_for_runs_then_shutdown(skip_input=True, log_rate=30)
( architect_type, requester_name, db, _args, ) = MephistoRunScriptParser().parse_launch_arguments() TASK_DIRECTORY = os.path.join(get_root_dir(), "examples/simple_static_task") task_title = "Test static task" task_description = "This is a simple test of static tasks." ARG_STRING = ( f"--blueprint-type {BLUEPRINT_TYPE} " f"--architect-type {architect_type} " f"--requester-name {requester_name} " f'--task-title "\\"{task_title}\\"" ' f'--task-description "\\"{task_description}\\"" ' "--task-reward 0.3 " "--task-tags static,task,testing " f'--data-csv "{TASK_DIRECTORY}/data.csv" ' f'--task-source "{TASK_DIRECTORY}/server_files/demo_task.html" ' f'--preview-source "{TASK_DIRECTORY}/server_files/demo_preview.html" ' f'--extra-source-dir "{TASK_DIRECTORY}/server_files/extra_refs" ' f"--units-per-assignment 2 ") operator = Operator(db) operator.parse_and_launch_run_wrapper(shlex.split(ARG_STRING)) operator.wait_for_runs_then_shutdown(skip_input=True, log_rate=30)