std::string prepare_output_directory (std::string const& problem_name) { std::string path = "./results/"; mkdir(path.c_str(), 0700); path += problem_name + "/"; mkdir(path.c_str(), 0700); path += jobid() + "/"; mkdir(path.c_str(), 0700); return path; }
int remove_job_from_exiting_list( job **pjob) { std::string jobid((*pjob)->ji_qs.ji_jobid); unlock_ji_mutex(*pjob,__func__, NULL, LOGLEVEL); int rc = remove_from_exiting_list_by_jobid(jobid.c_str()); *pjob = svr_find_job((char *)jobid.c_str(),FALSE); return rc; } /* END remove_job_from_exiting_list() */
END_TEST START_TEST(process_job_attribute_information_test) { std::string attr_str("(cput=100,vmem=100101,mem=100020)"); std::string jobid("2.napali"); str_to_attr_count = 0; process_job_attribute_information(jobid, attr_str); fail_unless(str_to_attr_count == 3); fail_unless(decode_resc_count == 3); }
END_TEST START_TEST(test_determine_job_file_name) { std::string jobid("1.napali"); std::string filename; path_jobs = strdup("./"); system("rm ./1.napali.JB ./1.napalj.JB"); fail_unless(determine_job_file_name(NULL, jobid, filename) == PBSE_NONE); fail_unless(filename == "1.napali", filename.c_str()); fail_unless(determine_job_file_name(NULL, jobid, filename) == PBSE_NONE); fail_unless(filename == "1.napalj", filename.c_str()); system("rm ./1.napali.JB ./1.napalj.JB"); }
std::string format_log_message(std::string const& function_name, Context const& context) { std::string result(function_name); result += " failed for "; edg_wlc_JobId c_jobid; int e = edg_wll_GetLoggingJob(context.c_context(), &c_jobid); assert(e == 0); wmsutils::jobid::JobId jobid(c_jobid); edg_wlc_JobIdFree(c_jobid); result += jobid.toString() + " (" + get_lb_message(context) + ')'; return result; }