. require_once("../inc/common_defs.inc"); require_once("../inc/util_ops.inc"); require_once("../inc/cache.inc"); // User - configuarble variables // seconds to cache this page // 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. $notification_level = 1; $hide_canceled = get_str("hide_canceled", true); admin_page_head("All-error Workunits"); function print_wu($row) { echo "\n"; echo ""; echo ""; echo $row['id']; echo "\n"; echo ""; echo $row['name']; echo "\n"; echo ""; echo $row['quorum']; echo "\n"; echo ""; if ($row['mask']) { echo wu_error_mask_str($row['mask']); } else { echo $row['mask']; } echo "\n"; echo ""; echo ""; echo $row['clerrors']; echo "\n"; echo ""; echo ""; echo $row['valerrors']; echo "\n"; echo "\n"; } function get_error_wus() { global $notification_level; $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 ;"); $row_cache = array(); $previd = -1; $prevname = ""; $prevquorum = 1; $prevmask = 0; $valerrors = 0; $clerrors = 0; while ($res = $dbresult->fetch_object()) { $id = $res->workunitid; if ($id != $previd) { if (($clerrors > $prevquorum + $notification_level) || ($valerrors > $prevquorum + $notification_level)) { $row_cache[] = array("id" => $previd, "name" => $prevname, "quorum" => $prevquorum, "clerrors" => $clerrors, "valerrors" => $valerrors, "mask" => $prevmask); } $prevmask = $res->error_mask; $previd = $id; $prevname = $res->name; $prevquorum = $res->min_quorum; $clerrors = 0; $valerrors = 0; } if ($res->outcome == 3) { $clerrors ++; } if ($res->outcome == 6) { $valerrors ++; } if ($res->outcome == 1) { $clerrors = 0; $valerrors = 0; } } $dbresult->free(); if (($clerrors > $prevquorum + $notification_level) || ($valerrors > $prevquorum + $notification_level)) { $row_cache[] = array("id" => $previd, "name" => $prevname, "quorum" => $prevquorum, "clerrors" => $clerrors, "valerrors" => $valerrors, "mask" => $prevmask); } return $row_cache; } $last_update = 0; $row_array = null; $cache_data = get_cached_data($cache_sec); if ($cache_data) { $cache_data = unserialize($cache_data); $last_update = $cache_data['last_update']; $row_array = $cache_data['row_array']; } else { $row_array = get_error_wus(); $last_update = time(); $cache_data = array('last_update' => $last_update, 'row_array' => $row_array); set_cached_data($cache_sec, serialize($cache_data)); } echo "
"; echo "
\n"; print_checkbox("Hide canceled WUs", "hide_canceled", $hide_canceled); echo "\n"; echo "
\n"; echo "Page last updated ".time_str($last_update); echo "
\n"; echo "\n"; $hidden=0; foreach($row_array as $row) { if ($hide_canceled == 'on' && (($row['mask'] & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED)) { $hidden++; continue; } print_wu($row); } echo "
WU IDWU nameQuorumError maskClient ErrorsValidate Errors
\n
"; echo count($row_array)." entries (".$hidden." hidden)\n"; admin_page_tail(); ?>