function revalidate($clause) { $nwus = 0; $nresults = 0; $wus = BoincWorkunit::enum($clause); foreach ($wus as $wu) { $results = BoincResult::enum("workunitid={$wu->id}"); $n = 0; foreach ($results as $result) { if ($result->server_state != 5) { continue; } if ($result->outcome != 1) { continue; } if ($result->validate_state < 2) { continue; } $result->update("validate_state=0"); echo "<br>updated result {$result->id}\n"; $n++; $nresults++; } if ($n) { $wu->update("need_validate=1"); echo "<br>updated wu {$wu->id}\n"; $nwus++; } } echo "Examined " . count($wus) . " jobs.\n"; echo "{$nwus} jobs and {$nresults} instances were marked for revalidation"; }
function get_gpu_list($vendor, $alt_vendor = null) { $clause = "plan_class like '%{$vendor}%'"; if ($alt_vendor) { $clause .= " or plan_class like '%{$alt_vendor}%'"; } $avs = BoincAppVersion::enum($clause); if (count($avs) == 0) { return null; } $av_ids = ""; foreach ($avs as $av) { $av_ids .= "{$av->id}, "; } $av_ids .= "0"; $t = time() - 30 * 86400; //echo "start enum $vendor $av_ids\n"; $results = BoincResult::enum("app_version_id in ({$av_ids}) and create_time > {$t} and elapsed_time>100 limit 500"); //echo "end enum\n"; $total = array(); $win = array(); $linux = array(); $mac = array(); foreach ($results as $r) { $h = BoincHost::lookup_id($r->hostid); if (!$h) { continue; } $wu = BoincWorkunit::lookup_id($r->workunitid); if (!$wu) { continue; } $v = $vendor == "cuda" ? "CUDA" : "CAL"; $model = get_gpu_model($h->serialnum, $v); if (!$model) { continue; } add_model($model, $r, $wu, $total); if (strstr($h->os_name, "Windows")) { add_model($model, $r, $wu, $win); } if (strstr($h->os_name, "Linux")) { add_model($model, $r, $wu, $linux); } if (strstr($h->os_name, "Darwin")) { add_model($model, $r, $wu, $mac); } } $x = null; $x->total = $total; $x->win = $win; $x->linux = $linux; $x->mac = $mac; return $x; }
function host_history($hostid, $avid) { $rs = BoincResult::enum("hostid={$hostid} and app_version_id={$avid} and validate_state=1 order by id desc limit 100"); echo "<pre>Results for host {$hostid}\n"; $n = 0; $total = 0; foreach ($rs as $r) { $raw_credit = $r->elapsed_time * $r->flops_estimate * COBB_SCALE; $n++; $total += $raw_credit; echo "ID <a href=credit.php?resultid={$r->id}>{$r->id}</a> raw {$raw_credit}\n"; } $avg = $total / $n; echo "avg: {$avg}\n"; echo "</pre>\n"; }
function show_batch($user) { $batch_id = get_int('batch_id'); $batch = BoincBatch::lookup_id($batch_id); if (!$batch || $batch->user_id != $user->id) { error_page("no batch"); } page_head("Batch {$batch->id}"); $results = BoincResult::enum("batch={$batch->id} order by workunitid"); $i = 0; result_table_start(true, true, null); foreach ($results as $result) { show_result_row($result, true, true, true, $i++); } end_table(); page_tail(); }
echo " <workunitid>" . $result->workunitid . "</workunitid>\n"; echo " <hostid>" . $result->hostid . "</hostid>\n"; echo " <claimed_credit>" . $result->claimed_credit . "</claimed_credit>\n"; echo " <received_time>" . $result->received_time . "</received_time>\n"; echo "</result>\n"; $sum += $result->claimed_credit; } echo "<total_claimed_credit>" . $sum . "</total_claimed_credit>\n"; echo "</pending_credit>\n"; } else { $user = get_logged_in_user(); $sum = 0; page_head(tra("Pending credit")); start_table(); echo "<tr><th>" . tra("Result ID") . "</th><th>" . tra("Workunit ID") . "</th><th>" . tra("Host ID") . "</th><th>" . tra("Claimed credit") . "</th></tr>\n"; $results = BoincResult::enum("userid={$user->id} AND (validate_state=0 OR validate_state=4) AND claimed_credit > 0"); foreach ($results as $result) { echo "<tr>\n"; echo "<td><a href=\"result.php?resultid={$result->id}\">{$result->id}</a></td>\n"; echo "<td><a href=\"workunit.php?wuid={$result->workunitid}\">{$result->workunitid}</a></td>\n"; echo "<td><a href=\"show_host_detail.php?hostid={$result->hostid}\">{$result->hostid}</a></td>\n"; echo "<td>" . format_credit($result->claimed_credit) . "</td>\n"; echo "</tr>\n"; $sum += $result->claimed_credit; } end_table(); echo tra("Pending credit: %1", format_credit($sum)); page_tail(); } $cvs_version_tracker[] = "\$Id\$"; //Generated automatically - do not edit
function query_completed_job($r) { xml_start_tag("query_completed_job"); list($user, $user_submit) = authenticate_user($r, null); $job_name = (string) $r->job_name; $job_name = BoincDb::escape_string($job_name); $wu = BoincWorkunit::lookup("name='{$job_name}'"); if (!$wu) { xml_error(-1, "no such job"); } $batch = BoincBatch::lookup_id($wu->batch); if ($batch->user_id != $user->id) { xml_error(-1, "not owner"); } echo "<completed_job>\n"; echo " <error_mask>{$wu->error_mask}</error_mask>\n"; if ($wu->canonical_resultid) { $result = BoincResult::lookup_id($wu->canonical_resultid); echo " <canonical_resultid>{$wu->canonical_resultid}</canonical_resultid>\n"; } else { $results = BoincResult::enum("workunitid={$job_id}"); foreach ($results as $r) { switch ($r->outcome) { case 1: case 3: case 6: $result = $r; break; } } if ($result) { echo " <error_resultid>{$result->id}</error_resultid>\n"; } } if ($result) { echo " <exit_status>{$result->exit_status}</exit_status>\n"; echo " <elapsed_time>{$result->elapsed_time}</elapsed_time>\n"; echo " <cpu_time>{$result->cpu_time}</cpu_time>\n"; echo " <stderr_out><![CDATA[\n"; echo htmlspecialchars($result->stderr_out); echo " ]]></stderr_out>\n"; } echo "</completed_job>\n </query_completed_job>\n "; }
function handle_query_job($user) { $wuid = get_int('wuid'); $wu = BoincWorkunit::lookup_id($wuid); if (!$wu) { error_page("no such job"); } page_head("Job {$wuid}"); echo "\n <a href=workunit.php?wuid={$wuid}>Workunit details</a> ·\n <a href=submit.php?action=query_batch&batch_id={$wu->batch}>Batch {$wu->batch}</a>\n "; // show input files // echo "<h2>Input files</h2>\n"; $x = "<in>" . $wu->xml_doc . "</in>"; $x = simplexml_load_string($x); start_table(); table_header("Logical name<br><p class=\"text-muted\">(click to view)</p>", "Size (bytes)", "MD5"); foreach ($x->workunit->file_ref as $fr) { $pname = (string) $fr->file_name; $lname = (string) $fr->open_name; foreach ($x->file_info as $fi) { if ((string) $fi->name == $pname) { table_row("<a href={$fi->url}>{$lname}</a>", $fi->nbytes, $fi->md5_cksum); break; } } } end_table(); echo "<h2>Instances</h2>\n"; start_table(); table_header("Instance ID<br><p class=\"text-muted\">click for result page</p>", "State", "Output files<br><p class=\"text-muted\">click to view the file</p>"); $results = BoincResult::enum("workunitid={$wuid}"); $upload_dir = parse_config(get_config(), "<upload_dir>"); $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); foreach ($results as $result) { echo "<tr>\n <td><a href=result.php?resultid={$result->id}>{$result->id} · {$result->name} </a></td>\n <td>" . state_string($result) . "</td>\n <td>\n"; $i = 0; if ($result->server_state == 5) { $names = get_outfile_names($result); $i = 0; foreach ($names as $name) { $url = boinc_get_output_file_url($user, $result, $i++); $path = dir_hier_path($name, $upload_dir, $fanout); $s = stat($path); $size = $s['size']; echo "<a href={$url}>{$name} </a> (" . number_format($size) . " bytes)<br/>"; } $i++; } echo "</td></tr>\n"; } end_table(); echo "<p><a href=submit.php>Return to job control page</a>\n"; page_tail(); }
if ($wu->canonical_resultid) { row2('canonical result', '<a href="result.php?resultid=$wu->canonical_resultid">$wu->canonical_resultid</a>'); row2("granted credit", format_credit($wu->canonical_credit)); } // if app is using adaptive replication and no canonical result yet, // don't show anything more // (so that bad guys can't tell if they have an unreplicated job) if ($app->target_nresults > 0 && !$wu->canonical_resultid) { row2("Tasks in progress", "suppressed pending completion"); end_table(); } else { row2("minimum quorum", $wu->min_quorum); row2("initial replication", $wu->target_nresults); row2("max # of error/total/success tasks", "{$wu->max_error_results}, {$wu->max_total_results}, {$wu->max_success_results}"); if ($wu->error_mask) { row2("errors", wu_error_mask_str($wu->error_mask)); } if ($wu->need_validate) { row2("validation", "Pending"); } end_table(); project_workunit($wu); result_table_start(false, true, null); $results = BoincResult::enum("workunitid={$wuid}"); $i = 0; foreach ($results as $result) { show_result_row($result, false, true, false, $i++); } echo "</table>\n"; } page_tail();
page_head(tra("Tasks for computer %1", $host->id)); } else { if ($userid) { $user = get_logged_in_user(); if ($userid != $user->id) { error_page(tra("No access")); } $clause = "userid={$userid}"; page_head(tra("Tasks for {$user->name}")); } else { error_page(tra("Missing user ID or host ID")); } } $clause2 = $clause . $state_clause[$state]; $query = "{$clause2} order by id desc limit {$offset}," . ($results_per_page + 1); $results = BoincResult::enum($query); $info = null; $info->number_of_results = count($results); $info->clause = $clause; $info->results_per_page = $results_per_page; $info->offset = $offset; $info->show_names = $show_names; $info->state = $state; echo show_result_navigation($info); result_table_start(true, false, $info); $i = 0; foreach ($results as $result) { if ($i >= $results_per_page) { break; } show_result_row($result, true, false, $show_names, $i);
function handle_query_job($user) { $wuid = get_int('wuid'); page_head("Job {$wuid}"); echo "<a href=workunit.php?wuid={$wuid}>View workunit page</a>\n"; // show input files // echo "<h2>Input files</h2>\n"; $wu = BoincWorkunit::lookup_id($wuid); $x = "<in>" . $wu->xml_doc . "</in>"; $x = simplexml_load_string($x); start_table(); table_header("Logical name<br><span class=note>(click to view)</span>", "Size (bytes)", "MD5"); $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); foreach ($x->workunit->file_ref as $fr) { $pname = (string) $fr->file_name; $lname = (string) $fr->open_name; $dir = filename_hash($pname, $fanout); $path = "../../download/{$dir}/{$pname}"; $md5 = md5_file($path); $s = stat($path); $size = $s['size']; table_row("<a href=/download/{$dir}/{$pname}>{$lname}</a>", $size, $md5); } end_table(); echo "<h2>Instances</h2>\n"; start_table(); table_header("Instance ID<br><span class=note>click for result page</span>", "State", "Output files<br><span class=note>click to view the file</span>"); $results = BoincResult::enum("workunitid={$wuid}"); foreach ($results as $result) { echo "<tr>\n <td><a href=result.php?resultid={$result->id}>{$result->id} | {$result->name} </a></td>\n <td>" . state_string($result) . "</td>\n <td>\n"; $i = 0; if ($result->server_state == 5) { $names = get_outfile_names($result); $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); $i = 0; foreach ($names as $name) { $url = boinc_get_output_file_url($user, $result, $i++); $path = dir_hier_path($name, "../../upload", $fanout); $s = stat($path); $size = $s['size']; echo "<a href={$url}>{$name} </a> (" . number_format($size) . " bytes)<br/>"; } $i++; } echo "</td></tr>\n"; } end_table(); echo "<p><a href=submit.php>Return to job control page</a>\n"; page_tail(); }
function show_av($av_id) { $av = BoincAppVersion::lookup_id($av_id); $app = BoincApp::lookup_id($av->appid); $plat = BoincPlatform::lookup_id($av->platformid); $av_desc = "{$plat->name} {$av->plan_class}"; page_head("App version {$av_desc} credit"); start_table(); row2("PFC samples", $av->pfc_n); row2("PFC average", $av->pfc_avg); row2("PFC scale", $av->pfc_scale); row2("App", $app->user_friendly_name); end_table(); $results = BoincResult::enum("app_version_id={$av_id} and validate_state=1"); start_table(); table_header("Host/App_version", "Elapsed", "FLOPS est"); foreach ($results as $r) { $avs = av_string($r->app_version_id); table_row("<a href=credit.php?host_id={$r->hostid}&a_id={$r->app_version_id}> host {$r->hostid} AV {$avs}</a>", $r->elapsed_time, $r->flops_estimate); } end_table(); page_tail(); }
function query_job($r) { list($user, $user_submit) = authenticate_user($r, null); $job_id = (int) $r->job_id; $wu = BoincWorkunit::lookup_id($job_id); if (!$wu) { error("no such job"); } $batch = BoincBatch::lookup_id($wu->batch); if ($batch->user_id != $user->id) { error("not owner"); } echo "<job>\n"; $results = BoincResult::enum("workunitid={$job_id}"); foreach ($results as $result) { echo " <instance>\n <name>{$result->name}</name>\n <id>{$result->id}</id>\n <state>" . state_string($result) . "</state>\n"; if ($result->server_state == 5) { // over? $paths = get_outfile_paths($result); foreach ($paths as $path) { if (is_file($path)) { $size = filesize($path); echo " <outfile>\n <size>{$size}</size>\n </outfile>\n"; } } } echo "</instance>\n"; } echo "</job>\n"; }
// BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. // delete results without a corresponding workunit. // (in principle these shouldn't exist) error_reporting(E_ALL); ini_set('display_errors', true); ini_set('display_startup_errors', true); require_once "../inc/boinc_db.inc"; $ndel = 0; while (1) { $rs = BoincResult::enum("true order by id limit 100"); $found = false; foreach ($rs as $r) { $wu = BoincWorkunit::lookup_id($r->workunitid); if ($wu) { echo "{$r->id} has a WU\n"; $found = true; break; } else { echo "{$r->id} has no WU - deleting\n"; $ndel++; $r->delete(); } } if ($found) { break;