From fbc6e40dca8c4facd1e35a9daf0fefc4483e16e0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 17 Nov 2014 13:56:06 -0800 Subject: [PATCH] Client: fix bug that prevented work fetch for zero-share projects In work fetch setup, we were computing rsc_project_reason before doing the round-robin simulation. It needs to be done after, because it uses the # of idle devices, which is computed by the simulation. --- client/work_fetch.cpp | 22 +++++++++++++++++----- client/work_fetch.h | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 5d7c33b83e..07c6f3e14f 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -72,8 +72,7 @@ inline bool has_coproc_app(PROJECT* p, int rsc_type) { /////////////// RSC_PROJECT_WORK_FETCH /////////////// -void RSC_PROJECT_WORK_FETCH::rr_init(PROJECT* p, int rsc_type) { - rsc_project_reason = compute_rsc_project_reason(p, rsc_type); +void RSC_PROJECT_WORK_FETCH::rr_init() { fetchable_share = 0; n_runnable_jobs = 0; sim_nused = 0; @@ -397,7 +396,7 @@ void WORK_FETCH::rr_init() { PROJECT* p = gstate.projects[i]; p->pwf.rr_init(p); for (int j=0; jrsc_pwf[j].rr_init(p, j); + p->rsc_pwf[j].rr_init(); } } } @@ -588,6 +587,19 @@ void WORK_FETCH::setup() { gstate.compute_nuploading_results(); rr_simulation(); + + // Compute rsc_project_reason. + // Must do this after rr_simulation() because the logic for + // zero-resource-share projects uses #idle instances + // + for (unsigned int i=0; irsc_pwf[j]; + rpwf.rsc_project_reason = rpwf.compute_rsc_project_reason(p, j); + } + } + compute_shares(); project_priority_init(true); clear_request(); @@ -649,7 +661,7 @@ PROJECT* WORK_FETCH::choose_project() { p = gstate.projects[j]; WF_DEBUG(msg_printf(p, MSG_INFO, "scanning");) if (p->pwf.project_reason) { - WF_DEBUG(msg_printf(p, MSG_INFO, "skip: cfwr %d", p->pwf.cant_fetch_work_reason);) + WF_DEBUG(msg_printf(p, MSG_INFO, "skip: cfwr %d", p->pwf.project_reason);) continue; } @@ -671,7 +683,7 @@ PROJECT* WORK_FETCH::choose_project() { } WF_DEBUG(msg_printf(p, MSG_INFO, "can fetch %s", rsc_name_long(i));) } else { - WF_DEBUG(msg_printf(p, MSG_INFO, "can't fetch %s", rsc_name_long(i));) + WF_DEBUG(msg_printf(p, MSG_INFO, "can't fetch %s: %s", rsc_name_long(i), rsc_project_reason_string(rpwf.rsc_project_reason));) continue; } if (rwf.saturated_time < gstate.work_buf_min()) { diff --git a/client/work_fetch.h b/client/work_fetch.h index c99e9ba69a..6c8a3fadcb 100644 --- a/client/work_fetch.h +++ b/client/work_fetch.h @@ -127,7 +127,7 @@ struct RSC_PROJECT_WORK_FETCH { int rsc_project_reason; int compute_rsc_project_reason(PROJECT*, int rsc_type); void resource_backoff(PROJECT*, const char*); - void rr_init(PROJECT*, int rsc_type); + void rr_init(); void clear_backoff() { backoff_time = 0; backoff_interval = 0;