Example #1
0
    def __init__(self,
                 params,
                 schema,
                 scenario_db,
                 systems,
                 sessions,
                 controller_map,
                 num_chats_per_scenario,
                 messages=Messages,
                 active_system=None,
                 active_scenario=None):
        self.config = params
        self.conn = sqlite3.connect(params["db"]["location"])

        # enable data retrieval as dict (not as plain tuple)
        self.conn.row_factory = sqlite3.Row

        self.do_survey = True if "end_survey" in params.keys(
        ) and params["end_survey"] == 1 else False
        self.scenario_db = scenario_db
        # TODO: hack for seller/buyer
        self.scenario_int_id = {
            s.uuid: i
            for i, s in enumerate(scenario_db.scenarios_list)
        }
        self.schema = schema
        self.systems = systems
        # Preselected partner type and scenario from URL
        self.active_system = active_system
        self.active_scenario = active_scenario
        self.sessions = sessions
        self.controller_map = controller_map
        self.num_chats_per_scenario = num_chats_per_scenario
        self.logger = WebLogger.get_logger()
        self.messages = messages
Example #2
0
    parser = argparse.ArgumentParser()
    parser.add_argument('--num-scenarios', type=int)
    add_website_arguments(parser)
    add_scenario_arguments(parser)
    add_system_arguments(parser)
    args = parser.parse_args()

    params_file = args.config
    with open(params_file) as fin:
        params = json.load(fin)

    db, log_file, error_log_file, transcripts_dir = init(
        args.output, args.reuse)
    error_log_file = open(error_log_file, 'w')

    WebLogger.initialize(log_file)
    params['db'] = {}
    params['db']['location'] = db.db_file
    params['logging'] = {}
    params['logging']['app_log'] = log_file
    params['logging']['chat_dir'] = transcripts_dir

    if 'task_title' not in params.keys():
        raise ValueError(
            "Title of task should be specified in config file with the key 'task_title'"
        )

    instructions = None
    if 'instructions' in params.keys():
        instructions_file = open(params['instructions'], 'r')
        instructions = "".join(instructions_file.readlines())
Example #3
0
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--num-scenarios', type=int)
    add_website_arguments(parser)
    add_scenario_arguments(parser)
    add_system_arguments(parser)
    args = parser.parse_args()

    params_file = args.config
    with open(params_file) as fin:
        params = json.load(fin)

    db, log_file, error_log_file, transcripts_dir = init(args.output, args.reuse)
    error_log_file = open(error_log_file, 'w')

    WebLogger.initialize(log_file)
    params['db'] = {}
    params['db']['location'] = db.db_file
    params['logging'] = {}
    params['logging']['app_log'] = log_file
    params['logging']['chat_dir'] = transcripts_dir

    if 'task_title' not in params.keys():
        raise ValueError("Title of task should be specified in config file with the key 'task_title'")

    instructions = None
    if 'instructions' in params.keys():
        instructions_file = open(params['instructions'], 'r')
        instructions = "".join(instructions_file.readlines())
        instructions_file.close()
    else: