mirror of https://github.com/BOINC/boinc.git
parent
29b73a2393
commit
eafb60f64a
|
@ -1,12 +1,12 @@
|
|||
## -*-Makefile -*-
|
||||
## $Id$
|
||||
|
||||
MYSQL_INCLUDES = /usr/local/mysql/include
|
||||
MYSQL_INCLUDES2 = /usr/local/mysql/include/mysql
|
||||
MYSQL_INCLUDES3 = /usr/include/mysql
|
||||
MYSQL_INCLUDES = /usr/local/mysql_32bit/include
|
||||
MYSQL_INCLUDES2 = /usr/local/mysql_32bit/include/mysql
|
||||
MYSQL_INCLUDES3 = /usr/include/mysql_32bit
|
||||
|
||||
MYSQL_LIBS = \
|
||||
-L/usr/local/mysql/lib -L/sw/lib/mysql -L/usr/local/lib/mysql \
|
||||
-L/usr/local/mysql_32bit/lib -L/sw/lib/mysql -L/usr/local/lib/mysql \
|
||||
-lmysqlclient -L/usr/local/lib -lz \
|
||||
-lm $(NETLIBS)
|
||||
|
||||
|
|
|
@ -155,8 +155,11 @@ try_again:
|
|||
goto try_again;
|
||||
}
|
||||
if (result.server_state != RESULT_SERVER_STATE_UNSENT) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "[%s] RESULT STATE CHANGED\n",
|
||||
result.name);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"[%s] RESULT STATE CHANGED\n",
|
||||
result.name
|
||||
);
|
||||
goto try_again;
|
||||
}
|
||||
collision = false;
|
||||
|
@ -170,14 +173,18 @@ try_again:
|
|||
}
|
||||
}
|
||||
if (!collision) {
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] adding result in slot %d\n",
|
||||
result.name, i);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"[%s] adding result in slot %d\n",
|
||||
result.name, i
|
||||
);
|
||||
retval = wu.lookup_id(result.workunitid);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] can't read workunit #%d: %d\n",
|
||||
result.name, 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;
|
||||
|
@ -266,14 +273,16 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
ssp->scan_tables();
|
||||
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"feeder: read "
|
||||
"%d platforms, "
|
||||
"%d apps, "
|
||||
"%d app_versions\n",
|
||||
ssp->nplatforms,
|
||||
ssp->napps,
|
||||
ssp->napp_versions);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"feeder: read "
|
||||
"%d platforms, "
|
||||
"%d apps, "
|
||||
"%d app_versions\n",
|
||||
ssp->nplatforms,
|
||||
ssp->napps,
|
||||
ssp->napp_versions
|
||||
);
|
||||
|
||||
feeder_loop();
|
||||
}
|
||||
|
|
|
@ -32,8 +32,7 @@ using namespace std;
|
|||
|
||||
const char* STOP_TRIGGER_FILENAME = "../stop_server";
|
||||
|
||||
void write_pid_file(const char* filename)
|
||||
{
|
||||
void write_pid_file(const char* filename) {
|
||||
FILE* fpid = fopen(filename, "w");
|
||||
if (!fpid) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Couldn't write pid\n");
|
||||
|
@ -45,14 +44,12 @@ void write_pid_file(const char* filename)
|
|||
|
||||
// sig_int will be set to true if SIGINT is caught.
|
||||
bool sig_int = false;
|
||||
static void sigint_handler(int)
|
||||
{
|
||||
static void sigint_handler(int) {
|
||||
fprintf(stderr, "SIGINT\n");
|
||||
sig_int = true;
|
||||
}
|
||||
|
||||
void install_sigint_handler()
|
||||
{
|
||||
void install_sigint_handler() {
|
||||
signal(SIGINT, sigint_handler);
|
||||
// SIGINT is now default again so hitting ^C again will kill the program.
|
||||
}
|
||||
|
@ -72,7 +69,9 @@ void check_stop_trigger() {
|
|||
|
||||
// update an exponential average of credit per second.
|
||||
//
|
||||
void update_average(double credit_assigned_time, double credit, double& avg, double& avg_time) {
|
||||
void update_average(
|
||||
double credit_assigned_time, double credit, double& avg, double& avg_time
|
||||
) {
|
||||
time_t now = time(0);
|
||||
|
||||
// decrease existing average according to how long it's been
|
||||
|
|
|
@ -303,7 +303,11 @@ int RESULT::parse_from_client(FILE* fin) {
|
|||
}
|
||||
continue;
|
||||
} else {
|
||||
log_messages.printf(SchedMessages::NORMAL, "RESULT::parse_from_client(): unrecognized: %s\n", buf);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"RESULT::parse_from_client(): unrecognized: %s\n",
|
||||
buf
|
||||
);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -357,7 +361,11 @@ int HOST::parse_time_stats(FILE* fin) {
|
|||
else if (parse_double(buf, "<connected_frac>", connected_frac)) continue;
|
||||
else if (parse_double(buf, "<active_frac>", active_frac)) continue;
|
||||
else {
|
||||
log_messages.printf(SchedMessages::NORMAL, "HOST::parse_time_stats(): unrecognized: %s\n", buf);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"HOST::parse_time_stats(): unrecognized: %s\n",
|
||||
buf
|
||||
);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -371,7 +379,11 @@ int HOST::parse_net_stats(FILE* fin) {
|
|||
else if (parse_double(buf, "<bwup>", n_bwup)) continue;
|
||||
else if (parse_double(buf, "<bwdown>", n_bwdown)) continue;
|
||||
else {
|
||||
log_messages.printf(SchedMessages::NORMAL, "HOST::parse_net_stats(): unrecognized: %s\n", buf);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"HOST::parse_net_stats(): unrecognized: %s\n",
|
||||
buf
|
||||
);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -386,7 +398,11 @@ int APP_FILE::parse(char*& in) {
|
|||
else if (parse_str(buf, "<open_name>", open_name, sizeof(open_name))) continue;
|
||||
else if (parse_int(buf, "<timestamp>", timestamp)) continue;
|
||||
else {
|
||||
log_messages.printf(SchedMessages::NORMAL, "APP_FILE::parse(): unrecognized %s\n", buf);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"APP_FILE::parse(): unrecognized %s\n",
|
||||
buf
|
||||
);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
102
sched/validate.C
102
sched/validate.C
|
@ -95,8 +95,10 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
char buf[256];
|
||||
|
||||
if (wu.canonical_resultid) {
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] handle_wu(): Already has canonical result\n", wu.name);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"[%s] handle_wu(): Already has canonical result\n", wu.name
|
||||
);
|
||||
++log_messages;
|
||||
|
||||
// Here if WU already has a canonical result.
|
||||
|
@ -104,9 +106,11 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
//
|
||||
retval = canonical_result.lookup_id(wu.canonical_resultid);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] Can't read canonical result; marking as validated\n",
|
||||
wu.name);
|
||||
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;
|
||||
}
|
||||
|
@ -121,34 +125,44 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
) {
|
||||
retval = check_pair(result, canonical_result, match);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"[%s]: pair_check() failed for result\n",
|
||||
result.name);
|
||||
log_messages.printf(
|
||||
SchedMessages::DEBUG,
|
||||
"[%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;
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] pair_check() matched: setting result to valid; credit %f\n",
|
||||
result.name, 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;
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] pair_check() didn't match: setting result to invalid\n",
|
||||
result.name);
|
||||
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,
|
||||
"[%s] Can't update result\n", result.name);
|
||||
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,
|
||||
"[%s] Can't grant credit\n", result.name);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"[%s] Can't grant credit\n", result.name
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -159,8 +173,10 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
// Here if WU doesn't have a canonical result yet.
|
||||
// Try to get one
|
||||
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] handle_wu(): No canonical result yet\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);
|
||||
|
@ -171,15 +187,22 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
results.push_back(result);
|
||||
}
|
||||
}
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] Found %d successful results\n",
|
||||
wu.name, (int)results.size());
|
||||
log_messages.printf(
|
||||
SchedMessages::DEBUG, "[%s] Found %d successful results\n",
|
||||
wu.name, (int)results.size()
|
||||
);
|
||||
if (results.size() >= (unsigned int)min_quorum) {
|
||||
log_messages.printf(SchedMessages::DEBUG, "[%s] Enough for quorum, checking set.\n", wu.name);
|
||||
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,
|
||||
"[%s] Found a canonical result: id=%d\n",
|
||||
wu.name, canonicalid);
|
||||
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;
|
||||
|
@ -193,13 +216,17 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
update_result = true;
|
||||
retval = grant_credit(result, credit);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::DEBUG,
|
||||
"[%s] grant_credit() returned %d\n", result.name, retval );
|
||||
log_messages.printf(
|
||||
SchedMessages::DEBUG,
|
||||
"[%s] grant_credit() returned %d\n", result.name, retval
|
||||
);
|
||||
}
|
||||
result.granted_credit = credit;
|
||||
log_messages.printf(SchedMessages::NORMAL,
|
||||
"[%s] Granted %f credit to valid result\n",
|
||||
result.name, result.granted_credit);
|
||||
log_messages.printf(
|
||||
SchedMessages::NORMAL,
|
||||
"[%s] Granted %f credit to valid result\n",
|
||||
result.name, result.granted_credit
|
||||
);
|
||||
}
|
||||
|
||||
// don't send any unsent results
|
||||
|
@ -214,8 +241,11 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
if (update_result) {
|
||||
retval = result.update();
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] result.update() = %d\n", result.name, retval );
|
||||
log_messages.printf(
|
||||
SchedMessages::CRITICAL,
|
||||
"[%s] result.update() = %d\n",
|
||||
result.name, retval
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,8 +261,10 @@ void handle_wu(DB_WORKUNIT& wu) {
|
|||
wu.need_validate = 0;
|
||||
retval = wu.update();
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL,
|
||||
"[%s] wu.update() = %d\n", wu.name, retval);
|
||||
log_messages.printf(
|
||||
SchedMessages::CRITICAL,
|
||||
"[%s] wu.update() = %d\n", wu.name, retval
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,12 +135,12 @@ target_cpu = @target_cpu@
|
|||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
MYSQL_INCLUDES = /usr/local/mysql/include
|
||||
MYSQL_INCLUDES2 = /usr/local/mysql/include/mysql
|
||||
MYSQL_INCLUDES = /usr/local/mysql_32bit/include
|
||||
MYSQL_INCLUDES2 = /usr/local/mysql_32bit/include/mysql
|
||||
MYSQL_INCLUDES3 = /usr/include/mysql
|
||||
|
||||
MYSQL_LIBS = \
|
||||
-L/usr/local/mysql/lib -L/sw/lib/mysql -L/usr/local/lib/mysql \
|
||||
-L/usr/local/mysql_32bit/lib -L/sw/lib/mysql -L/usr/local/lib/mysql \
|
||||
-lmysqlclient -L/usr/local/lib -lz \
|
||||
-lm $(NETLIBS)
|
||||
|
||||
|
|
Loading…
Reference in New Issue