From 92a34648a65ba4764f879cf3d12f93af46740154 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 8 Nov 2006 00:20:16 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11494 --- checkin_notes | 24 +++++++++++++++++++++--- client/client_state.C | 1 + client/client_state.h | 1 + client/client_types.C | 1 + client/client_types.h | 1 + client/cpu_sched.C | 3 +++ client/cs_scheduler.C | 23 +++++++++++++++-------- lib/miofile.C | 2 +- 8 files changed, 44 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index 761bc01520..f6156ac4a1 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12385,11 +12385,29 @@ David 7 Nov 2006 validate_util.C Rom 7 Nov 2006 - - MGR: David and I got our wires cross, the global prefs mask is now set for all - values in the preferences dialog when the selection has been made to override - anything. + - MGR: David and I got our wires cross, + the global prefs mask is now set for all + values in the preferences dialog when the selection + has been made to override anything. clientgui/ sg_DlgPreferences.cpp, .h +David 7 Nov 2006 + - core client: call request_work_fetch() whenever a + process becomes contactable + (i.e. when its min_rpc_time times out). + This can avoid 10-minute periods of waiting + for the work fetch function to get called + Implementation: add bool PROJECT::possibly_backed_off; + set to true in set_min_rpc_time(); + check for timeout in check_project_timeout() + + client/ + client_state.C,h + client_types.C,h + cpu_sched.C + cs_scheduler.C + lib/ + miofile.C diff --git a/client/client_state.C b/client/client_state.C index 13af40a52d..144c83de63 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -481,6 +481,7 @@ bool CLIENT_STATE::poll_slow_events() { // and handle_finished_apps() must be done before possibly_schedule_cpus() ss_logic.poll(); + check_project_timeout(); POLL_ACTION(active_tasks , active_tasks.poll ); POLL_ACTION(garbage_collect , garbage_collect ); POLL_ACTION(update_results , update_results ); diff --git a/client/client_state.h b/client/client_state.h index 2932521c80..4c27b08e76 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -385,6 +385,7 @@ private: bool should_get_work(); int proj_min_results(PROJECT*, double); void generate_new_host_cpid(); + void check_project_timeout(); // --------------- cs_statefile.C: public: diff --git a/client/client_types.C b/client/client_types.C index 72b6635235..ffd6c5ee43 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -75,6 +75,7 @@ void PROJECT::init() { nrpc_failures = 0; master_fetch_failures = 0; min_rpc_time = 0; + possibly_backed_off = true; master_url_fetch_pending = false; sched_rpc_pending = 0; next_rpc_time = 0; diff --git a/client/client_types.h b/client/client_types.h index 004388328d..8b6fcea5cb 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -215,6 +215,7 @@ public: double next_rpc_time; // if nonzero, specifies a time when another scheduler RPC // should be done (as requested by server) + bool possibly_backed_off; bool trickle_up_pending; // have trickle up to send bool tentative; // we haven't done a scheduler RPC to this project yet // (still need to verify that its name isn't a dup) diff --git a/client/cpu_sched.C b/client/cpu_sched.C index 88bd5dfd84..78c6336c7e 100644 --- a/client/cpu_sched.C +++ b/client/cpu_sched.C @@ -441,6 +441,9 @@ void CLIENT_STATE::schedule_cpus() { fxp->fip->project->nactive_uploads++; } } + for (i=0; itoo_large = false; + } adjust_debts(); diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 5188790af3..6a1326ba31 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -58,11 +58,6 @@ using std::string; // #define EXP_DECAY_RATE (1./(SECONDS_PER_DAY*7)) -// how often to show user "backing off" messages -// -const int SECONDS_BEFORE_REPORTING_MIN_RPC_TIME_AGAIN = 60*60; - - // try to report results this much before their deadline // #define REPORT_DEADLINE_CUSHION ((double)SECONDS_PER_DAY) @@ -88,9 +83,21 @@ int CLIENT_STATE::proj_min_results(PROJECT* p, double subset_resource_share) { return (int)(ceil(ncpus*p->resource_share/subset_resource_share)); } +void CLIENT_STATE::check_project_timeout() { + unsigned int i; + for (i=0; ipossibly_backed_off && now > p->min_rpc_time) { + p->possibly_backed_off = false; + request_work_fetch("Project backoff ended"); + } + } +} + void PROJECT::set_min_rpc_time(double future_time) { if (future_time > min_rpc_time) { min_rpc_time = future_time; + possibly_backed_off = true; msg_printf(this, MSG_INFO, "Deferring scheduler requests for %s\n", timediff_format(min_rpc_time - gstate.now).c_str() @@ -926,7 +933,7 @@ int CLIENT_STATE::handle_scheduler_reply( if (sr.project_is_down) { if (sr.request_delay) { double x = gstate.now + sr.request_delay; - if (x > project->min_rpc_time) project->min_rpc_time = x; + project->set_min_rpc_time(x); } return ERR_PROJECT_DOWN; } @@ -1208,7 +1215,7 @@ int CLIENT_STATE::handle_scheduler_reply( // if (sr.request_delay) { double x = gstate.now + sr.request_delay; - if (x > project->min_rpc_time) project->min_rpc_time = x; + project->set_min_rpc_time(x); } else { project->min_rpc_time = 0; } @@ -1284,7 +1291,7 @@ void CLIENT_STATE::generate_new_host_cpid() { for (unsigned int i=0; iattached_via_acct_mgr) { projects[i]->sched_rpc_pending = RPC_REASON_ACCT_MGR_REQ; - projects[i]->min_rpc_time = now + 15; + projects[i]->set_min_rpc_time(now + 15); } } } diff --git a/lib/miofile.C b/lib/miofile.C index 9439df1b8c..68c0cb412c 100644 --- a/lib/miofile.C +++ b/lib/miofile.C @@ -79,7 +79,7 @@ char* MIOFILE::fgets(char* dst, int len) { if (f) { return ::fgets(dst, len, f); } - char* q = strchr(buf, '\n'); + const char* q = strchr(buf, '\n'); if (!q) return 0; q++;