client: message tweak (show "don't need" in work request msg)

This commit is contained in:
David Anderson 2013-04-26 12:19:43 -07:00
parent 984883d7c5
commit c00f27a5a5
3 changed files with 16 additions and 12 deletions

View File

@ -508,13 +508,6 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
return false;
}
static inline bool requested_work() {
for (int i=0; i<coprocs.n_rsc; i++) {
if (rsc_work_fetch[i].req_secs) return true;
}
return false;
}
// Handle the reply from a scheduler
//
int CLIENT_STATE::handle_scheduler_reply(
@ -532,7 +525,7 @@ int CLIENT_STATE::handle_scheduler_reply(
project->last_rpc_time = now;
if (requested_work()) {
if (work_fetch.requested_work()) {
had_or_requested_work = true;
}
@ -545,7 +538,7 @@ int CLIENT_STATE::handle_scheduler_reply(
if (retval) return retval;
if (log_flags.sched_ops) {
if (requested_work()) {
if (work_fetch.requested_work()) {
sprintf(buf, ": got %d new tasks", (int)sr.results.size());
} else {
strcpy(buf, "");

View File

@ -452,6 +452,13 @@ void WORK_FETCH::clear_request() {
}
}
bool WORK_FETCH::requested_work() {
for (int i=0; i<coprocs.n_rsc; i++) {
if (rsc_work_fetch[i].req_secs) return true;
}
return false;
}
// we're going to contact this project for reasons other than work fetch;
// decide if we should piggy-back a work fetch request.
//
@ -518,6 +525,9 @@ void WORK_FETCH::piggyback_work_request(PROJECT* p) {
rwf.set_request_excluded(p);
}
}
if (!requested_work()) {
p->pwf.cant_fetch_work_reason = CANT_FETCH_WORK_DONT_NEED;
}
}
// see if there's a fetchable non-CPU-intensive project without work
@ -858,10 +868,10 @@ void WORK_FETCH::handle_reply(
PROJECT* p, SCHEDULER_REPLY*, vector<RESULT*> new_results
) {
bool got_work[MAX_RSC];
bool requested_work[MAX_RSC];
bool requested_work_rsc[MAX_RSC];
for (int i=0; i<coprocs.n_rsc; i++) {
got_work[i] = false;
requested_work[i] = (rsc_work_fetch[i].req_secs > 0);
requested_work_rsc[i] = (rsc_work_fetch[i].req_secs > 0);
}
for (unsigned int i=0; i<new_results.size(); i++) {
RESULT* rp = new_results[i];
@ -877,7 +887,7 @@ void WORK_FETCH::handle_reply(
// - the RPC was done for a reason that is automatic
// and potentially frequent
//
if (requested_work[i] && !got_work[i]) {
if (requested_work_rsc[i] && !got_work[i]) {
if (p->rsc_pwf[i].backoff_time < gstate.now) {
switch (p->sched_rpc_pending) {
case RPC_REASON_RESULTS_DUE:

View File

@ -317,6 +317,7 @@ struct WORK_FETCH {
void compute_shares();
void clear_backoffs(APP_VERSION&);
void request_string(char*);
bool requested_work();
};
extern RSC_WORK_FETCH rsc_work_fetch[MAX_RSC];