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
// 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.
// 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.
@ -30,9 +31,7 @@ $notification_level = 1;
start_cache($cache_sec);
admin_page_head("All-error Workunits");
db_init();
function print_wu($id,$name,$quorum,$errors) {
function print_wu($id,$name,$quorum,$errors,$valerrors,$mask) {
echo "<tr>\n";
echo "<td align=\"left\" valign=\"top\">";
@ -50,6 +49,13 @@ function print_wu($id,$name,$quorum,$errors) {
echo $quorum;
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 "<a href=db_action.php?table=result&query=&outcome=3&sort_by=mod_time&detail=low&workunitid=";
echo $id;
@ -57,50 +63,66 @@ function print_wu($id,$name,$quorum,$errors) {
echo $errors;
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";
}
$dbresult = _mysql_query("
SELECT workunitid, outcome, workunit.name, min_quorum
FROM result, workunit
WHERE workunit.id = workunitid AND server_state = 5
$db = BoincDb::get();
$dbresult = $db->do_query("
SELECT workunitid, outcome, workunit.name, min_quorum, error_mask
FROM result INNER JOIN workunit ON workunit.id = workunitid
WHERE server_state = 5
ORDER BY workunitid, outcome DESC
;");
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;
$previd = -1;
$prevname = "";
$prevquorum = 1;
$errors = 0;
$prevmask = 0;
$valerrors = 0;
$clerrors = 0;
// The current version scans for client errors only.
// In case you want to include validate errors, add "|| (outcome = 6)" to "(outcome = 3)"
while ($res = _mysql_fetch_object($dbresult)) {
while ($res = $dbresult->fetch_object()) {
$id = $res->workunitid;
if ($id != $previd) {
if ($errors > $prevquorum + $notification_level) {
print_wu($previd,$prevname,$prevquorum,$errors);
if (($clerrors > $prevquorum + $notification_level) ||
($valerrors > $prevquorum + $notification_level)) {
print_wu($previd,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++;
}
$prevmask = $res->error_mask;
$previd = $id;
$prevname = $res->name;
$prevquorum = $res->min_quorum;
$errors = 0;
$clerrors = 0;
$valerrors = 0;
}
if ($res->outcome == 3) {
$errors ++;
$clerrors ++;
}
if ($res->outcome == 6) {
$valerrors ++;
}
if ($res->outcome == 1) {
$errors = 0;
$clerrors = 0;
$valerrors = 0;
}
}
_mysql_free_result($dbresult);
if ($errors > $prevquorum) {
print_wu($id,$prevname,$prevquorum,$errors);
$dbresult->free();
if (($clerrors > $prevquorum + $notification_level) ||
($valerrors > $prevquorum + $notification_level)) {
print_wu($id,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++;
}
@ -108,6 +130,11 @@ echo "</table>\n<br>";
echo $rescount;
echo " entries\n";
echo "<br><br>";
echo "Page last updated ";
echo time_str(time());
admin_page_tail();
end_cache($cache_sec);