From b089311fc30bcaf6580db1fe3d3feb568011e3f8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 16 Oct 2003 18:10:56 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2490 --- checkin_notes | 11 +++++++++++ db/boinc_db.C | 7 +++++-- db/boinc_db.h | 3 ++- db/constraints.sql | 1 + db/schema.sql | 1 + sched/handle_request.C | 30 ++++++++++++++++++++++++++++-- 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 284765eb7b..89d4eda2dc 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6826,3 +6826,14 @@ David 15 Oct 2003 graphics.php lib/ error_numbers.h + +David 16 Oct 2003 + - add "userid" to result table + - send at most one result per WU per user + + db/ + boinc_db.C,h + schema.sql + constraints.sql + sched/ + handle_request.C diff --git a/db/boinc_db.C b/db/boinc_db.C index a2ed0d74cf..acbc9c7e24 100644 --- a/db/boinc_db.C +++ b/db/boinc_db.C @@ -444,7 +444,8 @@ void DB_RESULT::db_print(char* buf){ buf, "id=%d, create_time=%d, workunitid=%d, " "server_state=%d, outcome=%d, client_state=%d, " - "hostid=%d, report_deadline=%d, sent_time=%d, received_time=%d, " + "hostid=%d, userid=%d, " + "report_deadline=%d, sent_time=%d, received_time=%d, " "name='%s', cpu_time=%.15e, " "xml_doc_in='%s', xml_doc_out='%s', stderr_out='%s', " "batch=%d, file_delete_state=%d, validate_state=%d, " @@ -452,7 +453,8 @@ void DB_RESULT::db_print(char* buf){ "client_version_num=%d", id, create_time, workunitid, server_state, outcome, client_state, - hostid, report_deadline, sent_time, received_time, + hostid, userid, + report_deadline, sent_time, received_time, name, cpu_time, xml_doc_in, xml_doc_out, stderr_out, batch, file_delete_state, validate_state, @@ -472,6 +474,7 @@ void DB_RESULT::db_parse(MYSQL_ROW &r) { outcome = atoi(r[i++]); client_state = atoi(r[i++]); hostid = atoi(r[i++]); + userid = atoi(r[i++]); report_deadline = atoi(r[i++]); sent_time = atoi(r[i++]); received_time = atoi(r[i++]); diff --git a/db/boinc_db.h b/db/boinc_db.h index a374802b71..8825a75f66 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -346,11 +346,12 @@ struct RESULT { int server_state; // see above int outcome; // see above; defined if server state OVER int client_state; // phase that client contacted us in. - // iff it is UPLOADED then outcome is success. + // if UPLOADED then outcome is success. // error details are in stderr_out. // The values for this field are defined // in lib/result_state.h int hostid; // host processing this result + int userid; // user processing this result int report_deadline; // deadline for receiving result int sent_time; // when result was sent to host int received_time; // when result was received from host diff --git a/db/constraints.sql b/db/constraints.sql index 2057e308a5..37e7d2a706 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -42,6 +42,7 @@ alter table result add index ind_res_st (server_state, random), add index res_filedel (file_delete_state), add index res_hostid (hostid), + add index res_wu_user (workunitid, userid), add index received_time (received_time); alter table host diff --git a/db/schema.sql b/db/schema.sql index 9a46ef9e88..f6ee21cfea 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -181,6 +181,7 @@ create table result ( outcome integer not null, client_state integer not null, hostid integer not null, + userid integer not null, report_deadline integer not null, sent_time integer not null, received_time integer not null, diff --git a/sched/handle_request.C b/sched/handle_request.C index 79335e0b5a..39a41facf6 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -674,10 +674,11 @@ static void scan_work_array( SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform, SCHED_SHMEM& ss ) { - int i, retval; + int i, retval, n; WORKUNIT wu; DB_RESULT result; double wu_seconds_filled; + char buf[256]; for (i=0; i0; i++) { WU_RESULT& wu_result = ss.wu_results[i]; @@ -698,8 +699,32 @@ static void scan_work_array( continue; } + // don't send if we've already a result of this WU to this user + // + sprintf(buf, + "where workunitid=%d and userid=%d", + wu_result.workunit.id, reply.user.id + ); + retval = result.count(n, buf); + if (retval) { + log_messages.printf( + SchedMessages::CRITICAL, + "send_work: can't get result count (%d)\n", retval + ); + continue; + } else { + if (n>0) { + log_messages.printf( + SchedMessages::NORMAL, + "send_work: user %d already has %d result for WU %d\n", + reply.user.id, n, wu_result.workunit.id + ); + } + } + + // don't sent if host can't handle it + // wu = wu_result.workunit; - if (!wu_is_feasible(wu, reply.host)) { log_messages.printf( SchedMessages::DEBUG, "[HOST#%d] [WU#%d %s] WU is infeasible\n", @@ -736,6 +761,7 @@ static void scan_work_array( // result.server_state = RESULT_SERVER_STATE_IN_PROGRESS; result.hostid = reply.host.id; + result.userid = reply.user.id; result.sent_time = time(0); result.report_deadline = result.sent_time + wu.delay_bound; result.update();