mirror of https://github.com/BOINC/boinc.git
parent
f785f28fdd
commit
c276b739f2
|
@ -5178,7 +5178,7 @@ David July 1 2003
|
|||
db_form.php
|
||||
index.php
|
||||
|
||||
Karl 2003/07/01
|
||||
Karl 2003/07/01-02
|
||||
- redesigned logging facilities for both scheduler servers and client
|
||||
It is now easy to see the flow of events from looking at client.out
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -101,9 +101,9 @@ int PROJECT::write_account_file() {
|
|||
// parse project fields from account_*.xml
|
||||
//
|
||||
int PROJECT::parse_account(FILE* in) {
|
||||
char buf[256], venue[256];
|
||||
char buf[256];//, venue[256];
|
||||
int retval;
|
||||
bool in_venue = false, in_correct_venue;
|
||||
// bool in_venue = false, in_correct_venue;
|
||||
|
||||
// Assume master_url_fetch_pending, sched_rpc_pending are
|
||||
// true until we read client_state.xml
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
@ -24,6 +24,36 @@
|
|||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Messages is a base class for writing messages not intended for the end
|
||||
// user. This includes all server messages and client debugging messages.
|
||||
// SchedMessages (in sched/sched_messages.C) decides which scheduler messages
|
||||
// to print and formats the "kind" keyword; ClientMessages does the same thing
|
||||
// for client debugging output.
|
||||
//
|
||||
// Messages has an "indent_level" state for how many spaces to indent output.
|
||||
// This corresponds in general to the function-call recursion level. Call
|
||||
// Messages::enter_level() to increase by 1 level and leave_level() to
|
||||
// decrease by 1 level. The ScopeMessages class takes care of calling
|
||||
// leave_level() for you. Create a ScopeMessages object on the stack at the
|
||||
// beginning of a function; it will increment the level by 1 on construction,
|
||||
// and decrement the level by 1 on destruction at end of scope. This way you
|
||||
// don't have to worry about decrementing before mid-function returns,
|
||||
// exceptions, etc.
|
||||
|
||||
// Each [v]printf* function prints the timestamp, the formatted KIND string,
|
||||
// indentation level, then the specified string. The string to print can be
|
||||
// a one-line string (including the trailing \n), a multi-line string (it's
|
||||
// broken up into lines to get the prefix on each line), or a file (also
|
||||
// broken up into lines).
|
||||
|
||||
// Scheduler functions should use "log_messages" which is an instance of
|
||||
// SchedMessages. Client functions should use "log_messages" (also) which is
|
||||
// an instance of ClientMessages.
|
||||
|
||||
// See sched/sched_messages.C and client/client_messages.C for those classes.
|
||||
|
||||
Messages::Messages(FILE* output_)
|
||||
{
|
||||
output = output_;
|
||||
|
@ -120,6 +150,11 @@ void Messages::printf_file(int kind, const char* filename, const char* prefix_fo
|
|||
va_end(va);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// These ScopeMessages functions are utility functions that call their
|
||||
// corresponding Messages functions with the same name, passing the KIND that
|
||||
// was specified on creation of the ScopeMessages object.
|
||||
|
||||
void ScopeMessages::printf(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
|
36
lib/util.h
36
lib/util.h
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -51,8 +51,13 @@ extern char* timestamp();
|
|||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
// the __attribute((format...)) tags are GCC extensions that let the compiler
|
||||
// do like-checking on printf-like arguments
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
#define __attribute__(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
// use ClientMessages or SchedMessages
|
||||
// See lib/messages.C for commentary
|
||||
class Messages {
|
||||
int debug_level;
|
||||
int indent_level;
|
||||
|
@ -66,10 +71,9 @@ public:
|
|||
Messages& operator++() { enter_level(); return *this; }
|
||||
Messages& operator--() { leave_level(); return *this; }
|
||||
|
||||
void printf(int kind, const char* format, ...);
|
||||
void printf_multiline(int kind, const char* str, const char* prefix_format, ...);
|
||||
void printf_file(int kind, const char* filename, const char* prefix_format, ...);
|
||||
|
||||
void printf(int kind, const char* format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void printf_multiline(int kind, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
void printf_file(int kind, const char* filename, const char* prefix_format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
void vprintf(int kind, const char* format, va_list va);
|
||||
void vprintf_multiline(int kind, const char* str, const char* prefix_format, va_list va);
|
||||
void vprintf_file(int kind, const char* filename, const char* prefix_format, va_list va);
|
||||
|
@ -80,7 +84,7 @@ protected:
|
|||
virtual bool v_message_wanted(int kind) const = 0;
|
||||
};
|
||||
|
||||
// automatically ++/--Messages on scope entry / exit
|
||||
// automatically ++/--Messages on scope entry / exit. See lib/messages.C for commentary
|
||||
class ScopeMessages
|
||||
{
|
||||
Messages& messages;
|
||||
|
@ -92,9 +96,9 @@ public:
|
|||
ScopeMessages& operator++() { ++messages; return *this; }
|
||||
ScopeMessages& operator--() { --messages; return *this; }
|
||||
|
||||
void printf(const char* format, ...);
|
||||
void printf_multiline(const char* str, const char* prefix_format, ...);
|
||||
void printf_file(const char* filename, const char* prefix_format, ...);
|
||||
void printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
void printf_multiline(const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void printf_file(const char* filename, const char* prefix_format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -8,20 +8,21 @@ void assimilate_handler(
|
|||
WORKUNIT& wu, vector<RESULT>& results, RESULT& canonical_result
|
||||
)
|
||||
{
|
||||
log_messages.printf(SchedMessages::NORMAL, "[%s] Assimilating\n", wu.name);
|
||||
ScopeMessages scope_messages(log_messages, SchedMessages::NORMAL);
|
||||
scope_messages.printf("[%s] Assimilating\n", wu.name);
|
||||
if (wu.canonical_resultid) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "canonical result:\n");
|
||||
log_messages.printf_multiline(SchedMessages::NORMAL, canonical_result.xml_doc_out, "[%s] ", wu.name);
|
||||
scope_messages.printf("[%s] Found canonical result\n", wu.name);
|
||||
log_messages.printf_multiline(SchedMessages::DEBUG, canonical_result.xml_doc_out, "[%s] canonical result", wu.name);
|
||||
} else {
|
||||
log_messages.printf(SchedMessages::NORMAL, "no canonical result\n");
|
||||
scope_messages.printf("[%s] No canonical result\n", wu.name);
|
||||
}
|
||||
if (wu.error_mask&WU_ERROR_COULDNT_SEND_RESULT) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Error: couldn't send a result\n");
|
||||
log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: couldn't send a result\n", wu.name);
|
||||
}
|
||||
if (wu.error_mask&WU_ERROR_TOO_MANY_ERROR_RESULTS) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Error: too many error results\n");
|
||||
log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: too many error results\n", wu.name);
|
||||
}
|
||||
if (wu.error_mask&WU_ERROR_TOO_MANY_RESULTS) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Error: too many total results\n");
|
||||
log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: too many total results\n", wu.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -139,7 +139,7 @@ try_again:
|
|||
retval = result.enumerate(clause);
|
||||
log_messages.printf(SchedMessages::DEBUG, "restarting enumeration\n");
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "enumeration restart returned nothing\n");
|
||||
log_messages.printf(SchedMessages::DEBUG, "enumeration restart returned nothing\n");
|
||||
no_wus = true;
|
||||
break;
|
||||
}
|
||||
|
@ -155,7 +155,8 @@ try_again:
|
|||
goto try_again;
|
||||
}
|
||||
if (result.server_state != RESULT_SERVER_STATE_UNSENT) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "RESULT STATE CHANGED: %s\n", result.name);
|
||||
log_messages.printf(SchedMessages::NORMAL, "[%s] RESULT STATE CHANGED\n",
|
||||
result.name);
|
||||
goto try_again;
|
||||
}
|
||||
collision = false;
|
||||
|
@ -169,10 +170,14 @@ try_again:
|
|||
}
|
||||
}
|
||||
if (!collision) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "adding result %d in slot %d\n", result.id, i);
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"[%s] adding result in slot %d\n",
|
||||
result.name, i);
|
||||
retval = wu.lookup_id(result.workunitid);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "can't read workunit %d: %d\n", result.workunitid, retval);
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] can't read workunit #%d: %d\n",
|
||||
result.name, result.workunitid, retval);
|
||||
continue;
|
||||
}
|
||||
ssp->wu_results[i].result = result;
|
||||
|
@ -184,17 +189,17 @@ try_again:
|
|||
}
|
||||
ssp->ready = true;
|
||||
if (nadditions == 0) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "no results added\n");
|
||||
log_messages.printf(SchedMessages::DEBUG, "No results added; sleeping 1 sec\n");
|
||||
sleep(1);
|
||||
} else {
|
||||
log_messages.printf(SchedMessages::DEBUG, "added %d results to array\n", nadditions);
|
||||
log_messages.printf(SchedMessages::DEBUG, "Added %d results to array\n", nadditions);
|
||||
}
|
||||
if (no_wus) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "feeder: no results available\n");
|
||||
log_messages.printf(SchedMessages::DEBUG, "No results available; sleeping 5 sec\n");
|
||||
sleep(5);
|
||||
}
|
||||
if (ncollisions) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "feeder: some results already in array - sleeping\n");
|
||||
log_messages.printf(SchedMessages::DEBUG, "Some results already in array - sleeping 5 sec\n");
|
||||
sleep(5);
|
||||
}
|
||||
fflush(stdout);
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -55,7 +55,7 @@ int wu_delete_files(WORKUNIT& wu) {
|
|||
} else if (match_tag(p, "</file_info>")) {
|
||||
if (!no_delete) {
|
||||
sprintf(pathname, "%s/%s", config.download_dir, filename);
|
||||
log_messages.printf(SchedMessages::NORMAL, "deleting %s\n", pathname);
|
||||
log_messages.printf(SchedMessages::NORMAL, "[%s] deleting %s\n", wu.name, pathname);
|
||||
unlink(pathname);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ int result_delete_files(RESULT& result) {
|
|||
char filename[256], pathname[256], buf[MAX_BLOB_SIZE];
|
||||
bool no_delete=false;
|
||||
|
||||
int count_deleted = 0;
|
||||
|
||||
safe_strcpy(buf, result.xml_doc_in);
|
||||
p = strtok(buf,"\n");
|
||||
while (p) {
|
||||
|
@ -81,12 +83,15 @@ int result_delete_files(RESULT& result) {
|
|||
} else if (match_tag(p, "</file_info>")) {
|
||||
if (!no_delete) {
|
||||
sprintf(pathname, "%s/%s", config.upload_dir, filename);
|
||||
log_messages.printf(SchedMessages::NORMAL, "deleting %s\n", pathname);
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] deleting %s\n", result.name, pathname);
|
||||
unlink(pathname);
|
||||
++count_deleted;
|
||||
}
|
||||
}
|
||||
p = strtok(0, "\n");
|
||||
}
|
||||
|
||||
log_messages.printf(SchedMessages::NORMAL, "[%s] deleted %d files\n", result.name, count_deleted);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -163,12 +163,12 @@ void make_work() {
|
|||
new_pathname, "%s/%s",config.download_dir, new_file_name
|
||||
);
|
||||
sprintf(command,"ln %s %s", pathname, new_pathname);
|
||||
log_messages.printf(SchedMessages::DEBUG, "executing command: %s\n", command);
|
||||
if (system(command)) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "system() error\n");
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.printf(SchedMessages::NORMAL, "%s\n", command);
|
||||
strcpy(new_buf, starting_xml);
|
||||
replace_file_name(
|
||||
new_buf, file_name, new_file_name, config.download_url
|
||||
|
@ -183,14 +183,14 @@ void make_work() {
|
|||
wu.create_time = time(0);
|
||||
retval = wu.insert();
|
||||
wu.id = boinc_db_insert_id();
|
||||
log_messages.printf(SchedMessages::DEBUG, "Created new WU: %s\n", wu.name);
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] Created new WU\n", wu.name, wu.id);
|
||||
}
|
||||
sprintf(suffix, "%d_%d", start_time, seqno++);
|
||||
create_result(
|
||||
wu, result_template, suffix, key,
|
||||
config.upload_url, config.download_url
|
||||
);
|
||||
log_messages.printf(SchedMessages::DEBUG, "added result: %s_%s\n", wu.name, suffix);
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s_%s] Added result\n", wu.name, suffix);
|
||||
nresults_left--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002, 2003
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -96,15 +96,17 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
|
||||
if (wu.canonical_resultid) {
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"validating WU %s; already have canonical result\n", wu.name
|
||||
);
|
||||
"[%s] handle_wu(): Already has canonical result\n", wu.name);
|
||||
++log_messages;
|
||||
|
||||
// Here if WU already has a canonical result.
|
||||
// Get unchecked results and see if they match the canonical result
|
||||
//
|
||||
retval = canonical_result.lookup_id(wu.canonical_resultid);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "can't read canonical result\n");
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] Can't read canonical result; marking as validated\n",
|
||||
wu.name);
|
||||
// Mark this WU as validated, otherwise we'll keep checking it
|
||||
goto mark_validated;
|
||||
}
|
||||
|
@ -120,26 +122,33 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
retval = check_pair(result, canonical_result, match);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"validate: pair_check failed for result %d\n", result.id);
|
||||
"[%s]: pair_check() failed for result\n",
|
||||
result.name);
|
||||
continue;
|
||||
} else {
|
||||
if (match) {
|
||||
result.validate_state = VALIDATE_STATE_VALID;
|
||||
result.granted_credit = wu.canonical_credit;
|
||||
printf("setting result %d to valid; credit %f\n", result.id, result.granted_credit);
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] pair_check() matched: setting result to valid; credit %f\n",
|
||||
result.name, result.granted_credit);
|
||||
} else {
|
||||
result.validate_state = VALIDATE_STATE_INVALID;
|
||||
printf("setting result %d to invalid\n", result.id);
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] pair_check() didn't match: setting result to invalid\n",
|
||||
result.name);
|
||||
}
|
||||
}
|
||||
retval = result.update();
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "Can't update result\n");
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] Can't update result\n", result.name);
|
||||
continue;
|
||||
}
|
||||
retval = grant_credit(result, result.granted_credit);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Can't grant credit\n");
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] Can't grant credit\n", result.name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +159,9 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
// Here if WU doesn't have a canonical result yet.
|
||||
// Try to get one
|
||||
|
||||
log_messages.printf(SchedMessages::DEBUG, "validating WU %s; no canonical result\n", wu.name);
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] handle_wu(): No canonical result yet\n", wu.name);
|
||||
++log_messages;
|
||||
|
||||
sprintf(buf, "where workunitid=%d", wu.id);
|
||||
while (!result.enumerate(buf)) {
|
||||
|
@ -160,11 +171,15 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
results.push_back(result);
|
||||
}
|
||||
}
|
||||
log_messages.printf(SchedMessages::DEBUG, "found %d successful results\n", results.size());
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] Found %d successful results\n",
|
||||
wu.name, results.size());
|
||||
if (results.size() >= (unsigned int)min_quorum) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] Enough for quorum, checking set.\n", wu.name);
|
||||
retval = check_set(results, canonicalid, credit);
|
||||
if (!retval && canonicalid) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "found a canonical result\n");
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"[%s] Found a canonical result: id=%d\n",
|
||||
wu.name, canonicalid);
|
||||
wu.canonical_resultid = canonicalid;
|
||||
wu.canonical_credit = credit;
|
||||
wu.assimilate_state = ASSIMILATE_READY;
|
||||
|
@ -178,12 +193,13 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
update_result = true;
|
||||
retval = grant_credit(result, credit);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "validate: grant_credit %d\n", retval );
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"[%s] grant_credit() returned %d\n", result.name, retval );
|
||||
}
|
||||
result.granted_credit = credit;
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"updating result %d to %d; credit %f\n",
|
||||
result.id, result.validate_state, credit );
|
||||
"[%s] Granted %f credit to valid result\n",
|
||||
result.name, result.granted_credit);
|
||||
}
|
||||
|
||||
// don't send any unsent results
|
||||
|
@ -198,7 +214,8 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
if (update_result) {
|
||||
retval = result.update();
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "validate: boinc_db_result_update %d\n", retval );
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] result.update() = %d\n", result.name, retval );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,13 +223,16 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
}
|
||||
}
|
||||
|
||||
--log_messages;
|
||||
|
||||
mark_validated:
|
||||
// we've checked all results for this WU, so turn off flag
|
||||
//
|
||||
wu.need_validate = 0;
|
||||
retval = wu.update();
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "db_workunit_update: %d\n", retval);
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] wu.update() = %d\n", wu.name, retval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,7 +328,7 @@ int main(int argc, char** argv) {
|
|||
exit(1);
|
||||
}
|
||||
write_pid_file(PIDFILE);
|
||||
log_messages.printf(SchedMessages::NORMAL, "Starting validator; min_quorum %d\n", min_quorum);
|
||||
log_messages.printf(SchedMessages::NORMAL, "Starting validator: min_quorum %d\n", min_quorum);
|
||||
|
||||
install_sigint_handler();
|
||||
|
||||
|
|
Loading…
Reference in New Issue