2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2019-01-12 21:43:48 +00:00
|
|
|
// Copyright (C) 2019 University of California
|
2004-07-13 12:55:22 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-07-13 12:55:22 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2004-07-13 12:55:22 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-07-13 12:55:22 +00:00
|
|
|
|
|
|
|
// A sample assimilator that only writes a log message.
|
|
|
|
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
2004-07-13 12:55:22 +00:00
|
|
|
#include <cstdio>
|
2008-02-27 23:26:38 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <string>
|
2003-01-23 08:07:48 +00:00
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2004-04-08 08:15:23 +00:00
|
|
|
#include "sched_msgs.h"
|
2003-06-14 20:25:37 +00:00
|
|
|
#include "sched_util.h"
|
2004-04-08 08:15:23 +00:00
|
|
|
#include "assimilate_handler.h"
|
2005-01-03 10:49:38 +00:00
|
|
|
#include "validate_util.h"
|
2003-01-23 08:07:48 +00:00
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
using std::vector;
|
2005-01-03 10:49:38 +00:00
|
|
|
using std::string;
|
2004-06-30 18:17:21 +00:00
|
|
|
|
2015-11-17 03:28:30 +00:00
|
|
|
int assimilate_handler_init(int, char**) {
|
2015-10-08 10:14:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-13 14:39:04 +00:00
|
|
|
void assimilate_handler_usage() {
|
|
|
|
// describe the project specific arguments here
|
|
|
|
//fprintf(stderr,
|
2015-10-29 08:16:11 +00:00
|
|
|
// " Custom options:\n"
|
2015-10-13 14:39:04 +00:00
|
|
|
// " [--project_option X] a project specific option\n"
|
|
|
|
//);
|
|
|
|
}
|
|
|
|
|
2004-12-20 20:47:25 +00:00
|
|
|
int assimilate_handler(
|
2005-02-16 23:17:43 +00:00
|
|
|
WORKUNIT& wu, vector<RESULT>& /*results*/, RESULT& canonical_result
|
2003-08-12 20:58:24 +00:00
|
|
|
) {
|
2008-02-21 21:00:58 +00:00
|
|
|
SCOPE_MSG_LOG scope_messages(log_messages, MSG_NORMAL);
|
2003-07-02 20:57:59 +00:00
|
|
|
scope_messages.printf("[%s] Assimilating\n", wu.name);
|
2003-01-23 08:07:48 +00:00
|
|
|
if (wu.canonical_resultid) {
|
2012-04-19 08:47:38 +00:00
|
|
|
OUTPUT_FILE_INFO output_file;
|
2005-01-03 10:49:38 +00:00
|
|
|
|
2003-07-02 20:57:59 +00:00
|
|
|
scope_messages.printf("[%s] Found canonical result\n", wu.name);
|
2003-08-12 20:58:24 +00:00
|
|
|
log_messages.printf_multiline(
|
2008-02-21 21:00:58 +00:00
|
|
|
MSG_DEBUG, canonical_result.xml_doc_out,
|
2003-08-12 20:58:24 +00:00
|
|
|
"[%s] canonical result", wu.name
|
|
|
|
);
|
2008-05-29 21:54:18 +00:00
|
|
|
if (!(get_output_file_info(canonical_result, output_file))) {
|
2005-09-26 23:28:48 +00:00
|
|
|
scope_messages.printf(
|
|
|
|
"[%s] Output file path %s\n",
|
2008-05-29 20:11:43 +00:00
|
|
|
wu.name, output_file.path.c_str()
|
2005-09-26 23:28:48 +00:00
|
|
|
);
|
2005-01-03 10:49:38 +00:00
|
|
|
}
|
2003-01-23 08:07:48 +00:00
|
|
|
} else {
|
2003-07-02 20:57:59 +00:00
|
|
|
scope_messages.printf("[%s] No canonical result\n", wu.name);
|
2003-01-23 08:07:48 +00:00
|
|
|
}
|
|
|
|
if (wu.error_mask&WU_ERROR_COULDNT_SEND_RESULT) {
|
2008-02-21 21:00:58 +00:00
|
|
|
log_messages.printf(MSG_CRITICAL,
|
2005-09-26 23:28:48 +00:00
|
|
|
"[%s] Error: couldn't send a result\n", wu.name
|
|
|
|
);
|
2003-01-23 08:07:48 +00:00
|
|
|
}
|
|
|
|
if (wu.error_mask&WU_ERROR_TOO_MANY_ERROR_RESULTS) {
|
2008-02-21 21:00:58 +00:00
|
|
|
log_messages.printf(MSG_CRITICAL,
|
2005-09-26 23:28:48 +00:00
|
|
|
"[%s] Error: too many error results\n", wu.name
|
|
|
|
);
|
2003-01-23 08:07:48 +00:00
|
|
|
}
|
2003-08-15 20:35:44 +00:00
|
|
|
if (wu.error_mask&WU_ERROR_TOO_MANY_TOTAL_RESULTS) {
|
2008-02-21 21:00:58 +00:00
|
|
|
log_messages.printf(MSG_CRITICAL,
|
2005-09-26 23:28:48 +00:00
|
|
|
"[%s] Error: too many total results\n", wu.name
|
|
|
|
);
|
2003-01-23 08:07:48 +00:00
|
|
|
}
|
2003-08-15 20:35:44 +00:00
|
|
|
if (wu.error_mask&WU_ERROR_TOO_MANY_SUCCESS_RESULTS) {
|
2008-02-21 21:00:58 +00:00
|
|
|
log_messages.printf(MSG_CRITICAL,
|
2005-09-26 23:28:48 +00:00
|
|
|
"[%s] Error: too many success results\n", wu.name
|
|
|
|
);
|
2003-08-15 20:35:44 +00:00
|
|
|
}
|
2004-12-20 20:47:25 +00:00
|
|
|
return 0;
|
2003-01-23 08:07:48 +00:00
|
|
|
}
|