Ops: show more information on WUs with errors

Now uses the DB interface but still uses the old cache mechanism.
This commit is contained in:
Christian Beer 2016-03-15 15:25:06 +01:00
parent e325640344
commit 9b48d3e526
1 changed files with 49 additions and 22 deletions

View File

@ -21,7 +21,8 @@ require_once("../inc/cache.inc");
// User - configuarble variables // User - configuarble variables
// seconds to cache this page // seconds to cache this page
$cache_sec = 300; // this page runs a scan of the two largest tables, so this shouldn't be done more often than necessary
$cache_sec = 1800;
// Number that determines how many client errors are necessary for a WU to show up in this list. // Number that determines how many client errors are necessary for a WU to show up in this list.
// This number is added to min_quorum of the WU, so a value of 1 means that there must be more than // This number is added to min_quorum of the WU, so a value of 1 means that there must be more than
// (min_quorum + 1) errors for a WU to show up in this list. // (min_quorum + 1) errors for a WU to show up in this list.
@ -30,9 +31,7 @@ $notification_level = 1;
start_cache($cache_sec); start_cache($cache_sec);
admin_page_head("All-error Workunits"); admin_page_head("All-error Workunits");
db_init(); function print_wu($id,$name,$quorum,$errors,$valerrors,$mask) {
function print_wu($id,$name,$quorum,$errors) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td align=\"left\" valign=\"top\">"; echo "<td align=\"left\" valign=\"top\">";
@ -50,6 +49,13 @@ function print_wu($id,$name,$quorum,$errors) {
echo $quorum; echo $quorum;
echo "</td>\n"; echo "</td>\n";
echo "<td align=\"left\" valign=\"top\">";
if ($mask)
echo wu_error_mask_str($mask);
else
echo $mask;
echo "</td>\n";
echo "<td align=\"left\" valign=\"top\">"; echo "<td align=\"left\" valign=\"top\">";
echo "<a href=db_action.php?table=result&query=&outcome=3&sort_by=mod_time&detail=low&workunitid="; echo "<a href=db_action.php?table=result&query=&outcome=3&sort_by=mod_time&detail=low&workunitid=";
echo $id; echo $id;
@ -57,50 +63,66 @@ function print_wu($id,$name,$quorum,$errors) {
echo $errors; echo $errors;
echo "</a></td>\n"; echo "</a></td>\n";
echo "<td align=\"left\" valign=\"top\">";
echo "<a href=db_action.php?table=result&query=&outcome=6&sort_by=mod_time&detail=low&workunitid=";
echo $id;
echo ">";
echo $valerrors;
echo "</a></td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
$dbresult = _mysql_query(" $db = BoincDb::get();
SELECT workunitid, outcome, workunit.name, min_quorum $dbresult = $db->do_query("
FROM result, workunit SELECT workunitid, outcome, workunit.name, min_quorum, error_mask
WHERE workunit.id = workunitid AND server_state = 5 FROM result INNER JOIN workunit ON workunit.id = workunitid
WHERE server_state = 5
ORDER BY workunitid, outcome DESC ORDER BY workunitid, outcome DESC
;"); ;");
echo "<br><table border=\"1\">\n"; echo "<br><table border=\"1\">\n";
echo "<tr><th>WU ID</th><th>WU name</th><th>Quorum</th><th>Errors</th></tr>\n"; echo "<tr><th>WU ID</th><th>WU name</th><th>Quorum</th><th>Error mask</th><th>Client Errors</th><th>Validate Errors</th></tr>\n";
$rescount = 0; $rescount = 0;
$previd = -1; $previd = -1;
$prevname = ""; $prevname = "";
$prevquorum = 1; $prevquorum = 1;
$errors = 0; $prevmask = 0;
$valerrors = 0;
$clerrors = 0;
// The current version scans for client errors only. while ($res = $dbresult->fetch_object()) {
// In case you want to include validate errors, add "|| (outcome = 6)" to "(outcome = 3)"
while ($res = _mysql_fetch_object($dbresult)) {
$id = $res->workunitid; $id = $res->workunitid;
if ($id != $previd) { if ($id != $previd) {
if ($errors > $prevquorum + $notification_level) { if (($clerrors > $prevquorum + $notification_level) ||
print_wu($previd,$prevname,$prevquorum,$errors); ($valerrors > $prevquorum + $notification_level)) {
print_wu($previd,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++; $rescount++;
} }
$prevmask = $res->error_mask;
$previd = $id; $previd = $id;
$prevname = $res->name; $prevname = $res->name;
$prevquorum = $res->min_quorum; $prevquorum = $res->min_quorum;
$errors = 0; $clerrors = 0;
$valerrors = 0;
} }
if ($res->outcome == 3) { if ($res->outcome == 3) {
$errors ++; $clerrors ++;
}
if ($res->outcome == 6) {
$valerrors ++;
} }
if ($res->outcome == 1) { if ($res->outcome == 1) {
$errors = 0; $clerrors = 0;
$valerrors = 0;
} }
} }
_mysql_free_result($dbresult);
if ($errors > $prevquorum) { $dbresult->free();
print_wu($id,$prevname,$prevquorum,$errors);
if (($clerrors > $prevquorum + $notification_level) ||
($valerrors > $prevquorum + $notification_level)) {
print_wu($id,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++; $rescount++;
} }
@ -108,6 +130,11 @@ echo "</table>\n<br>";
echo $rescount; echo $rescount;
echo " entries\n"; echo " entries\n";
echo "<br><br>";
echo "Page last updated ";
echo time_str(time());
admin_page_tail(); admin_page_tail();
end_cache($cache_sec); end_cache($cache_sec);