From 6835cdac201c05a3ddd6897f321f184f4b198e69 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 4 Oct 2006 17:01:36 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11244 --- checkin_notes | 15 ++++++++++ doc/source/index.html | 14 ---------- lib/parse.C | 20 +++++++++++--- sched/sched_send.C | 64 +++++++++++++++++++++++++++++++------------ sched/server_types.C | 12 +++++--- sched/server_types.h | 2 ++ 6 files changed, 88 insertions(+), 39 deletions(-) delete mode 100644 doc/source/index.html diff --git a/checkin_notes b/checkin_notes index e18e8cd8bc..ae1884919d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -10783,3 +10783,18 @@ Charlie 4 Oct 2006 mac_build/ boinc.xcodeproj/ project.pbxproj + +David 4 Oct 2006 + - scheduler: if request has RAM usage limits preferences, + take them into account in deciding whether to send work. + Return appropriate message depending on whether + 1) machine doesn't have enough RAM period, or + 2) machine has enough RAM, but limits are too low + - XML parser: fix bug where empty string () + wasn't being parsed correctly + + lib/ + parse.C + sched/ + sched_send.C + server_types.C,h diff --git a/doc/source/index.html b/doc/source/index.html deleted file mode 100644 index 03daf934f9..0000000000 --- a/doc/source/index.html +++ /dev/null @@ -1,14 +0,0 @@ -

BOINC source code - snapshots

- -

-Snapshots of the BOINC source code are available here -in .tar.gz and .zip formats. -

-Use of BOINC source code is subject to the -Lesser GNU Public License. -

