From ee56ea3341f000ba2a105307fb364471502196cc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 7 Aug 2008 22:50:05 +0000 Subject: [PATCH] - validator: get_credit_from_wu() returns an error, rather than exiting, if WU doesn't have element svn path=/trunk/boinc/; revision=15777 --- checkin_notes | 13 +++++++++ doc/white.css | 9 +++--- html/ops/bossa_admin.php | 12 +++++--- html/user/white.css | 62 +++++++++++++++++++--------------------- sched/validate_util.C | 8 +++--- sched/validate_util.h | 2 +- sched/validator.C | 9 +++++- 7 files changed, 68 insertions(+), 47 deletions(-) diff --git a/checkin_notes b/checkin_notes index beeaa96fcc..2aa7454b09 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6325,3 +6325,16 @@ David 7 Aug 2008 html/user/ forum_forum.php white.css + +David 7 Aug 2008 + - validator: get_credit_from_wu() returns an error, rather than exiting, + if WU doesn't have element + + html/ + ops/ + bossa_admin.php + user/ + white.css + sched/ + validator.C + validate_util.C,h diff --git a/doc/white.css b/doc/white.css index d0a0dfc426..413166d5ef 100644 --- a/doc/white.css +++ b/doc/white.css @@ -83,10 +83,11 @@ td.indent { } td.heading { -#background-color: rgb(157, 221, 255); -#font-weight: bold; - background-color: rgb(223, 240, 255); - border: 1px solid lightblue; + background-color: rgb(223, 240, 255); + border: 1px solid lightblue; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + } td.fieldname { diff --git a/html/ops/bossa_admin.php b/html/ops/bossa_admin.php index c1f249febf..083fa3584e 100644 --- a/html/ops/bossa_admin.php +++ b/html/ops/bossa_admin.php @@ -34,8 +34,9 @@ function include_app_file($app_id) { require_once($file); } -function show_app($app) { - echo " +function show_app($app, $i) { + $j = $i%2; + echo " Name: $app->name
Short name: $app->short_name
Description: $app->description
@@ -57,8 +58,9 @@ function show_apps() { start_table(); row1("Existing apps", 2); table_header("Name/description", ""); + $i = 0; foreach ($apps as $app) { - show_app($app); + show_app($app, $i++); } end_table(); } @@ -165,10 +167,12 @@ function show_batch($batch_id) { $jobs = BossaJob::enum("batch_id=$batch_id"); start_table(); table_header("ID", "Created", "State", "Instances"); + $i = 0; foreach ($jobs as $job) { $t = time_str($job->create_time); $s = job_state_string($job->state); - echo " + $j = $i++ % 2; + echo " $job->id id>(details)
"; diff --git a/html/user/white.css b/html/user/white.css index 4f8518fae9..ebece89179 100644 --- a/html/user/white.css +++ b/html/user/white.css @@ -5,9 +5,7 @@ a, a:link, a:visited, a:active { text-decoration: none; } -a:hover { - text-decoration: underline; -} +a:hover { text-decoration: underline; } body { background-image: url("img/gray_gradient.png"); @@ -25,7 +23,7 @@ h1, h2 { } h1 { - color: #203C66; + color: #203C66; margin: 10px; } @@ -41,15 +39,14 @@ hr { table { border: 2px solid #e8e8e8; - padding: 2px; - margin: 2px 2px 2px 2px; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; - background-color: white; + padding: 4px; + margin: 2px; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; } table.noborder { - border: none; + border: none; } th { @@ -70,7 +67,7 @@ td.indent { border-left: 4px solid white; } td.heading { font-weight: bold; - margin: 4px 0px; + margin: 4px 0px; padding: 8px; background-color: #d8d8d8; } @@ -79,11 +76,11 @@ td.fieldname { background-color: #eeeeee; text-align: right; padding-right: 10px; - margin: 2px 0px; + margin: 2px 0px; } td.fieldvalue { - margin: 2px 0px; + margin: 2px 0px; vertical-align: middle; } @@ -127,9 +124,8 @@ tr.message { background-color: #e0e0e0; } input, select, textarea{ border: 1px solid #d8d8d8; - background color: #eeeeee; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; padding: 2px; font-size: 12px; } @@ -150,9 +146,9 @@ img.userimg { border: 0px; } #news { background-color: #dff0ff; - border: 2px solid lightblue; - padding: 10px; - margin: 4px; + border: 2px solid lightblue; + padding: 10px; + margin: 4px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } @@ -175,9 +171,9 @@ img.userimg { border: 0px; } #uotd { background-color: #eeeeee; - border: 2px solid lightgray; - padding: 10px; - margin: 4px; + border: 2px solid lightgray; + padding: 10px; + margin: 4px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } @@ -186,15 +182,15 @@ img.userimg { border: 0px; } td.category , tr.subtitle{ background-color: #dddddd; - border: 0px; + border: 0px; font-weight: bold; margin: 6px 0px; } th { font-weight: bold; - margin: 4px 2px; - padding: 4px; + margin: 4px 2px; + padding: 4px; } td.postheader { @@ -202,18 +198,18 @@ td.postheader { border-bottom: 1px solid rgb(190,190,200); border-left: none; border-right: none; - border-top: none; - margin-left: 4px; + border-top: none; + margin-left: 4px; } td.postbody { font-size: 9pt; - margin-left: 4px; + margin-left: 4px; } td.postfooter { background-color: rgb(220,210,210); - margin-left: 4px; + margin-left: 4px; } tr.helpdeskseperator { height: 10pt; } @@ -221,11 +217,11 @@ tr.helpdeskseperator { height: 10pt; } tr.postseperator { background-color: rgb(200,200,200); border: 1px solid rgb(170,170,170); - margin: 4px 0px; + margin: 4px 0px; } tr.postseperator td { - border: none; + border: 0px; } td.threadline { text-align: left; } @@ -254,7 +250,7 @@ blockquote.postbody { border-left: 2px solid blue; border-color: blue; background-color: rgb(240,240,255); - padding: 0px 0px 0px 5px; + padding: 0px 0px 0px 5px; margin: 0px 100px 0px 15px; font-style: italic; } @@ -273,7 +269,7 @@ td.lastpost { background-color: white; } height: 1px; background-color: black; color: black; - border: 0; + border: 0px; margin-right: 100%; } diff --git a/sched/validate_util.C b/sched/validate_util.C index 4d7529a4e1..0475f217a0 100644 --- a/sched/validate_util.C +++ b/sched/validate_util.C @@ -234,7 +234,7 @@ double median_mean_credit(WORKUNIT& /*wu*/, vector& results) { } } -double get_credit_from_wu(WORKUNIT& wu, vector&) { +int get_credit_from_wu(WORKUNIT& wu, vector&, double& credit) { double x; int retval; DB_WORKUNIT dbwu; @@ -243,11 +243,11 @@ double get_credit_from_wu(WORKUNIT& wu, vector&) { retval = dbwu.get_field_str("xml_doc", dbwu.xml_doc, sizeof(dbwu.xml_doc)); if (!retval) { if (parse_double(dbwu.xml_doc, "", x)) { - return x; + credit = x; + return 0; } } - fprintf(stderr, "ERROR: missing from WU XML\n"); - exit(1); + return ERR_XML_PARSE; } // This function should be called from the validator whenever credit diff --git a/sched/validate_util.h b/sched/validate_util.h index 3942e41b5b..bd8c7664cb 100644 --- a/sched/validate_util.h +++ b/sched/validate_util.h @@ -45,7 +45,7 @@ extern int get_logical_name( ); extern double median_mean_credit(WORKUNIT&, std::vector& results); -extern double get_credit_from_wu(WORKUNIT&, std::vector& results); +extern int get_credit_from_wu(WORKUNIT&, std::vector& results, double&); extern double stddev_credit(WORKUNIT&, std::vector& results); extern double two_credit(WORKUNIT&, std::vector& results); extern int update_credit_per_cpu_sec( diff --git a/sched/validator.C b/sched/validator.C index 995abf235f..7dfcca5605 100644 --- a/sched/validator.C +++ b/sched/validator.C @@ -434,7 +434,14 @@ int handle_wu( if (retry) transition_time = DELAYED; if (credit_from_wu) { - credit = get_credit_from_wu(wu, results); + retval = get_credit_from_wu(wu, results, credit); + if (retval) { + log_messages.printf(MSG_CRITICAL, + "[WU#%d %s] get_credit_from_wu returned %d\n", + wu.id, wu.name, retval + ); + return retval; + } } if (max_granted_credit && credit>max_granted_credit) { credit = max_granted_credit;