From 33d5a81cf6e17469a3eac1dca30345ad9da33985 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 3 Mar 2009 16:38:54 +0000 Subject: [PATCH] - scheduler: add locality_scheduling arg to add_result_to_reply(); eliminate the need to diddle around with config.locality_scheduling. svn path=/trunk/boinc/; revision=17445 --- checkin_notes | 11 +++++++++++ sched/sched_array.cpp | 2 +- sched/sched_assign.cpp | 2 +- sched/sched_locality.cpp | 2 +- sched/sched_resend.cpp | 2 +- sched/sched_send.cpp | 11 ++++++----- sched/sched_send.h | 3 ++- 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/checkin_notes b/checkin_notes index efab9c9ffe..f8da327774 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2534,3 +2534,14 @@ Charlie 3 Mar 2009 mac_saver_module.cpp screensaver.cpp, .h screensaver_win.cpp + +David 3 Mar 2009 + - scheduler: add locality_scheduling arg to add_result_to_reply(); + eliminate the need to diddle around with config.locality_scheduling. + + sched/ + sched_array.cpp + sched_assign.cpp + sched_locality.cpp + sched_resend.cpp + sched_send.cpp,h diff --git a/sched/sched_array.cpp b/sched/sched_array.cpp index 539ba39c7e..27e9024376 100644 --- a/sched/sched_array.cpp +++ b/sched/sched_array.cpp @@ -277,7 +277,7 @@ void scan_work_array() { goto done; } - retval = add_result_to_reply(result, wu, bavp); + retval = add_result_to_reply(result, wu, bavp, false); // add_result_to_reply() fails only in fairly pathological cases - // e.g. we couldn't update the DB record or modify XML fields. diff --git a/sched/sched_assign.cpp b/sched/sched_assign.cpp index e802687075..d7c69aef92 100644 --- a/sched/sched_assign.cpp +++ b/sched/sched_assign.cpp @@ -84,7 +84,7 @@ static int send_assigned_job(ASSIGNMENT& asg) { int result_id = boinc_db.insert_id(); DB_RESULT result; retval = result.lookup_id(result_id); - add_result_to_reply(result, wu, bavp); + add_result_to_reply(result, wu, bavp, false); // if this is a one-job assignment, fill in assignment.resultid // so that it doesn't get sent again diff --git a/sched/sched_locality.cpp b/sched/sched_locality.cpp index ce9435969f..abb2236104 100644 --- a/sched/sched_locality.cpp +++ b/sched/sched_locality.cpp @@ -297,7 +297,7 @@ static int possibly_send_result(DB_RESULT& result) { if (count > 0) return ERR_WU_USER_RULE; } - return add_result_to_reply(result, wu, bavp); + return add_result_to_reply(result, wu, bavp, true); } // returns true if the work generator can not make more work for this diff --git a/sched/sched_resend.cpp b/sched/sched_resend.cpp index 21651a7e41..0059b874ac 100644 --- a/sched/sched_resend.cpp +++ b/sched/sched_resend.cpp @@ -188,7 +188,7 @@ bool resend_lost_work() { ); g_reply->insert_message(USER_MESSAGE(warning_msg, "high")); } else { - retval = add_result_to_reply(result, wu, bavp); + retval = add_result_to_reply(result, wu, bavp, false); if (retval) { log_messages.printf(MSG_CRITICAL, "[HOST#%d] failed to send [RESULT#%d]\n", diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 067bd8716b..f3df2771eb 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -1081,7 +1081,10 @@ bool work_needed(bool locality_sched) { return false; } -int add_result_to_reply(DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp) { +int add_result_to_reply( + DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp, + bool locality_scheduling +) { int retval; bool resent_result = false; APP* app = ssp->lookup_app(wu.appid); @@ -1093,9 +1096,7 @@ int add_result_to_reply(DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp) // reduce the available space by LESS than the workunit rsc_disk_bound, // IF the host already has the file OR the file was not already sent. // - if (!config.locality_scheduling || - decrement_disk_space_locality(wu) - ) { + if (!locality_scheduling || decrement_disk_space_locality(wu)) { g_wreq->disk_available -= wu.rsc_disk_bound; } @@ -2020,7 +2021,7 @@ void JOB_SET::send() { result.id = wu_result.resultid; retval = read_sendable_result(result); if (!retval) { - add_result_to_reply(result, wu, job.bavp); + add_result_to_reply(result, wu, job.bavp, false); } } } diff --git a/sched/sched_send.h b/sched/sched_send.h index 6c3ff685cf..cc660fffae 100644 --- a/sched/sched_send.h +++ b/sched/sched_send.h @@ -20,7 +20,8 @@ extern void send_work(); extern int add_result_to_reply( - DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp + DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp, + bool locality_scheduling ); inline bool anonymous(PLATFORM* platform) {