def prepare_gkigrid_job_search(jobfile, problems, configs, timeout, memory): num_tasks = len(problems) * len(configs) jobfile_base = splitext(jobfile)[0] driver_params = { "logfile": jobfile_base + ".log", "errfile": jobfile_base + ".err", "driver_timeout": timeout + 30, "num_tasks": num_tasks, } header = open("data/gkigrid-job-header.q").read() % driver_params task_template = open("data/gkigrid-task").read().rstrip("\n") + "\n" jobfile_parts = [header.rstrip("\n") + "\n"] task_num = 1 for problem in problems: for config_name, config in configs: ## TODO: This way of quoting is not perfect and should be fixed, ## but it will work for now. config = " ".join("'%s'" % arg for arg in config) ## TODO: Should we put the automagic parameter selection back in? ## "logistics00": "200000", ## "pipesworld-notankage": "2500", ## "pipesworld-tankage": "1000", ## "psr-small": "200000", ## "satellite": "10000A3", ## "tpp": "50000A3", result_dir = search_dir(problem, config_name) task_params = { "task_num": task_num, "timeout": timeout, "memory_kb": memory * 1024, "result_dir": result_dir, "planner_executable": planner_executable(), "config_name": config_name, "config": config, "preprocessed_input": joinpath(preprocess_dir(problem), "output"), "mutex_file": joinpath(translate_dir(problem), "all.groups"), } task = task_template % task_params jobfile_parts.append(task) task_num += 1 open(jobfile, "w").write("".join(jobfile_parts)) make_executable(jobfile)
def prepare_gkigrid_job_preprocess(jobfile, problems, timeout): num_tasks = len(problems) jobfile_base = splitext(jobfile)[0] driver_params = { "logfile": jobfile_base + ".log", "errfile": jobfile_base + ".err", "driver_timeout": 2 * timeout + 30, "num_tasks": num_tasks, } header_template = open("data/gkigrid-preprocess-job-header.q").read() header = (header_template % driver_params).rstrip("\n") + "\n" task_template = open("data/gkigrid-preprocess-task").read() task_template = task_template.rstrip("\n") + "\n" jobfile_parts = [header] task_num = 1 for problem in problems: trans_result_dir = translate_dir(problem) pre_result_dir = preprocess_dir(problem) task_params = { "task_num": task_num, "pddl_domain": problem.domain_file(), "pddl_problem": problem.problem_file(), "translator_executable": translator_executable(), "translator_timeout": timeout, "translate_dir": translate_dir(problem), "preprocessor_executable": preprocessor_executable(), "preprocessor_timeout": timeout, "preprocess_dir": preprocess_dir(problem), } task = task_template % task_params jobfile_parts.append(task) task_num += 1 open(jobfile, "w").write("".join(jobfile_parts)) make_executable(jobfile)