diff --git a/checkin_notes b/checkin_notes index 7faf184d25..bc50a06c09 100644 --- a/checkin_notes +++ b/checkin_notes @@ -10392,3 +10392,15 @@ David 26 Dec 2008 client/ work_fetch.cpp + +David 30 Dec 2008 + - client: code shuffling + - scheduler: fix typo in msg + + client/ + cs_scheduler.cpp + makefile_sim + sim.h + work_fetch.cpp + sched/ + sched_send.cpp diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index 24f734e71c..e72523e143 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -62,6 +62,7 @@ using std::string; // #define REPORT_DEADLINE_CUSHION ((double)SECONDS_PER_DAY) +#ifndef SIM // Write a scheduler request to a disk file, // to be sent to a scheduling server @@ -895,4 +896,137 @@ int CLIENT_STATE::handle_scheduler_reply( return 0; } +#endif // SIM + +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, const char* reason) { + if (future_time <= min_rpc_time) return; + if (next_rpc_time && (future_time > next_rpc_time)) return; + min_rpc_time = future_time; + possibly_backed_off = true; + if (log_flags.sched_op_debug) { + msg_printf(this, MSG_INFO, + "[sched_op_debug] Deferring communication for %s", + timediff_format(min_rpc_time - gstate.now).c_str() + ); + msg_printf(this, MSG_INFO, "[sched_op_debug] Reason: %s\n", reason); + } +} + +// Return true if we should not contact the project yet. +// +bool PROJECT::waiting_until_min_rpc_time() { + return (min_rpc_time > gstate.now); +} + +// find a project that needs to have its master file fetched +// +PROJECT* CLIENT_STATE::next_project_master_pending() { + unsigned int i; + PROJECT* p; + + for (i=0; iwaiting_until_min_rpc_time()) continue; + if (p->suspended_via_gui) continue; + if (p->master_url_fetch_pending) { + return p; + } + } + return 0; +} + +// find a project for which a scheduler RPC is pending +// +PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() { + unsigned int i; + PROJECT* p; + + for (i=0; inext_rpc_time && p->next_rpc_timesched_rpc_pending = RPC_REASON_PROJECT_REQ; + p->next_rpc_time = 0; + } else { + if (p->waiting_until_min_rpc_time()) continue; + } + // if (p->suspended_via_gui) continue; + // do the RPC even if suspended. + // This is critical for acct mgrs, to propagate new host CPIDs + // + if (p->sched_rpc_pending) { + return p; + } + } + return 0; +} + +PROJECT* CLIENT_STATE::next_project_trickle_up_pending() { + unsigned int i; + PROJECT* p; + + for (i=0; iwaiting_until_min_rpc_time()) continue; + if (p->suspended_via_gui) continue; + if (p->trickle_up_pending) { + return p; + } + } + return 0; +} + +// find a project with finished results that should be reported. +// This means: +// - we're not backing off contacting the project +// - the result is ready_to_report (compute done; files uploaded) +// - we're within a day of the report deadline, +// or at least a day has elapsed since the result was completed, +// or we have a sporadic connection +// +PROJECT* CLIENT_STATE::find_project_with_overdue_results() { + unsigned int i; + RESULT* r; + + for (i=0; iready_to_report) continue; + + PROJECT* p = r->project; + if (p->waiting_until_min_rpc_time()) continue; + if (p->suspended_via_gui) continue; + + if (config.report_results_immediately) { + return p; + } + + if (net_status.have_sporadic_connection) { + return p; + } + + double cushion = std::max(REPORT_DEADLINE_CUSHION, work_buf_min()); + if (gstate.now > r->report_deadline - cushion) { + return p; + } + + if (gstate.now > r->completed_time + SECONDS_PER_DAY) { + return p; + } + } + return 0; +} + const char *BOINC_RCSID_d35a4a7711 = "$Id$"; diff --git a/client/makefile_sim b/client/makefile_sim index 4a0529f82c..334d5f3679 100644 --- a/client/makefile_sim +++ b/client/makefile_sim @@ -6,13 +6,15 @@ OBJS = \ app.o \ client_msgs.o \ cs_apps.o \ + cs_scheduler.o \ cpu_sched.o \ log_flags.o \ + rr_sim.o \ sim.o \ sim_util.o \ time_stats.o \ work_fetch.o \ - edf_sim.o \ + ../sched/edf_sim.o \ ../lib/coproc.o \ ../lib/mfile.o \ ../lib/miofile.o \ diff --git a/client/sim.h b/client/sim.h index 61e53ab778..9c4a00bc05 100644 --- a/client/sim.h +++ b/client/sim.h @@ -306,4 +306,4 @@ extern bool work_fetch_old; #define CPU_PESSIMISM_FACTOR 0.9 // assume actual CPU utilization will be this multiple - // of what we've actually measured recently \ No newline at end of file + // of what we've actually measured recently diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index b3fb1754d4..a08a45ed06 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -56,14 +56,6 @@ using std::max; using std::vector; using std::string; -// quantities like avg CPU time decay by a factor of e every week -// -#define EXP_DECAY_RATE (1./(SECONDS_PER_DAY*7)) - -// try to report results this much before their deadline -// -#define REPORT_DEADLINE_CUSHION ((double)SECONDS_PER_DAY) - static const char* urgency_name(int urgency) { switch(urgency) { case WORK_FETCH_DONT_NEED: return "Don't need"; @@ -85,97 +77,6 @@ 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, const char* reason) { - if (future_time <= min_rpc_time) return; - if (next_rpc_time && (future_time > next_rpc_time)) return; - min_rpc_time = future_time; - possibly_backed_off = true; - if (log_flags.sched_op_debug) { - msg_printf(this, MSG_INFO, - "[sched_op_debug] Deferring communication for %s", - timediff_format(min_rpc_time - gstate.now).c_str() - ); - msg_printf(this, MSG_INFO, "[sched_op_debug] Reason: %s\n", reason); - } -} - -// Return true if we should not contact the project yet. -// -bool PROJECT::waiting_until_min_rpc_time() { - return (min_rpc_time > gstate.now); -} - -// find a project that needs to have its master file fetched -// -PROJECT* CLIENT_STATE::next_project_master_pending() { - unsigned int i; - PROJECT* p; - - for (i=0; iwaiting_until_min_rpc_time()) continue; - if (p->suspended_via_gui) continue; - if (p->master_url_fetch_pending) { - return p; - } - } - return 0; -} - -// find a project for which a scheduler RPC is pending -// -PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() { - unsigned int i; - PROJECT* p; - - for (i=0; inext_rpc_time && p->next_rpc_timesched_rpc_pending = RPC_REASON_PROJECT_REQ; - p->next_rpc_time = 0; - } else { - if (p->waiting_until_min_rpc_time()) continue; - } - // if (p->suspended_via_gui) continue; - // do the RPC even if suspended. - // This is critical for acct mgrs, to propagate new host CPIDs - // - if (p->sched_rpc_pending) { - return p; - } - } - return 0; -} - -PROJECT* CLIENT_STATE::next_project_trickle_up_pending() { - unsigned int i; - PROJECT* p; - - for (i=0; iwaiting_until_min_rpc_time()) continue; - if (p->suspended_via_gui) continue; - if (p->trickle_up_pending) { - return p; - } - } - return 0; -} - // Return the best project to fetch work from, NULL if none // // Pick the one with largest (long term debt - amount of current work) @@ -237,46 +138,6 @@ PROJECT* CLIENT_STATE::next_project_need_work() { return p_prospect; } -// find a project with finished results that should be reported. -// This means: -// - we're not backing off contacting the project -// - the result is ready_to_report (compute done; files uploaded) -// - we're within a day of the report deadline, -// or at least a day has elapsed since the result was completed, -// or we have a sporadic connection -// -PROJECT* CLIENT_STATE::find_project_with_overdue_results() { - unsigned int i; - RESULT* r; - - for (i=0; iready_to_report) continue; - - PROJECT* p = r->project; - if (p->waiting_until_min_rpc_time()) continue; - if (p->suspended_via_gui) continue; - - if (config.report_results_immediately) { - return p; - } - - if (net_status.have_sporadic_connection) { - return p; - } - - double cushion = std::max(REPORT_DEADLINE_CUSHION, work_buf_min()); - if (gstate.now > r->report_deadline - cushion) { - return p; - } - - if (gstate.now > r->completed_time + SECONDS_PER_DAY) { - return p; - } - } - return 0; -} - // the fraction of time a given CPU is working for BOINC // double CLIENT_STATE::overall_cpu_frac() { diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 6cfd1af030..4487b318c5 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -880,7 +880,7 @@ bool work_needed(bool locality_sched) { if (g_wreq->nresults_on_host >= config.max_wus_in_progress*ncpus) { if (config.debug_send) { log_messages.printf(MSG_DEBUG, - "in-progress job limit exceeded; %d > %d*%d\n", + "in-progress job limit exceeded; %d >= %d*%d\n", g_wreq->nresults_on_host, config.max_wus_in_progress, ncpus ); }