- client: code shuffling

- scheduler: fix typo in msg

svn path=/trunk/boinc/; revision=16750
This commit is contained in:
David Anderson 2008-12-30 19:01:25 +00:00
parent 209d519fc4
commit 2dc7056ee0
6 changed files with 151 additions and 142 deletions

View File

@ -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

View File

@ -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; i<projects.size(); i++) {
PROJECT* p = projects[i];
if (p->possibly_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; i<projects.size(); i++) {
p = projects[i];
if (p->waiting_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; i<projects.size(); i++) {
p = projects[i];
// project request overrides backoff
//
if (p->next_rpc_time && p->next_rpc_time<now) {
p->sched_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; i<projects.size(); i++) {
p = projects[i];
if (p->waiting_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; i<results.size(); i++) {
r = results[i];
if (!r->ready_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$";

View File

@ -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 \

View File

@ -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
// of what we've actually measured recently

View File

@ -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; i<projects.size(); i++) {
PROJECT* p = projects[i];
if (p->possibly_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; i<projects.size(); i++) {
p = projects[i];
if (p->waiting_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; i<projects.size(); i++) {
p = projects[i];
// project request overrides backoff
//
if (p->next_rpc_time && p->next_rpc_time<now) {
p->sched_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; i<projects.size(); i++) {
p = projects[i];
if (p->waiting_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; i<results.size(); i++) {
r = results[i];
if (!r->ready_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() {

View File

@ -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
);
}