2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-07-13 12:55:22 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This 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 2.1 of the License, or (at your option) any later version.
|
2004-07-13 12:55:22 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// 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
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-07-13 12:55:22 +00:00
|
|
|
|
|
|
|
// A sample assimilator that only writes a log message.
|
|
|
|
|
|
|
|
#include <cstdio>
|
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
|
|
|
|
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
|
|
|
) {
|
2005-09-26 23:28:48 +00:00
|
|
|
SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::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) {
|
2005-01-03 10:49:38 +00:00
|
|
|
string output_file_name;
|
|
|
|
|
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(
|
2005-09-26 23:28:48 +00:00
|
|
|
SCHED_MSG_LOG::MSG_DEBUG, canonical_result.xml_doc_out,
|
2003-08-12 20:58:24 +00:00
|
|
|
"[%s] canonical result", wu.name
|
|
|
|
);
|
2005-01-03 10:49:38 +00:00
|
|
|
if (!(get_output_file_path(canonical_result, output_file_name))) {
|
2005-09-26 23:28:48 +00:00
|
|
|
scope_messages.printf(
|
|
|
|
"[%s] Output file path %s\n",
|
|
|
|
wu.name, output_file_name.c_str()
|
|
|
|
);
|
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) {
|
2005-09-26 23:28:48 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
|
|
|
|
"[%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) {
|
2005-09-26 23:28:48 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
|
|
|
|
"[%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) {
|
2005-09-26 23:28:48 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
|
|
|
|
"[%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) {
|
2005-09-26 23:28:48 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
|
|
|
|
"[%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
|
|
|
}
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_8f6a5a2d27 = "$Id$";
|