diff --git a/html/inc/util_ops.inc b/html/inc/util_ops.inc
index 389005857d..71fe66b6b4 100644
--- a/html/inc/util_ops.inc
+++ b/html/inc/util_ops.inc
@@ -355,6 +355,13 @@ if (!isset($skip_auth_ops) && array_key_exists("SERVER_PORT", $_SERVER)) {
auth_ops();
}
+// returns true when this is a readonly ops section
+// currently a dummy because this needs to be ported from Einstein@home
+//
+function in_rops() {
+ return false;
+}
+
function cancel_wus_where($clause) {
$q1 = "CREATE TEMPORARY TABLE tmp SELECT id FROM workunit WHERE $clause;";
$q2 = "UPDATE result r INNER JOIN tmp t on r.workunitid=t.id SET server_state=5, outcome=5 WHERE server_state=2;";
diff --git a/html/ops/cancel_workunits_action.php b/html/ops/cancel_workunits_action.php
index 7fd1dc8f7d..ae36d150f4 100644
--- a/html/ops/cancel_workunits_action.php
+++ b/html/ops/cancel_workunits_action.php
@@ -19,6 +19,9 @@
require_once("../inc/util_ops.inc");
$cancel = post_int('cancel', true);
+$hide_canceled = post_str('hide_canceled', true);
+$hide_dlerr = post_str('hide_dlerr', true);
+$appid = post_int('appid', true);
$WU = post_arr('WU', true);
$back = post_str('back', true);
$clause = post_str('clause', true);
@@ -47,18 +50,24 @@ if ($cancel && ($cancel == 1)) {
//
if($WUs != "") {
echo "\n";
-// if (!in_rops()) {
+ if (!in_rops()) {
cancel_wus_where("id IN (" . $WUs . ")");
-// }
+ }
}
if ($back) {
if ($back == "errorwus") {
$args = "?refresh_cache=1";
- if (array_key_exists('hide_canceled',$_REQUEST)) {
+ if ($hide_canceled && $hide_canceled=="on") {
$args .= "&hide_canceled=on";
}
- echo "
Return to All-error Workunits page
";
+ if ($hide_dlerr && $hide_dlerr=="on") {
+ $args .= "&hide_dlerr=on";
+ }
+ if ($appid) {
+ $args .= "&appid=$appid";
+ }
+ echo "Return to All-error Workunits page (refreshes the cache)
";
} else if ($back == "cancelwus") {
if ($clause) {
$clause=urlencode($clause);
diff --git a/html/ops/errorwus.php b/html/ops/errorwus.php
index 3b299b250b..e4768ed77e 100644
--- a/html/ops/errorwus.php
+++ b/html/ops/errorwus.php
@@ -1,7 +1,7 @@
name;
+}
+// the following variables are using the cache that is created by the variables above
+
+// hide already canceled WUs
$hide_canceled = get_str("hide_canceled", true);
+// hide WU that have only download errors
+$hide_dlerr = get_str("hide_dlerr", true);
+// refresh cache from DB
$refresh_cache = get_int("refresh_cache", true);
-admin_page_head("All-error Workunits");
+admin_page_head("All-error Workunits".$appid_title);
function print_wu($row) {
echo "\n";
echo "";
- echo " \n";
+ if (!in_rops()) {
+ echo " id."\">\n";
+ }
echo "id;
echo ">";
- echo $row['id'];
+ echo $row->id;
+ echo " \n";
+
+ echo "".$row->name." \n";
+ echo "".$row->appid." \n";
+ echo "".$row->min_quorum." \n";
+ echo "".$row->unsent." \n";
+ echo "".$row->in_progress." \n";
+
+ echo "";
+ echo "id.">";
+ echo $row->successes;
echo " \n";
echo "";
- echo $row['name'];
- echo " \n";
+ echo "id.">";
+ echo $row->download_errors;
+ echo " \n";
echo "";
- echo $row['quorum'];
- echo " \n";
+ echo "id.">";
+ echo $row->compute_errors;
+ echo " \n";
echo "";
- if ($row['mask']) {
- echo wu_error_mask_str($row['mask']);
+ echo "id.">";
+ echo $row->validate_errors;
+ echo " \n";
+
+ echo "";
+ if ($row->error_mask) {
+ echo wu_error_mask_str($row->error_mask);
} else {
- echo $row['mask'];
+ echo " ";
}
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;
+ global $appid_filter;
- $db = BoincDb::get();
+ // this query is obviously expensive for big projects but if there is a replica this does not impact the project
+ $db = BoincDb::get(true);
$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
+ SELECT id, name, appid, unsent, in_progress, successes, compute_errors,
+ download_errors, validate_errors, error_mask, min_quorum,
+ (compute_errors + download_errors + validate_errors) as total_errors
+ FROM (
+ SELECT
+ workunitid,
+ SUM(IF(outcome=1,1,0)) AS successes,
+ SUM(IF((outcome=3 AND client_state=1),1,0)) AS download_errors,
+ SUM(IF((outcome=3 AND client_state=3),1,0)) AS compute_errors,
+ SUM(IF(outcome=6,1,0)) AS validate_errors,
+ SUM(IF(server_state=2,1,0)) AS unsent,
+ SUM(IF(server_state=4,1,0)) AS in_progress
+ FROM result
+ WHERE server_state IN (2,4,5)
+ GROUP BY workunitid
+ ) AS t1
+ JOIN workunit ON workunit.id = workunitid
+ WHERE canonical_resultid=0 AND $appid_filter
+ GREATEST(download_errors, compute_errors, validate_errors) > min_quorum + $notification_level
+ ORDER BY name
;");
$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;
- }
+ while ($row = $dbresult->fetch_object()) {
+ $row_cache[] = $row;
}
$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);
+$cache_args = "level=$notification_level";
+if ($appid) $cache_args .= "&appid=$appid";
+
+$cache_data = get_cached_data($cache_sec, $cache_args);
if ($cache_data && !$refresh_cache) {
$cache_data = unserialize($cache_data);
$last_update = $cache_data['last_update'];
@@ -142,23 +154,35 @@ if ($cache_data && !$refresh_cache) {
$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));
+ set_cached_data($cache_sec, serialize($cache_data), $cache_args);
}
echo " ";
echo "\n";
echo "Page last updated ".time_str($last_update);
-echo "\n";
}
-echo " ";
-echo "\n";
echo count($row_array)." entries (".$hidden." hidden)\n";
admin_page_tail();