- client: fetch work from non-CPU-intensive projects

svn path=/trunk/boinc/; revision=16969
This commit is contained in:
David Anderson 2009-01-21 20:28:00 +00:00
parent 350f62223f
commit 28bc319055
3 changed files with 34 additions and 0 deletions

View File

@ -532,3 +532,9 @@ David 21 Jan 2009
sched/
sched_plan.cpp
David 21 Jan 2009
- client: fetch work from non-CPU-intensive projects
client/
work_fetch.cpp,h

View File

@ -207,12 +207,39 @@ void WORK_FETCH::compute_work_request(PROJECT* p) {
clear_request();
}
// see if there's a fetchable non-CPU-intensive project without work
//
PROJECT* WORK_FETCH::non_cpu_intensive_project_needing_work() {
for (unsigned int i=0; i<gstate.projects.size(); i++) {
PROJECT* p = gstate.projects[i];
if (!p->non_cpu_intensive) continue;
if (!p->can_request_work()) continue;
bool has_work = false;
for (unsigned int j=0; j<gstate.results.size(); j++) {
RESULT* rp = gstate.results[j];
if (rp->project == p) {
has_work = true;
break;
}
}
if (!has_work) {
clear_request();
cpu_work_fetch.req_secs = 1;
return p;
}
}
return 0;
}
// choose a project to fetch work from,
// and set the request fields of resource objects
//
PROJECT* WORK_FETCH::choose_project() {
PROJECT* p = 0;
p = non_cpu_intensive_project_needing_work();
if (p) return p;
gstate.adjust_debts();
gstate.compute_nuploading_results();

View File

@ -126,6 +126,7 @@ struct WORK_FETCH {
void set_overall_debts();
PROJECT* choose_project();
// find a project to ask for work
PROJECT* WORK_FETCH::non_cpu_intensive_project_needing_work();
void compute_work_request(PROJECT*);
// we're going to contact this project anyway;
// decide how much work to task for