int assimilate_handler( WORKUNIT& wu, std::vector<RESULT>& /*results*/, RESULT& canonical_result) { int retval; char buf[1024]; MapReduceTask* mrt = NULL; // First time initialization (loads jobtracker state). // This information is loaded into memory but we only need the output paths // and wu names. We are not updating the file here. if(jobtracker_file == NULL) { // Open jobtracker state file. jobtracker_file = fopen(jobtracker_file_path, "r+"); if (!jobtracker_file){ sprintf(buf, "Can't jobtracker file (%s).\n", jobtracker_file_path); return write_error(buf); } // Parse jobtracker state file. retval = parse_jobtracker(jobtracker_file, jobs); if(retval) { sprintf(buf, "Error parsing jobtracker file\n"); return write_error(buf); } } retval = boinc_mkdir(config.project_path("sample_results")); if (retval) return retval; if (wu.canonical_resultid) { std::vector<OUTPUT_FILE_INFO> output_files; const char *copy_path; get_output_file_infos(canonical_result, output_files); bool file_copied = false; // Get the task identified by the work unit name. mrt = get_task_by_name(jobs, wu.name); if (mrt == NULL) { sprintf(buf, "Can't find MapRedureTask %s\n", wu.name); return write_error(buf); } // FIXME - if wu.name contains reduce, also copy to bt new. -> put mrt output task = bt new retval = boinc_copy(output_files[0].path.c_str() , mrt->getOutputPath().c_str()); if (!retval) { file_copied = true; } if (!file_copied) { copy_path = config.project_path("sample_results/%s_%s", wu.name, "no_output_files"); FILE* f = fopen(copy_path, "w"); fclose(f); } } else { sprintf(buf, "%s: 0x%x\n", wu.name, wu.error_mask); return write_error(buf); } return 0; }
void drv_reg_handler(char* name, unsigned char int_no) { struct task* tsk=get_task_by_name(name); drivers[int_no]=tsk; }