- client: fix bug related to deselecting resource types in project prefs.

Some logic was missing.

svn path=/trunk/boinc/; revision=23825
This commit is contained in:
David Anderson 2011-07-08 19:22:22 +00:00
parent 18f8847adb
commit 13cfc73b3c
5 changed files with 73 additions and 58 deletions

View File

@ -3217,15 +3217,15 @@ David 31 May 2011
app_control.cpp
David 31 May 2011
- web: add counts in task list pages
- web: add counts in task list pages
html/
inc/
boinc_db.inc
util.inc
result.inc
user/
results.php
html/
inc/
boinc_db.inc
util.inc
result.inc
user/
results.php
Charlie 2 Jun 2011
- MGR: Add SQLite3 v3.7.6.3 source code to Mac XCode project, adding
@ -3543,7 +3543,7 @@ Rom 15 Jun 2011
blankicon.xpm
David 15 Jun 2011
- manager: tweaks to project list
- manager: tweaks to project list
clientgui/
ProjectInfoPage.cpp
@ -3663,17 +3663,17 @@ Charlie 20 Jun 2011
client_state.cpp
David 21 Jun 2011
- GUI RPC: restore <have_cuda>, <have_ati> elements in CC_STATE
- GUI RPC: restore <have_cuda>, <have_ati> elements in CC_STATE
for compatibility
- client: copy coprocs to host_info._coprocs at startup
(else GUI RPCs don't have right info)
- client: copy coprocs to host_info._coprocs at startup
(else GUI RPCs don't have right info)
client/
client_state.cpp
cs_statefile.cpp
lib/
gui_rpc_client.h
gui_rpc_client_ops.cpp
client/
client_state.cpp
cs_statefile.cpp
lib/
gui_rpc_client.h
gui_rpc_client_ops.cpp
David 21 Jun 2011
- web: add a web-service interface for remotely submitting, querying
@ -3968,3 +3968,12 @@ Charlie 8 July 2011
BOINCTaskBar.cpp
mac/
MacSysMenu.cpp, .h
David 8 July 2011
- client: fix bug related to deselecting resource types in project prefs.
Some logic was missing.
client/
client_types.cpp,h
cs_account.cpp
work_fetch.cpp

View File

@ -140,16 +140,22 @@ void PROJECT::init() {
#endif
}
void PROJECT::handle_no_rsc_ams(const char* name, bool value) {
static void handle_no_rsc_ams(PROJECT* p, const char* name) {
int i = rsc_index(name);
if (i < 0) return;
no_rsc_ams[i] = value;
p->no_rsc_ams[i] = true;
}
void PROJECT::handle_no_rsc_apps(const char* name, bool value) {
static void handle_no_rsc_pref(PROJECT* p, const char* name) {
int i = rsc_index(name);
if (i<0) return;
p->no_rsc_pref[i] = true;
}
static void handle_no_rsc_apps(PROJECT* p, const char* name) {
int i = rsc_index(name);
if (i < 0) return;
no_rsc_apps[i] = value;
p->no_rsc_apps[i] = true;
}
static bool parse_rsc_param(MIOFILE& in, const char* end_tag, int& rsc_type, double& value) {
@ -283,37 +289,40 @@ int PROJECT::parse_state(MIOFILE& in) {
if (parse_double(buf, "<duration_correction_factor>", duration_correction_factor)) continue;
if (parse_bool(buf, "attached_via_acct_mgr", attached_via_acct_mgr)) continue;
if (parse_bool(buf, "no_cpu_apps", btemp)) {
handle_no_rsc_apps("CPU", btemp);
if (btemp) handle_no_rsc_apps(this, "CPU");
continue;
}
if (parse_bool(buf, "no_cuda_apps", btemp)) {
handle_no_rsc_apps("NVIDIA", btemp);
if (btemp) handle_no_rsc_apps(this, "NVIDIA");
continue;
}
if (parse_bool(buf, "no_ati_apps", btemp)) {
handle_no_rsc_apps("ATI", btemp);
if (btemp) handle_no_rsc_apps(this, "ATI");
continue;
}
if (parse_str(buf, "<no_rsc_apps>", buf, sizeof(buf))) {
handle_no_rsc_apps(buf, true);
handle_no_rsc_apps(this, buf);
continue;
}
if (parse_bool(buf, "no_cpu_ams", btemp)) {
handle_no_rsc_ams("CPU", btemp);
if (btemp) handle_no_rsc_ams(this, "CPU");
continue;
}
if (parse_bool(buf, "no_cuda_ams", btemp)) {
handle_no_rsc_ams("NVIDIA", btemp);
if (btemp) handle_no_rsc_ams(this, "NVIDIA");
continue;
}
if (parse_bool(buf, "no_ati_ams", btemp)) {
handle_no_rsc_ams("ATI", btemp);
if (btemp) handle_no_rsc_ams(this, "ATI");
continue;
}
if (parse_str(buf, "<no_rsc_ams>", buf, sizeof(buf))) {
handle_no_rsc_ams(buf, true);
handle_no_rsc_ams(this, buf);
continue;
}
if (parse_str(buf, "<no_rsc_pref>", buf, sizeof(buf))) {
handle_no_rsc_pref(this, buf);
}
// backwards compat - old state files had ams_resource_share = 0
if (parse_double(buf, "<ams_resource_share_new>", ams_resource_share)) continue;
@ -459,6 +468,9 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
if (no_rsc_apps[j]) {
out.printf(" <no_rsc_apps>%s</no_rsc_apps>\n", rsc_name(j));
}
if (no_rsc_pref[j]) {
out.printf(" <no_rsc_pref>%s</no_rsc_pref>\n", rsc_name(j));
}
}
if (ams_resource_share >= 0) {
out.printf(" <ams_resource_share_new>%f</ams_resource_share_new>\n",
@ -485,11 +497,6 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
upload_backoff.next_xfer_time - gstate.now
);
}
for (int j=0; j<coprocs.n_rsc; j++) {
if (no_rsc_pref[j]) {
out.printf(" <no_rsc_pref>%s</no_rsc_pref>\n", rsc_name(j));
}
}
if (strlen(host_venue)) {
out.printf(" <venue>%s</venue>\n", host_venue);
}

View File

@ -446,9 +446,6 @@ struct PROJECT : PROJ_AM {
int parse_account_file();
int parse_state(MIOFILE&);
int write_state(MIOFILE&, bool gui_rpc=false);
void handle_no_rsc_ams(const char*, bool);
void handle_no_rsc_apps(const char*, bool);
void handle_no_rsc_pref(const char*, bool);
// statistic of the last x days
std::vector<DAILY_STATS> statistics;

View File

@ -85,10 +85,10 @@ int PROJECT::write_account_file() {
return 0;
}
void PROJECT::handle_no_rsc_pref(const char* name, bool value) {
void handle_no_rsc_pref(PROJECT* p, const char* name) {
int i = rsc_index(name);
if (i < 0) return;
no_rsc_pref[i] = value;
p->no_rsc_pref[i] = true;
}
// parse an account_*.xml file, ignoring <venue> elements
@ -127,19 +127,19 @@ int PROJECT::parse_account(FILE* in) {
} else if (parse_str(buf, "<authenticator>", authenticator, sizeof(authenticator))) continue;
else if (parse_double(buf, "<resource_share>", resource_share)) continue;
else if (parse_bool(buf, "no_cpu", btemp)) {
handle_no_rsc_pref("CPU", btemp);
if (btemp) handle_no_rsc_pref(this, "CPU");
continue;
}
else if (parse_bool(buf, "no_cuda", btemp)) {
handle_no_rsc_pref("NVIDIA", btemp);
if (btemp) handle_no_rsc_pref(this, "NVIDIA");
continue;
}
else if (parse_bool(buf, "no_ati", btemp)) {
handle_no_rsc_pref("ATI", btemp);
if (btemp) handle_no_rsc_pref(this, "ATI");
continue;
}
else if (parse_str(buf, "no_rsc", buf2, sizeof(buf2))) {
handle_no_rsc_pref(buf2, true);
handle_no_rsc_pref(this, buf2);
continue;
}
else if (parse_str(buf, "<project_name>", project_name, sizeof(project_name))) continue;
@ -223,19 +223,19 @@ int PROJECT::parse_account_file_venue() {
continue;
}
else if (parse_bool(buf, "no_cpu", btemp)) {
handle_no_rsc_pref("CPU", btemp);
if (btemp) handle_no_rsc_pref(this, "CPU");
continue;
}
else if (parse_bool(buf, "no_cuda", btemp)) {
handle_no_rsc_pref("NVIDIA", btemp);
if (btemp) handle_no_rsc_pref(this, "NVIDIA");
continue;
}
else if (parse_bool(buf, "no_ati", btemp)) {
handle_no_rsc_pref("ATI", btemp);
if (btemp) handle_no_rsc_pref(this, "ATI");
continue;
}
else if (parse_str(buf, "no_rsc", buf2, sizeof(buf2))) {
handle_no_rsc_pref(buf2, true);
handle_no_rsc_pref(this, buf2);
continue;
}
else {

View File

@ -68,6 +68,7 @@ static const char* criterion_name(int criterion) {
inline bool dont_fetch(PROJECT* p, int rsc_type) {
if (p->no_rsc_pref[rsc_type]) return true;
if (p->no_rsc_apps[rsc_type]) return true;
if (p->no_rsc_ams[rsc_type]) return true;
return false;
}
@ -97,8 +98,7 @@ inline bool has_coproc_app(PROJECT* p, int rsc_type) {
/////////////// RSC_PROJECT_WORK_FETCH ///////////////
bool RSC_PROJECT_WORK_FETCH::compute_may_have_work(PROJECT* p, int rsc_type) {
if (p->no_rsc_pref[rsc_type]) return false;
if (p->no_rsc_apps[rsc_type]) return false;
if (dont_fetch(p, rsc_type)) return false;
if (p->rsc_defer_sched[rsc_type]) return false;
return (backoff_time < gstate.now);
}
@ -370,6 +370,8 @@ if (use_rec) {
// don't request anything if project is overworked or backed off.
//
void RSC_WORK_FETCH::set_request(PROJECT* p, bool allow_overworked) {
if (dont_fetch(p, rsc_type)) return;
// if backup project, fetch 1 job per idle instance
//
if (p->resource_share == 0) {
@ -429,14 +431,13 @@ void RSC_WORK_FETCH::print_state(const char* name) {
PROJECT* p = gstate.projects[i];
if (p->non_cpu_intensive) continue;
RSC_PROJECT_WORK_FETCH& pwf = project_state(p);
bool blocked_by_prefs = false, no_apps = false;
if (p->no_rsc_pref[rsc_type]) blocked_by_prefs = true;
if (p->no_rsc_apps[rsc_type]) no_apps = true;
bool no_rsc_pref = p->no_rsc_pref[rsc_type];
bool no_rsc_apps = p->no_rsc_apps[rsc_type];
bool no_rsc_ams = p->no_rsc_ams[rsc_type];
double bt = pwf.backoff_time>gstate.now?pwf.backoff_time-gstate.now:0;
if (use_rec) {
msg_printf(p, MSG_INFO,
"[work_fetch] %s: fetch share %.2f rec %.5f prio %.5f backoff dt %.2f int %.2f%s%s%s%s%s%s%s",
"[work_fetch] %s: fetch share %.2f rec %.5f prio %.5f backoff dt %.2f int %.2f%s%s%s%s%s%s%s%s",
name,
pwf.fetchable_share, p->pwf.rec, project_priority(p), bt, pwf.backoff_interval,
p->suspended_via_gui?" (susp via GUI)":"",
@ -444,8 +445,9 @@ if (use_rec) {
p->min_rpc_time > gstate.now?" (comm deferred)":"",
p->dont_request_more_work?" (no new tasks)":"",
p->too_many_uploading_results?" (too many uploads)":"",
blocked_by_prefs?" (blocked by prefs)":"",
no_apps?" (no apps)":""
no_rsc_pref?" (blocked by prefs)":"",
no_rsc_apps?" (no apps)":"",
no_rsc_ams?" (blocked by account manager)":""
);
} else {
msg_printf(p, MSG_INFO,
@ -458,7 +460,7 @@ if (use_rec) {
p->dont_request_more_work?" (no new tasks)":"",
pwf.overworked()?" (overworked)":"",
p->too_many_uploading_results?" (too many uploads)":"",
blocked_by_prefs?" (blocked by prefs)":""
no_rsc_pref?" (blocked by prefs)":""
);
}
}