- scheduler: improve no-work messages

- web: don't use DB conn in mysql_real_escape_string()
    (otherwise won't work if DB is down)

svn path=/trunk/boinc/; revision=16961
This commit is contained in:
David Anderson 2009-01-20 21:31:13 +00:00
parent f33631cbbc
commit 50405c89e3
7 changed files with 111 additions and 36 deletions

View File

@ -449,7 +449,7 @@ Eric 15 Jan 2009
Makefile.am Makefile.am
samples/ samples/
example_app/ example_app/
Makefile Makefile
Charlie Jan 15 2009 Charlie Jan 15 2009
- client: boinc_copy ownership fix of 1/6/09 didn't work because it used - client: boinc_copy ownership fix of 1/6/09 didn't work because it used
@ -501,8 +501,21 @@ David 19 Jan 2009
server_types.h server_types.h
David 20 Jan 2009 David 20 Jan 2009
- client: fix messages - client: fix messages
client/ client/
rr_sim.cpp rr_sim.cpp
work_fetch.cpp work_fetch.cpp
David 20 Jan 2009
- scheduler: improve no-work messages
- web: don't use DB conn in mysql_real_escape_string()
(otherwise won't work if DB is down)
html/inc/
boinc_db.inc
db_conn.inc
sched/
sched_plan.cpp.h
sched_send.cpp
server_types.h

View File

@ -50,8 +50,7 @@ class BoincDb extends DbConn {
return $instance; return $instance;
} }
static function escape_string($string) { static function escape_string($string) {
$db = self::get(); return parent::base_escape_string(trim($string));
return $db->base_escape_string(trim($string));
} }
static function error() { static function error() {
$db = self::get(); $db = self::get();

View File

@ -148,7 +148,7 @@ class DbConn {
return $this->do_query($query); return $this->do_query($query);
} }
function base_escape_string($string) { function base_escape_string($string) {
return mysql_real_escape_string($string, $this->db_conn); return mysql_real_escape_string($string);
} }
function base_error() { function base_error() {
return mysql_error($this->db_conn); return mysql_error($this->db_conn);

View File

@ -42,13 +42,12 @@ static void get_ncpus(SCHEDULER_REQUEST& sreq, int& ncpus, bool& bounded) {
} }
} }
bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
if (!strcmp(plan_class, "mt")) { if (!strcmp(plan_class, "mt")) {
// the following is for an app that can use anywhere // the following is for an app that can use anywhere
// from 1 to 64 threads, can control this exactly, // from 1 to 64 threads, can control this exactly,
// and whose speedup is .95N // and whose speedup is .95N
// (so on a uniprocessor, we'll use a sequential app // (so on a uniprocessor, we'll use a sequential app if one is available)
// if one is available)
// //
int ncpus, nthreads; int ncpus, nthreads;
bool bounded; bool bounded;
@ -66,7 +65,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
hu.flops/1e9 hu.flops/1e9
); );
} }
return true; return 0;
} else if (!strcmp(plan_class, "cuda")) { } else if (!strcmp(plan_class, "cuda")) {
// the following is for an app that uses a CUDA GPU // the following is for an app that uses a CUDA GPU
// //
@ -77,7 +76,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
); );
g_wreq->no_gpus_prefs = true; g_wreq->no_gpus_prefs = true;
} }
return false; return PLAN_REJECT_PREFS;
} }
COPROC_CUDA* cp = (COPROC_CUDA*)sreq.coprocs.lookup("CUDA"); COPROC_CUDA* cp = (COPROC_CUDA*)sreq.coprocs.lookup("CUDA");
if (!cp) { if (!cp) {
@ -86,7 +85,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
"[version] Host lacks CUDA coprocessor for plan class cuda\n" "[version] Host lacks CUDA coprocessor for plan class cuda\n"
); );
} }
return false; return PLAN_REJECT_NO_COPROC;
} }
int v = (cp->prop.major)*100 + cp->prop.minor; int v = (cp->prop.major)*100 + cp->prop.minor;
if (v < 101) { if (v < 101) {
@ -95,7 +94,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
"[version] CUDA version %d < 1.1\n", v "[version] CUDA version %d < 1.1\n", v
); );
} }
return false; return PLAN_REJECT_COPROC_VERSION;
} }
if (cp->prop.dtotalGlobalMem < 254*1024*1024) { if (cp->prop.dtotalGlobalMem < 254*1024*1024) {
@ -104,7 +103,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
"[version] CUDA mem %d < 254MB\n", cp->prop.dtotalGlobalMem "[version] CUDA mem %d < 254MB\n", cp->prop.dtotalGlobalMem
); );
} }
return false; return PLAN_REJECT_COPROC_MEM;
} }
hu.flops = cp->flops_estimate(); hu.flops = cp->flops_estimate();
@ -118,8 +117,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
hu.flops/1e9 hu.flops/1e9
); );
} }
g_wreq->gpu_too_slow = true; return PLAN_REJECT_COPROC_SPEED;
return false;
} }
#endif #endif
@ -141,7 +139,7 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
cp->prop.multiProcessorCount cp->prop.multiProcessorCount
); );
} }
return true; return 0;
} }
log_messages.printf(MSG_CRITICAL, log_messages.printf(MSG_CRITICAL,
"Unknown plan class: %s\n", plan_class "Unknown plan class: %s\n", plan_class

View File

@ -18,4 +18,12 @@
#include "boinc_db.h" #include "boinc_db.h"
#include "server_types.h" #include "server_types.h"
extern bool app_plan(SCHEDULER_REQUEST&, char* plan_class, HOST_USAGE&); // reasons for the planning function to reject a host
#define PLAN_REJECT_PREFS 1
#define PLAN_REJECT_NO_COPROC 2
#define PLAN_REJECT_COPROC_VERSION 3
#define PLAN_REJECT_COPROC_MEM 4
#define PLAN_REJECT_COPROC_SPEED 5
extern int app_plan(SCHEDULER_REQUEST&, char* plan_class, HOST_USAGE&);

View File

@ -145,7 +145,7 @@ bool SCHEDULER_REQUEST::has_version(APP& app) {
BEST_APP_VERSION* get_app_version(WORKUNIT& wu) { BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
bool found; bool found;
unsigned int i; unsigned int i;
int j; int retval, j;
BEST_APP_VERSION* bavp; BEST_APP_VERSION* bavp;
char message[256]; char message[256];
@ -192,7 +192,6 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
); );
USER_MESSAGE um(message, "high"); USER_MESSAGE um(message, "high");
g_wreq->insert_no_work_message(um); g_wreq->insert_no_work_message(um);
g_wreq->no_app_version = true;
} }
bavp->avp = 0; bavp->avp = 0;
} else { } else {
@ -220,6 +219,10 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
// //
bavp->host_usage.flops = 0; bavp->host_usage.flops = 0;
bavp->avp = NULL; bavp->avp = NULL;
bool no_version_for_platform = true;
int cuda_reject = 0;
bool no_cuda_requested = false;
bool no_cpu_requested = false;
for (i=0; i<g_request->platforms.list.size(); i++) { for (i=0; i<g_request->platforms.list.size(); i++) {
PLATFORM* p = g_request->platforms.list[i]; PLATFORM* p = g_request->platforms.list[i];
for (j=0; j<ssp->napp_versions; j++) { for (j=0; j<ssp->napp_versions; j++) {
@ -227,17 +230,27 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
APP_VERSION& av = ssp->app_versions[j]; APP_VERSION& av = ssp->app_versions[j];
if (av.appid != wu.appid) continue; if (av.appid != wu.appid) continue;
if (av.platformid != p->id) continue; if (av.platformid != p->id) continue;
no_version_for_platform = false;
if (g_request->core_client_version < av.min_core_version) { if (g_request->core_client_version < av.min_core_version) {
log_messages.printf(MSG_NORMAL, log_messages.printf(MSG_NORMAL,
"outdated client version %d < min core version %d\n", "outdated client version %d < min core version %d\n",
g_request->core_client_version, av.min_core_version g_request->core_client_version, av.min_core_version
); );
g_wreq->outdated_core = true; g_wreq->outdated_client = true;
continue; continue;
} }
if (strlen(av.plan_class)) { if (strlen(av.plan_class)) {
if (!g_request->client_cap_plan_class) continue; if (!g_request->client_cap_plan_class) {
if (!app_plan(*g_request, av.plan_class, host_usage)) { log_messages.printf(MSG_NORMAL,
"client version %d lacks plan class capability\n",
g_request->core_client_version
);
g_wreq->outdated_client = true;
continue;
}
retval = app_plan(*g_request, av.plan_class, host_usage);
if (retval) {
cuda_reject = retval;
continue; continue;
} }
} else { } else {
@ -254,6 +267,7 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
"[version] Don't need CUDA jobs, skipping\n" "[version] Don't need CUDA jobs, skipping\n"
); );
} }
no_cuda_requested = true;
continue; continue;
} }
} else { } else {
@ -263,6 +277,7 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
"[version] Don't need CPU jobs, skipping\n" "[version] Don't need CPU jobs, skipping\n"
); );
} }
no_cpu_requested = true;
continue; continue;
} }
} }
@ -282,7 +297,13 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
); );
} }
} else { } else {
// here if no app version exists // Here if there's no app version we can use.
// Could be because:
// - none exists for platform
// - one exists for platform, but host lacks processor type
// - one exists for platform, but no work requested for processor type
// - one exists but requires newer client
// - one exists but plan function rejects this host
// //
if (config.debug_version_select) { if (config.debug_version_select) {
for (i=0; i<g_request->platforms.list.size(); i++) { for (i=0; i<g_request->platforms.list.size(); i++) {
@ -293,7 +314,7 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
); );
} }
} }
if (!g_wreq->no_gpus_prefs) { if (no_version_for_platform) {
sprintf(message, sprintf(message,
"%s is not available for your type of computer.", "%s is not available for your type of computer.",
app->user_friendly_name app->user_friendly_name
@ -301,7 +322,43 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) {
USER_MESSAGE um(message, "high"); USER_MESSAGE um(message, "high");
g_wreq->insert_no_work_message(um); g_wreq->insert_no_work_message(um);
} }
g_wreq->no_app_version = true; char* p = NULL;
switch (cuda_reject) {
case PLAN_REJECT_PREFS:
p = "Your preferences are to not use GPU"; break;
case PLAN_REJECT_NO_COPROC:
p = "Your computer has no CUDA device"; break;
case PLAN_REJECT_COPROC_VERSION:
p = "Your CUDA device has the wrong software version"; break;
case PLAN_REJECT_COPROC_MEM:
p = "Your CUDA device has insufficient memory"; break;
case PLAN_REJECT_COPROC_SPEED:
p = "Your CUDA device is too slow"; break;
}
if (p) {
sprintf(message,
"Can't use CUDA app for %s: %s",
app->user_friendly_name, p
);
USER_MESSAGE um(message, "high");
g_wreq->insert_no_work_message(um);
}
if (no_cpu_requested) {
sprintf(message,
"CPU app exists for %s but no CPU work requested",
app->user_friendly_name
);
USER_MESSAGE um(message, "high");
g_wreq->insert_no_work_message(um);
}
if (no_cuda_requested) {
sprintf(message,
"CUDA app exists for %s but no CUDA work requested",
app->user_friendly_name
);
USER_MESSAGE um(message, "high");
g_wreq->insert_no_work_message(um);
}
return NULL; return NULL;
} }
return bavp; return bavp;
@ -1235,7 +1292,9 @@ static void explain_to_user() {
g_reply->set_delay(DELAY_NO_WORK_TEMP); g_reply->set_delay(DELAY_NO_WORK_TEMP);
USER_MESSAGE um2("No work sent", "high"); USER_MESSAGE um2("No work sent", "high");
g_reply->insert_message(um2); g_reply->insert_message(um2);
// Inform the user about applications with no work
// Tell the user about applications with no work
//
for (i=0; i<g_wreq->preferred_apps.size(); i++) { for (i=0; i<g_wreq->preferred_apps.size(); i++) {
if (!g_wreq->preferred_apps[i].work_available) { if (!g_wreq->preferred_apps[i].work_available) {
APP* app = ssp->lookup_app(g_wreq->preferred_apps[i].appid); APP* app = ssp->lookup_app(g_wreq->preferred_apps[i].appid);
@ -1250,13 +1309,12 @@ static void explain_to_user() {
} }
} }
} }
// Inform the user about applications they didn't qualify for
// Tell the user about applications they didn't qualify for
//
for (i=0; i<g_wreq->no_work_messages.size(); i++){ for (i=0; i<g_wreq->no_work_messages.size(); i++){
g_reply->insert_message(g_wreq->no_work_messages.at(i)); g_reply->insert_message(g_wreq->no_work_messages.at(i));
} }
if (g_wreq->no_app_version) {
g_reply->set_delay(DELAY_NO_WORK_PERM);
}
if (g_wreq->no_allowed_apps_available) { if (g_wreq->no_allowed_apps_available) {
USER_MESSAGE um( USER_MESSAGE um(
"No work available for the applications you have selected. Please check your settings on the web site.", "No work available for the applications you have selected. Please check your settings on the web site.",
@ -1295,7 +1353,7 @@ static void explain_to_user() {
); );
g_reply->insert_message(um); g_reply->insert_message(um);
} }
if (g_wreq->outdated_core) { if (g_wreq->outdated_client) {
USER_MESSAGE um( USER_MESSAGE um(
" (your BOINC client is old - please install current version)", " (your BOINC client is old - please install current version)",
"high" "high"

View File

@ -181,10 +181,9 @@ struct WORK_REQ {
bool no_allowed_apps_available; bool no_allowed_apps_available;
bool excessive_work_buf; bool excessive_work_buf;
bool no_app_version;
bool hr_reject_temp; bool hr_reject_temp;
bool hr_reject_perm; bool hr_reject_perm;
bool outdated_core; bool outdated_client;
bool gpu_too_slow; bool gpu_too_slow;
bool no_gpus_prefs; bool no_gpus_prefs;
bool daily_result_quota_exceeded; bool daily_result_quota_exceeded;