*** empty log message ***

svn path=/trunk/boinc/; revision=1397
This commit is contained in:
Eric Heien 2003-06-11 23:36:40 +00:00
parent de38c44b95
commit 65dbd70e64
13 changed files with 140 additions and 111 deletions

View File

@ -55,7 +55,7 @@ bool do_pass(APP& app) {
"Assimilating WU %s, assim state %d\n",
wu.name, wu.assimilate_state
);
write_log(buf);
write_log(buf, MSG_DEBUG);
sprintf(buf, "where workunitid=%d", wu.id);
while (!result.enumerate(buf)) {
@ -125,17 +125,19 @@ int main(int argc, char** argv) {
asynch = true;
} else if (!strcmp(argv[i], "-one_pass")) {
one_pass = true;
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else if (!strcmp(argv[i], "-app")) {
strcpy(app.name, argv[++i]);
} else {
sprintf(buf, "Unrecognized arg: %s\n", argv[i]);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}
retval = config.parse_file();
if (retval) {
write_log("Can't parse config file\n");
write_log("Can't parse config file\n", MSG_CRITICAL);
exit(1);
}
@ -153,13 +155,13 @@ int main(int argc, char** argv) {
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
write_log("Can't open DB\n");
write_log("Can't open DB\n", MSG_CRITICAL);
exit(1);
}
sprintf(buf, "where name='%s'", app.name);
retval = app.lookup(buf);
if (retval) {
write_log("Can't find app\n");
write_log("Can't find app\n", MSG_CRITICAL);
exit(1);
}
if (one_pass) {

View File

@ -548,6 +548,8 @@ int main(int argc, char** argv) {
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "-dir")) {
strcpy(dir, argv[++i]);
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else if (!strcmp(argv[i], "-gzip")) {
zip_files = true;
strcpy( zip_cmd, "gzip -fq" );

View File

@ -128,7 +128,7 @@ try_again:
// there's no point in doing it again.
//
if (restarted_enum) {
write_log("already restarted enum on this pass\n");
write_log("already restarted enum on this pass\n", MSG_DEBUG);
break;
}
@ -136,9 +136,9 @@ try_again:
//
restarted_enum = true;
retval = result.enumerate(clause);
write_log("restarting enumeration\n");
write_log("restarting enumeration\n", MSG_DEBUG);
if (retval) {
write_log("enumeration restart returned nothing\n");
write_log("enumeration restart returned nothing\n", MSG_NORMAL);
no_wus = true;
break;
}
@ -151,12 +151,12 @@ try_again:
retval = result.lookup_id(result.id);
if (retval) {
sprintf(buf, "can't reread result %s\n", result.name);
write_log(buf);
write_log(buf, MSG_NORMAL);
goto try_again;
}
if (result.server_state != RESULT_SERVER_STATE_UNSENT) {
sprintf(buf, "RESULT STATE CHANGED: %s\n", result.name);
write_log(buf);
write_log(buf, MSG_NORMAL);
goto try_again;
}
collision = false;
@ -171,11 +171,11 @@ try_again:
}
if (!collision) {
sprintf(buf, "adding result %d in slot %d\n", result.id, i);
write_log(buf);
write_log(buf, MSG_DEBUG);
retval = wu.lookup_id(result.workunitid);
if (retval) {
sprintf(buf, "can't read workunit %d: %d\n", result.workunitid, retval);
write_log(buf);
write_log(buf, MSG_CRITICAL);
continue;
}
ssp->wu_results[i].result = result;
@ -187,18 +187,18 @@ try_again:
}
ssp->ready = true;
if (nadditions == 0) {
write_log("no results added\n");
write_log("no results added\n", MSG_DEBUG);
sleep(1);
} else {
sprintf(buf, "added %d results to array\n", nadditions);
write_log(buf);
write_log(buf, MSG_DEBUG);
}
if (no_wus) {
write_log("feeder: no results available\n");
write_log("feeder: no results available\n", MSG_DEBUG);
sleep(5);
}
if (ncollisions) {
write_log("feeder: some results already in array - sleeping\n");
write_log("feeder: some results already in array - sleeping\n", MSG_DEBUG);
sleep(5);
}
fflush(stdout);
@ -217,13 +217,15 @@ int main(int argc, char** argv) {
retval = config.parse_file();
if (retval) {
write_log("can't parse config file\n");
write_log("can't parse config file\n", MSG_CRITICAL);
exit(1);
}
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "-asynch")) {
asynch = true;
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
}
}
@ -241,12 +243,12 @@ int main(int argc, char** argv) {
retval = destroy_shmem(config.shmem_key);
if (retval) {
write_log("can't destroy shmem\n");
write_log("can't destroy shmem\n", MSG_CRITICAL);
exit(1);
}
retval = create_shmem(config.shmem_key, sizeof(SCHED_SHMEM), &p);
if (retval) {
write_log("can't create shmem\n");
write_log("can't create shmem\n", MSG_CRITICAL);
exit(1);
}
ssp = (SCHED_SHMEM*)p;
@ -254,7 +256,7 @@ int main(int argc, char** argv) {
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
sprintf(buf, "boinc_db_open: %d\n", retval);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
ssp->scan_tables();

View File

@ -55,7 +55,7 @@ int wu_delete_files(WORKUNIT& wu) {
if (!no_delete) {
sprintf(pathname, "%s/%s", config.download_dir, filename);
sprintf(logbuf, "deleting %s\n", pathname);
write_log(logbuf);
write_log(logbuf, MSG_NORMAL);
unlink(pathname);
}
}
@ -82,7 +82,7 @@ int result_delete_files(RESULT& result) {
if (!no_delete) {
sprintf(pathname, "%s/%s", config.upload_dir, filename);
sprintf(logbuf, "deleting %s\n", pathname);
write_log(logbuf);
write_log(logbuf, MSG_NORMAL);
unlink(pathname);
}
}
@ -131,15 +131,17 @@ int main(int argc, char** argv) {
asynch = true;
} else if (!strcmp(argv[i], "-one_pass")) {
one_pass = true;
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else {
sprintf(buf, "Unrecognized arg: %s\n", argv[i]);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}
retval = config.parse_file();
if (retval) {
write_log("Can't parse config file\n");
write_log("Can't parse config file\n", MSG_CRITICAL);
exit(1);
}
@ -157,7 +159,7 @@ int main(int argc, char** argv) {
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
write_log("can't open DB\n");
write_log("can't open DB\n", MSG_CRITICAL);
exit(1);
}
if (one_pass) {

View File

@ -36,6 +36,7 @@ using namespace std;
#include "parse.h"
#include "util.h"
#include "server_types.h"
#include "sched_util.h"
#include "main.h"
#include "handle_request.h"
@ -52,14 +53,14 @@ bool wu_is_feasible(WORKUNIT& wu, HOST& host) {
sprintf(buf, "WU %d needs %f disk; host %d has %f\n",
wu.id, wu.rsc_disk, host.id, host.d_free
);
write_log(buf);
write_log(buf, MSG_DEBUG);
return false;
}
if (host.m_nbytes && wu.rsc_memory > host.m_nbytes) {
sprintf(buf, "WU %d needs %f mem; host %d has %f\n",
wu.id, wu.rsc_memory, host.id, host.m_nbytes
);
write_log(buf);
write_log(buf, MSG_DEBUG);
return false;
}
return true;
@ -83,13 +84,13 @@ int insert_after(char* buffer, char* after, char* text) {
char temp[MAX_BLOB_SIZE];
if (strlen(buffer) + strlen(text) > MAX_BLOB_SIZE-1) {
write_log("insert_after: overflow\n");
write_log("insert_after: overflow\n", MSG_NORMAL);
return -1;
}
p = strstr(buffer, after);
if (!p) {
sprintf(temp, "insert_after: %s not found in %s\n", after, buffer);
write_log(temp);
write_log(temp, MSG_CRITICAL);
return -1;
}
p += strlen(after);
@ -201,7 +202,7 @@ int add_wu_to_reply(
app = ss.lookup_app(wu.appid);
if (!app) {
sprintf(buf, "Can't find app w/ ID %d\n", wu.appid);
write_log(buf);
write_log(buf, MSG_CRITICAL);
return -1;
}
avp = ss.lookup_app_version(app->id, platform.id, app->min_version);
@ -211,7 +212,7 @@ int add_wu_to_reply(
app->id, platform.id, app->min_version
);
write_log(buf);
write_log(buf, MSG_CRITICAL);
return -1;
}
@ -227,7 +228,7 @@ int add_wu_to_reply(
app_version = *avp;
retval = insert_app_file_tags(app_version, reply.user);
if (retval) {
write_log("insert_app_file_tags failed\n");
write_log("insert_app_file_tags failed\n", MSG_NORMAL);
return retval;
}
@ -238,7 +239,7 @@ int add_wu_to_reply(
wu2 = wu; // make copy since we're going to modify its XML field
retval = insert_wu_tags(wu2, *app);
if (retval) {
write_log("insert_wu_tags failed\n");
write_log("insert_wu_tags failed\n", MSG_NORMAL);
return retval;
}
reply.insert_workunit_unique(wu2);
@ -262,7 +263,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
strcpy(reply.message, "Can't find host record");
strcpy(reply.message_priority, "low");
sprintf(buf, "can't find host %d\n", sreq.hostid);
write_log(buf);
write_log(buf, MSG_NORMAL);
sreq.hostid = 0;
goto new_host;
}
@ -275,7 +276,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
reply.request_delay = 120;
reply.nucleus_only = true;
sprintf(buf, "can't find user %d\n", reply.host.userid);
write_log(buf);
write_log(buf, MSG_NORMAL);
return -1;
}
reply.user = user;
@ -288,7 +289,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
reply.request_delay = 120;
reply.nucleus_only = true;
sprintf(buf, "Bad authenticator [%s]\n", sreq.authenticator);
write_log(buf);
write_log(buf, MSG_CRITICAL);
return -1;
}
@ -318,7 +319,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
strcpy(reply.message_priority, "low");
reply.request_delay = 120;
sprintf(buf, "Bad authenticator [%s]\n", sreq.authenticator);
write_log(buf);
write_log(buf, MSG_CRITICAL);
return -1;
}
reply.user = user;
@ -337,7 +338,7 @@ new_host:
strcpy(reply.message, "server database error");
strcpy(reply.message_priority, "low");
boinc_db_print_error("host.insert()");
write_log("host.insert() failed\n");
write_log("host.insert() failed\n", MSG_CRITICAL);
return -1;
}
host.id = boinc_db_insert_id();
@ -404,7 +405,7 @@ int update_host_record(SCHEDULER_REQUEST& sreq, HOST& xhost) {
retval = host.update();
if (retval) {
sprintf(buf, "host.update() failed: %d\n", retval);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
return 0;
}
@ -467,14 +468,14 @@ int handle_results(
reply.result_acks.push_back(*rp);
sprintf(buf, "got result %s\n", rp->name);
write_log(buf);
write_log(buf, MSG_DEBUG);
strncpy(result.name, rp->name, sizeof(result.name));
sprintf(buf, "where name='%s'", result.name);
retval = result.lookup(buf);
if (retval) {
sprintf(buf, "can't find result %s\n", rp->name);
write_log(buf);
write_log(buf, MSG_DEBUG);
continue;
}
@ -483,7 +484,7 @@ int handle_results(
"got unexpected result for %s: server state is %d\n",
rp->name, result.server_state
);
write_log(buf);
write_log(buf, MSG_NORMAL);
continue;
}
if (result.server_state == RESULT_SERVER_STATE_OVER) {
@ -498,7 +499,7 @@ int handle_results(
"got result from wrong host: %d %d\n",
result.hostid, sreq.hostid
);
write_log(buf);
write_log(buf, MSG_NORMAL);
continue;
}
@ -516,12 +517,12 @@ int handle_results(
"can't find WU %d for result %d\n",
result.workunitid, result.id
);
write_log(buf);
write_log(buf, MSG_NORMAL);
} else {
wu.need_validate = 1;
retval = wu.update();
if (retval) {
write_log("Can't update WU\n");
write_log("Can't update WU\n", MSG_CRITICAL);
}
}
} else {
@ -537,7 +538,7 @@ int handle_results(
"can't update result %d: %s\n",
result.id, boinc_db_error_string()
);
write_log(buf);
write_log(buf, MSG_NORMAL);
}
}
@ -569,7 +570,7 @@ int send_work(
if (sreq.work_req_seconds <= 0) return 0;
sprintf(buf, "got request for %d seconds of work\n", sreq.work_req_seconds);
write_log(buf);
write_log(buf, MSG_DEBUG);
seconds_to_fill = sreq.work_req_seconds;
if (seconds_to_fill > MAX_SECONDS_TO_SEND) {
@ -588,7 +589,7 @@ int send_work(
}
if (!wu_is_feasible(ss.wu_results[i].workunit, reply.host)) {
sprintf(buf, "WU %s is infeasible\n", ss.wu_results[i].workunit.name);
write_log(buf);
write_log(buf, MSG_DEBUG);
continue;
}
@ -601,14 +602,11 @@ int send_work(
);
if (retval) continue;
#if 1
char buf[256];
sprintf(buf,
"sending result name %s, id %d\n",
result.name, result.id
);
write_log(buf);
#endif
write_log(buf, MSG_DEBUG);
// copy the result so we don't overwrite its XML fields
//
@ -616,7 +614,7 @@ int send_work(
retval = insert_name_tags(result_copy, wu);
if (retval) {
write_log("send_work: can't insert name tags\n");
write_log("send_work: can't insert name tags\n", MSG_NORMAL);
}
reply.insert_result(result_copy);
@ -633,7 +631,7 @@ int send_work(
}
sprintf(buf, "sending %d results\n", nresults);
write_log(buf);
write_log(buf, MSG_DEBUG);
if (nresults == 0) {
strcpy(reply.message, "no work available");
@ -656,7 +654,7 @@ void send_code_sign_key(
if (strlen(sreq.code_sign_key)) {
if (strcmp(sreq.code_sign_key, code_sign_key)) {
write_log("received old code sign key\n");
write_log("received old code sign key\n", MSG_NORMAL);
// look for a signature file
//
@ -708,7 +706,7 @@ bool wrong_major_version(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
sprintf(buf, "Wrong major version: wanted %d, got %d\n",
MAJOR_VERSION, sreq.core_client_major_version
);
write_log(buf);
write_log(buf, MSG_NORMAL);
return true;
}
return false;
@ -738,7 +736,7 @@ void process_request(
sprintf(buf, "platform [%s] not found\n", sreq.platform_name);
strcpy(reply.message, buf);
strcpy(reply.message_priority, "low");
write_log(buf);
write_log(buf, MSG_NORMAL);
return;
}
@ -757,7 +755,7 @@ void handle_request(
SCHEDULER_REQUEST sreq;
SCHEDULER_REPLY sreply;
write_log("Handling request\n");
write_log("Handling request\n", MSG_DEBUG);
memset(&sreq, 0, sizeof(sreq));
sreq.parse(fin);
process_request(sreq, sreply, ss, code_sign_key);

View File

@ -39,6 +39,9 @@ using namespace std;
#include "server_types.h"
#include "handle_request.h"
#include "main.h"
#include "sched_util.h"
#define DEBUG_LEVEL 1
#define STDERR_FILENAME "cgi_out"
#define REQ_FILE_PREFIX "boinc_req_"
@ -63,9 +66,11 @@ int main() {
exit(1);
}
set_debug_level(DEBUG_LEVEL);
retval = config.parse_file();
if (retval) {
write_log("Can't parse config file\n");
write_log("Can't parse config file\n", MSG_CRITICAL);
exit(1);
}
@ -73,35 +78,35 @@ int main() {
retval = read_file_malloc(path, code_sign_key);
if (retval) {
sprintf(buf, "Can't read code sign key file (%s)\n", path);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
retval = attach_shmem(config.shmem_key, &p);
if (retval) {
write_log("Can't attach shmem\n");
write_log("Can't attach shmem\n", MSG_CRITICAL);
exit(1);
}
ssp = (SCHED_SHMEM*)p;
retval = ssp->verify();
if (retval) {
write_log("shmem has wrong struct sizes - recompile\n");
write_log("shmem has wrong struct sizes - recompile\n", MSG_CRITICAL);
exit(1);
}
for (i=0; i<10; i++) {
if (ssp->ready) break;
write_log("waiting for ready flag\n");
write_log("waiting for ready flag\n", MSG_DEBUG);
sleep(1);
}
if (!ssp->ready) {
write_log("feeder doesn't seem to be running\n");
write_log("feeder doesn't seem to be running\n", MSG_CRITICAL);
exit(1);
}
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
write_log("can't open database\n");
write_log("can't open database\n", MSG_CRITICAL);
exit(1);
}
@ -110,7 +115,7 @@ int main() {
found = true;
}
if (!found) {
write_log("can't find project\n");
write_log("can't find project\n", MSG_CRITICAL);
exit(1);
}
@ -131,19 +136,19 @@ int main() {
sprintf(reply_path, "%s%d_%u", REPLY_FILE_PREFIX, pid, counter);
fout = fopen(req_path, "w");
if (!fout) {
write_log("can't write request file\n");
write_log("can't write request file\n", MSG_CRITICAL);
exit(1);
}
copy_stream(stdin, fout);
fclose(fout);
fin = fopen(req_path, "r");
if (!fin) {
write_log("can't read request file\n");
write_log("can't read request file\n", MSG_CRITICAL);
exit(1);
}
fout = fopen(reply_path, "w");
if (!fout) {
write_log("can't write reply file\n");
write_log("can't write reply file\n", MSG_CRITICAL);
exit(1);
}
handle_request(fin, fout, *ssp, code_sign_key);
@ -151,7 +156,7 @@ int main() {
fclose(fout);
fin = fopen(reply_path, "r");
if (!fin) {
write_log("can't read reply file\n");
write_log("can't read reply file\n", MSG_CRITICAL);
exit(1);
}
copy_stream(fin, stdout);

View File

@ -22,4 +22,3 @@
extern DB_PROJECT gproject;
extern CONFIG config;
extern void write_log(char*);

View File

@ -96,13 +96,13 @@ void make_work() {
retval = config.parse_file();
if (retval) {
write_log("can't read config file\n");
write_log("can't read config file\n", MSG_CRITICAL);
exit(1);
}
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
write_log("can't open db\n");
write_log("can't open db\n", MSG_CRITICAL);
exit(1);
}
@ -110,7 +110,7 @@ void make_work() {
retval = wu.lookup(buf);
if (retval) {
sprintf(buf, "can't find wu %s\n", wu_name);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
@ -119,13 +119,13 @@ void make_work() {
sprintf(keypath, "%s/upload_private", config.key_dir);
retval = read_key_file(keypath, key);
if (retval) {
write_log("can't read key\n");
write_log("can't read key\n", MSG_CRITICAL);
exit(1);
}
retval = read_filename(result_template_file, result_template);
if (retval) {
write_log("can't open result template\n");
write_log("can't open result template\n", MSG_CRITICAL);
exit(1);
}
nresults_left = 0;
@ -133,7 +133,7 @@ void make_work() {
sprintf(buf, "where server_state=%d", RESULT_SERVER_STATE_UNSENT);
retval = result.count(n, buf);
if (retval) {
write_log("can't count results\n");
write_log("can't count results\n", MSG_CRITICAL);
exit(1);
}
if (n > cushion) {
@ -162,12 +162,12 @@ void make_work() {
);
sprintf(command,"cp %s %s", pathname, new_pathname);
if (system(command)) {
write_log("system() error\n");
write_log("system() error\n", MSG_CRITICAL);
perror(command);
exit(1);
}
sprintf(buf, "%s\n", command);
write_log(buf);
write_log(buf, MSG_NORMAL);
strcpy(new_buf, starting_xml);
replace_file_name(
new_buf, file_name, new_file_name, config.download_url
@ -183,7 +183,7 @@ void make_work() {
retval = wu.insert();
wu.id = boinc_db_insert_id();
sprintf(buf, "Created new WU: %s\n", wu.name);
write_log(buf);
write_log(buf, MSG_DEBUG);
}
sprintf(suffix, "%d_%d", start_time, seqno++);
create_result(
@ -191,7 +191,7 @@ void make_work() {
config.upload_url, config.download_url
);
sprintf(buf, "added result: %s_%s\n", wu.name, suffix);
write_log(buf);
write_log(buf, MSG_DEBUG);
nresults_left--;
check_stop_trigger();
}
@ -211,17 +211,19 @@ int main(int argc, char** argv) {
redundancy = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-result_template")) {
strcpy(result_template_file, argv[++i]);
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else if (!strcmp(argv[i], "-wu_name")) {
strcpy(wu_name, argv[++i]);
}
}
if (!strlen(result_template_file)) {
write_log("missing -result_template\n");
write_log("missing -result_template\n", MSG_CRITICAL);
exit(1);
}
if (!strlen(wu_name)) {
write_log("missing -wu_name\n");
write_log("missing -wu_name\n", MSG_CRITICAL);
exit(1);
}

View File

@ -27,8 +27,15 @@ using namespace std;
#include "sched_util.h"
#include "server_types.h"
void write_log(char* p) {
fprintf(stderr, "%s: %s", timestamp(), p);
int debug_level = 0;
void write_log(char* p, int msg_level) {
if (msg_level <= debug_level)
fprintf(stderr, "%s: %s", timestamp(), p);
}
void set_debug_level(int new_level) {
debug_level = new_level;
}
void check_stop_trigger() {

View File

@ -39,7 +39,12 @@
#define STOP_TRIGGER_FILENAME "stop_server"
extern void write_log(char*);
#define MSG_CRITICAL 0
#define MSG_NORMAL 1
#define MSG_DEBUG 2
extern void write_log(char*, int);
extern void set_debug_level(int);
extern void check_stop_trigger();
extern void update_average(double, double, double&, double&);

View File

@ -29,6 +29,7 @@ using namespace std;
#include "util.h"
#include "main.h"
#include "server_types.h"
#include "sched_util.h"
SCHEDULER_REQUEST::SCHEDULER_REQUEST() {
}
@ -87,7 +88,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
}
else {
sprintf(ebuf, "SCHEDULER_REQUEST::parse(): unrecognized: %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;
@ -295,7 +296,7 @@ int RESULT::parse_from_client(FILE* fin) {
continue;
} else {
sprintf(ebuf, "RESULT::parse_from_client(): unrecognized: %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;
@ -328,7 +329,7 @@ int HOST::parse(FILE* fin) {
else if (parse_double(buf, "<n_bwdown>", n_bwdown)) continue;
else {
sprintf(ebuf, "HOST::parse(): unrecognized: %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;
@ -345,7 +346,7 @@ int HOST::parse_time_stats(FILE* fin) {
else if (parse_double(buf, "<active_frac>", active_frac)) continue;
else {
sprintf(ebuf, "HOST::parse_time_stats(): unrecognized: %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;
@ -360,7 +361,7 @@ int HOST::parse_net_stats(FILE* fin) {
else if (parse_double(buf, "<bwdown>", n_bwdown)) continue;
else {
sprintf(ebuf, "HOST::parse_net_stats(): unrecognized: %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;
@ -375,7 +376,7 @@ int APP_FILE::parse(char*& in) {
else if (parse_str(buf, "<open_name>", open_name, sizeof(open_name))) continue;
else {
sprintf(ebuf, "APP_FILE::parse(): unrecognized %s\n", buf);
write_log(ebuf);
write_log(ebuf, MSG_NORMAL);
}
}
return 1;

View File

@ -122,11 +122,13 @@ int main(int argc, char** argv) {
do_update_users = true;
} else if (!strcmp(argv[i], "-update_hosts")) {
do_update_hosts = true;
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else if (!strcmp(argv[i], "-asynch")) {
asynch = true;
} else {
sprintf(buf, "Unrecognized arg: %s\n", argv[i]);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}

View File

@ -97,14 +97,14 @@ void handle_wu(DB_WORKUNIT& wu) {
sprintf(buf,
"validating WU %s; already have canonical result\n", wu.name
);
write_log(buf);
write_log(buf, MSG_NORMAL);
// 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) {
write_log("can't read canonical result\n");
write_log("can't read canonical result\n", MSG_NORMAL);
// Mark this WU as validated, otherwise we'll keep checking it
goto mark_validated;
}
@ -123,7 +123,7 @@ void handle_wu(DB_WORKUNIT& wu) {
"validate: pair_check failed for result %d\n",
result.id
);
write_log(buf);
write_log(buf, MSG_DEBUG);
continue;
} else {
if (match) {
@ -137,12 +137,12 @@ void handle_wu(DB_WORKUNIT& wu) {
}
retval = result.update();
if (retval) {
write_log("Can't update result\n");
write_log("Can't update result\n", MSG_CRITICAL);
continue;
}
retval = grant_credit(result, result.granted_credit);
if (retval) {
write_log("Can't grant credit\n");
write_log("Can't grant credit\n", MSG_NORMAL);
continue;
}
}
@ -154,7 +154,7 @@ void handle_wu(DB_WORKUNIT& wu) {
// Try to get one
sprintf(buf, "validating WU %s; no canonical result\n", wu.name);
write_log(buf);
write_log(buf, MSG_DEBUG);
sprintf(buf, "where workunitid=%d", wu.id);
while (!result.enumerate(buf)) {
@ -165,11 +165,11 @@ void handle_wu(DB_WORKUNIT& wu) {
}
}
sprintf(buf, "found %d successful results\n", results.size());
write_log(buf);
write_log(buf, MSG_DEBUG);
if (results.size() >= (unsigned int)min_quorum) {
retval = check_set(results, canonicalid, credit);
if (!retval && canonicalid) {
write_log("found a canonical result\n");
write_log("found a canonical result\n", MSG_DEBUG);
wu.canonical_resultid = canonicalid;
wu.canonical_credit = credit;
wu.assimilate_state = ASSIMILATE_READY;
@ -186,14 +186,14 @@ void handle_wu(DB_WORKUNIT& wu) {
sprintf(buf,
"validate: grant_credit %d\n", retval
);
write_log(buf);
write_log(buf, MSG_DEBUG);
}
result.granted_credit = credit;
sprintf(buf,
"updating result %d to %d; credit %f\n",
result.id, result.validate_state, credit
);
write_log(buf);
write_log(buf, MSG_NORMAL);
}
// don't send any unsent results
@ -210,7 +210,7 @@ void handle_wu(DB_WORKUNIT& wu) {
sprintf(buf,
"validate: boinc_db_result_update %d\n", retval
);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}
}
@ -225,7 +225,7 @@ void handle_wu(DB_WORKUNIT& wu) {
retval = wu.update();
if (retval) {
sprintf(buf, "db_workunit_update: %d\n", retval);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}
@ -254,7 +254,7 @@ int main_loop(bool one_pass) {
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
sprintf(buf, "boinc_db_open: %d\n", retval);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
@ -262,7 +262,7 @@ int main_loop(bool one_pass) {
retval = app.lookup(buf);
if (retval) {
sprintf(buf, "can't find app %s\n", app.name);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
@ -292,26 +292,28 @@ int main(int argc, char** argv) {
one_pass = true;
} else if (!strcmp(argv[i], "-app")) {
strcpy(app_name, argv[++i]);
} else if (!strcmp(argv[i], "-d")) {
set_debug_level(atoi(argv[++i]));
} else if (!strcmp(argv[i], "-quorum")) {
min_quorum = atoi(argv[++i]);
} else {
sprintf(buf, "unrecognized arg: %s\n", argv[i]);
write_log(buf);
write_log(buf, MSG_CRITICAL);
}
}
if (min_quorum < 1 || min_quorum > 10) {
sprintf(buf, "bad min_quorum: %d\n", min_quorum);
write_log(buf);
write_log(buf, MSG_CRITICAL);
exit(1);
}
sprintf(buf, "starting validator; min_quorum %d\n", min_quorum);
write_log(buf);
write_log(buf, MSG_NORMAL);
retval = config.parse_file();
if (retval) {
write_log("Can't parse config file\n");
write_log("Can't parse config file\n", MSG_CRITICAL);
exit(1);
}