diff --git a/lib/parse.C b/lib/parse.C index 94a0e29a15..b824692e2f 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -498,7 +498,7 @@ bool XML_PARSER::parse_str( char* parsed_tag, char* start_tag, char* buf, int len ) { bool is_tag, eof; - char end_tag[256], tag[256]; + char end_tag[256], tag[256], tmp[64000]; // handle the archaic form , which means empty string // @@ -509,17 +509,29 @@ bool XML_PARSER::parse_str( return true; } + // check for start tag + // if (strcmp(parsed_tag, start_tag)) return false; - eof = get(buf, len, is_tag); - if (eof) return false; - if (is_tag) return false; end_tag[0] = '/'; strcpy(end_tag+1, start_tag); + + // get text after start tag + // + eof = get(tmp, 64000, is_tag); + if (eof) return false; + + // if it's the end tag, return empty string + // + if (is_tag) { + return !strcmp(tag, end_tag); + } + eof = get(tag, sizeof(tag), is_tag); if (eof) return false; if (!is_tag) return false; if (strcmp(tag, end_tag)) return false; + strlcpy(buf, tmp, len); return true; } diff --git a/sched/sched_send.C b/sched/sched_send.C index ddbf9a9ba8..8fc8085111 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -56,7 +56,8 @@ using namespace std; const int MIN_SECONDS_TO_SEND = 0; const int MAX_SECONDS_TO_SEND = (28*SECONDS_IN_DAY); -const double MIN_POSSIBLE_RAM = 64000000; +const double DEFAULT_RAM_SIZE = 64000000; + // if host sends us an impossible RAM size, use this instead bool anonymous(PLATFORM& platform) { return (!strcmp(platform.name, "anonymous")); @@ -244,7 +245,12 @@ static double estimate_wallclock_duration( return ewd; } -int find_allowed_projects(SCHEDULER_REPLY& reply, std::vector *app_ids) { +// scan user's project prefs for elements of the form N, +// indicating the apps they want to run. +// +static int find_allowed_apps( + SCHEDULER_REPLY& reply, std::vector *app_ids +) { char buf[8096]; std::string str; extract_venue(reply.user.project_prefs, reply.host.venue, buf); @@ -264,6 +270,7 @@ int find_allowed_projects(SCHEDULER_REPLY& reply, std::vector *app_ids) { // 2) the host doesn't have enough disk space; // 3) based on CPU speed, resource share and estimated delay, // the host probably won't get the result done within the delay bound +// 4) app isn't in user's "approved apps" list // // NOTE: This is a "fast" check; no DB access allowed. // In particular it doesn't enforce the one-result-per-user-per-wu rule @@ -276,8 +283,10 @@ int wu_is_infeasible( // Check to see if the user has set application preferences. // If they have then only send work for the allowed applications + // TODO: call find_allowed_apps() only once, not once for each WU!! + // std::vector app_ids; - find_allowed_projects(reply, &app_ids); + find_allowed_apps(reply, &app_ids); if (app_ids.size() > 0) { bool app_allowed = false; for(i=0; i0 && idle_frac>0) { + frac = std::max(busy_frac, idle_frac); + if (frac > 1) frac = 1; + usable_ram *= frac; + } - double m_nbytes = reply.host.m_nbytes; - if (m_nbytes < MIN_POSSIBLE_RAM) m_nbytes = MIN_POSSIBLE_RAM; - - if (wu.rsc_memory_bound > m_nbytes) { + if (wu.rsc_memory_bound > usable_ram) { log_messages.printf( SCHED_MSG_LOG::MSG_DEBUG, - "[WU#%d %s] needs %f mem; [HOST#%d] has %f\n", - wu.id, wu.name, wu.rsc_memory_bound, reply.host.id, m_nbytes + "[WU#%d %s] needs %0.2fMB RAM; [HOST#%d] has %0.2fMB, %0.2fMB usable\n", + wu.id, wu.name, wu.rsc_memory_bound/MEGA, + reply.host.id, ram/MEGA, usable_ram/MEGA ); - char explanation[256]; + // only add message once + // if (!reply.wreq.insufficient_mem) { - // only add message once - // - sprintf(explanation, - "Your computer has only %.0f bytes of memory; workunit requires %.0f more bytes", - m_nbytes, wu.rsc_memory_bound-m_nbytes - ); + char explanation[256]; + if (wu.rsc_memory_bound > ram) { + sprintf(explanation, + "Your computer has %0.2fMB of memory, and a job requires %0.2fMB", + ram/MEGA, wu.rsc_memory_bound/MEGA + ); + } else { + sprintf(explanation, + "Your preferences limit memory usage to %0.2fMB, and a job requires %0.2fMB", + usable_ram/MEGA, wu.rsc_memory_bound/MEGA + ); + } USER_MESSAGE um(explanation, "high"); reply.insert_message(um); } diff --git a/sched/server_types.C b/sched/server_types.C index 9b6a29f961..fb388d7647 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -861,17 +861,21 @@ int HOST::parse_disk_usage(FILE* fin) { void GLOBAL_PREFS::parse(char* buf, char* venue) { char buf2[LARGE_BLOB_SIZE]; + double dtemp; - disk_max_used_gb = 0; - disk_max_used_pct = 0; - disk_min_free_gb = 0; - work_buf_min_days = 0; + memset(this, 0, sizeof(GLOBAL_PREFS)); extract_venue(buf, venue, buf2); parse_double(buf2, "", disk_max_used_gb); parse_double(buf2, "", disk_max_used_pct); parse_double(buf2, "", disk_min_free_gb); parse_double(buf2, "", work_buf_min_days); + if (parse_double(buf2, "", dtemp)) { + ram_max_used_busy_frac = dtemp/100.; + } + if (parse_double(buf2, "", dtemp)) { + ram_max_used_idle_frac = dtemp/100.; + } } void GUI_URLS::init() { diff --git a/sched/server_types.h b/sched/server_types.h index 8de01d3be4..56485e53ce 100644 --- a/sched/server_types.h +++ b/sched/server_types.h @@ -84,6 +84,8 @@ struct GLOBAL_PREFS { double disk_max_used_pct; double disk_min_free_gb; double work_buf_min_days; + double ram_max_used_busy_frac; + double ram_max_used_idle_frac; void parse(char* buf, char* venue); };