コード例 #1
0
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";
}
コード例 #2
0
function reset_all()
{
    BoincUserSubmit::update_aux("logical_start_time=0");
    BoincBatch::update_aux("logical_start_time=0, logical_end_time=0");
    BoincWorkunit::update_aux("priority=0");
    BoincResult::update_aux("priority=0");
}
コード例 #3
0
function catchup()
{
    while (1) {
        $now = time();
        $wus = BoincWorkunit::enum("transition_time<{$now} limit 1");
        if (count($wus) == 0) {
            break;
        }
        echo "There are " . count($wus) . " WUs needing transition.\n";
        system("bin/transitioner --one_pass");
    }
    echo "Transitioner is caught up.\n";
}
コード例 #4
0
ファイル: credit.php プロジェクト: nicolas17/boincgit-test
function handle_result($resultid)
{
    $r = BoincResult::lookup_id($resultid);
    $w = BoincWorkunit::lookup_id($r->workunitid);
    $rs = BoincResult::enum("workunitid={$r->workunitid} and validate_state=1");
    $app_version_ids = array();
    foreach ($rs as $r) {
        show_result($r, $w);
        $app_version_ids[] = $r->app_version_id;
    }
    $app_version_ids = array_unique($app_version_ids);
    foreach ($app_version_ids as $avid) {
        show_av($avid);
    }
}
コード例 #5
0
function catchup()
{
    while (1) {
        $now = time();
        $wus = BoincWorkunit::enum("transition_time<{$now} limit 1");
        if (count($wus) == 0) {
            break;
        }
        echo "Some WUs need transition - running transitioner.\n";
        $ret = system("bin/transitioner --one_pass");
        echo "ret: {$ret}\n";
        sleep(1);
    }
    echo "Transitioner is caught up.\n";
}
コード例 #6
0
ファイル: server_status.php プロジェクト: suno/boinc
function get_job_status()
{
    $s = unserialize(get_cached_data(STATUS_PAGE_TTL, "job_status"));
    if ($s) {
        return $s;
    }
    $s = new StdClass();
    $apps = BoincApp::enum("deprecated=0");
    foreach ($apps as $app) {
        $info = BoincDB::get()->lookup_fields("result", "stdClass", "ceil(avg(elapsed_time)/3600*100)/100 as avg,\n            ceil(min(elapsed_time)/3600*100)/100 as min,\n            ceil(max(elapsed_time)/3600*100)/100 as max,\n            count(distinct userid) as users", "appid = {$app->id}\n            AND validate_state=1\n            AND received_time > (unix_timestamp()-86400)\n            ");
        $app->info = $info;
        $app->unsent = BoincResult::count("appid={$app->id} and server_state=2");
        $app->in_progress = BoincResult::count("appid={$app->id} and server_state=4");
    }
    $s->apps = $apps;
    $s->results_ready_to_send = BoincResult::count("server_state=2");
    $s->results_in_progress = BoincResult::count("server_state=4");
    $s->results_need_file_delete = BoincResult::count("file_delete_state=1");
    $s->wus_need_validate = BoincWorkunit::count("need_validate=1");
    $s->wus_need_assimilate = BoincWorkunit::count("assimilate_state=1");
    $s->wus_need_file_delete = BoincWorkunit::count("file_delete_state=1");
    $x = BoincDB::get()->lookup_fields("workunit", "stdClass", "MIN(transition_time) as min", "TRUE");
    $gap = (time() - $x->min) / 3600;
    if ($gap < 0 || $x->min == 0) {
        $gap = 0;
    }
    $s->transitioner_backlog = $gap;
    $s->users_with_recent_credit = BoincUser::count("expavg_credit>1");
    $s->users_with_credit = BoincUser::count("total_credit>1");
    $s->users_past_24_hours = BoincUser::count("create_time > (unix_timestamp() - 86400)");
    $s->hosts_with_recent_credit = BoincHost::count("expavg_credit>1");
    $s->hosts_with_credit = BoincHost::count("total_credit>1");
    $s->hosts_past_24_hours = BoincHost::count("create_time > (unix_timestamp() - 86400)");
    $s->flops = BoincUser::sum("expavg_credit") / 200;
    $s->db_revision = null;
    if (file_exists("../../db_revision")) {
        $s->db_revision = trim(file_get_contents("../../db_revision"));
    }
    $s->cached_time = time();
    $e = set_cached_data(STATUS_PAGE_TTL, serialize($s), "job_status");
    if ($e) {
        echo "set_cached_data(): {$e}\n";
    }
    return $s;
}
コード例 #7
0
ファイル: submit_rpc_handler.php プロジェクト: brevilo/boinc
function handle_abort_jobs($r)
{
    xml_start_tag("abort_jobs");
    list($user, $user_submit) = authenticate_user($r, null);
    $batch = null;
    foreach ($r->job_name as $job_name) {
        $job_name = BoincDb::escape_string($job_name);
        $wu = BoincWorkunit::lookup("name='{$job_name}'");
        if (!$wu) {
            xml_error(-1, "No job {$job_name}");
        }
        if (!$wu->batch) {
            xml_error(-1, "Job {$job_name} is not part of a batch");
        }
        if (!$batch || $wu->batch != $batch->id) {
            $batch = BoincBatch::lookup_id($wu->batch);
        }
        if (!$batch || $batch->user_id != $user->id) {
            xml_error(-1, "not owner");
        }
        echo "<aborted {$job_name}>\n";
        abort_workunit($wu);
    }
    echo "<success>1</success>\n        </abort_jobs>\n    ";
}
コード例 #8
0
ファイル: submit.php プロジェクト: CalvinZhu/boinc
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> &middot;\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} &middot; {$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();
}
コード例 #9
0
ファイル: workunit.php プロジェクト: Turante/boincweb
//
// 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/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
// show summary of a workunit
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/result.inc";
$wuid = get_int("wuid");
$wu = BoincWorkunit::lookup_id($wuid);
if (!$wu) {
    error_page("Can't find workunit");
}
page_head("Workunit {$wuid}");
$app = BoincApp::lookup_id($wu->appid);
start_table();
row2("name", $wu->name);
row2("application", $app->user_friendly_name);
row2("created", time_str($wu->create_time));
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
コード例 #10
0
ファイル: db_cleanse.php プロジェクト: CalvinZhu/boinc
function delete_results()
{
    db_init();
    $f = fopen('dbc_out.dat', 'r');
    while (1) {
        $x = fgets($f);
        if (!$x) {
            break;
        }
        $n = sscanf($x, "%d", $resid);
        if ($n != 1) {
            echo "bad line: {$x}\n";
            continue;
        }
        $result = BoincResult::lookup_id($resid);
        if (!$result) {
            echo "no result {$resultid}\n";
            continue;
        }
        $wu = BoincWorkunit::lookup_id($result->workunitid);
        if ($wu) {
            echo "result has WU: {$resid}\n";
            continue;
        }
        echo "deleting {$resid}\n";
        // uncomment the following to actually delete
        die("edit script to enable deletion\n");
        //_mysql_query("delete from result where id=$resid");
    }
}
コード例 #11
0
ファイル: gpu_list.php プロジェクト: entibasse/superhost
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 = "";
        if ($vendor == "cuda") {
            $v = "CUDA";
        } else {
            if ($vendor == "intel_gpu") {
                $v = "INTEL";
            } else {
                $v = "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 = new StdClass();
    $x->total = $total;
    $x->win = $win;
    $x->linux = $linux;
    $x->mac = $mac;
    return $x;
}
コード例 #12
0
ファイル: credit.php プロジェクト: maexlich/boinc-igemathome
function show_wu($wu_id)
{
    page_head("Workunit credit");
    $wu = BoincWorkunit::lookup_id($wu_id);
    $app = BoincApp::lookup_id($wu->appid);
    start_table();
    row2("App", "<a href=credit.php?app_id={$app->id}>{$app->user_friendly_name}</a>");
    end_table();
    echo "Results";
    start_table();
    table_header("Host", "App version", "Elapsed", "FLOPS est");
    $results = BoincResult::enum("workunitid={$wu->id} and validate_state=1");
    foreach ($results as $r) {
        table_row("<a href=credit.php?host_id={$r->hostid}>{$r->hostid}</a>", av_string($r->app_version_id), $r->elapsed_time, $r->flops_estimate);
    }
    end_table();
    page_tail();
}
コード例 #13
0
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";
}
コード例 #14
0
// 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;
    }
}
echo "Done - deleted {$ndel} results\n";
コード例 #15
0
ファイル: get_output.php プロジェクト: CalvinZhu/boinc
function get_wu_output_files($wu_id, $auth_str)
{
    $wu = BoincWorkunit::lookup_id($wu_id);
    if (!$wu) {
        die("no workunit {$wu_id}");
    }
    $batch = BoincBatch::lookup_id($wu->batch);
    if (!$batch) {
        die("no batch {$wu->batch}");
    }
    $user = BoincUser::lookup_id($batch->user_id);
    if (!$user) {
        die("no user {$batch->user_id}");
    }
    $x = md5($user->authenticator . $wu_id);
    echo "user authenticator= {$user->authenticator}, wu_id={$wu_id}<br/>";
    if ($x != $auth_str) {
        die("bad auth str: x={$x}, auth_str={$auth_str}");
    }
    $zip_basename = tempnam("/tmp", "boinc_wu_" . $wu->name . "_");
    $zip_filename = $zip_basename . ".zip";
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    $upload_dir = parse_config(get_config(), "<upload_dir>");
    if (!$wu->canonical_resultid) {
        die("no canonical result for wu {$wu->name}");
    }
    $result = BoincResult::lookup_id($wu->canonical_resultid);
    $names = get_outfile_names($result);
    foreach ($names as $name) {
        $path = dir_hier_path($name, $upload_dir, $fanout);
        if (is_file($path)) {
            system("nice -9 zip -jq {$zip_basename} {$path}");
        }
    }
    do_download($zip_filename);
    unlink($zip_filename);
    unlink($zip_basename);
}
コード例 #16
0
ファイル: template.php プロジェクト: JuhaSointusalo/boinc
function boinc_preprocess_views_view(&$vars, $hook)
{
    switch ($vars['name']) {
        case 'boinc_account_computers':
            switch ($vars['display_id']) {
                case 'page_1':
                case 'panel_pane_1':
                    $vars['empty'] = boincwork_views_host_list_empty_text();
                    break;
                case 'page_2':
                    $vars['empty'] = boincwork_views_host_list_empty_text('active');
                    break;
                case 'block_1':
                    $vars['empty'] = boincwork_views_host_list_empty_text('preferences');
                    break;
                default:
            }
            break;
        case 'boinc_account_tasks_all':
            $vars['empty'] = boincwork_views_task_list_empty_text();
            break;
        case 'boinc_friends':
            if ($vars['display_id'] == 'block_1') {
                $vars['header'] = boincuser_views_friends_block_header();
            }
            break;
        case 'boinc_host_list':
            if ($vars['display_id'] == 'page_2') {
                $vars['empty'] = boincwork_views_host_list_empty_text();
            } elseif ($vars['display_id'] == 'page_1') {
                $vars['empty'] = boincwork_views_host_list_empty_text('active');
            }
            break;
        case 'boinc_task':
            // Load view object (view data is not available in header / footer); execute view query
            $view = views_get_current_view();
            $view->execute();
            $result = reset($view->result);
            // Display the stderr output in the footer
            $vars['footer'] = '<h3>' . bts('Stderr output') . '</h3>';
            $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
            break;
        case 'boinc_teams':
            if ($vars['display_id'] == 'panel_pane_3') {
                $team_id = arg(2);
                $vars['header'] = boincteam_manage_admins_panel_header($team_id);
            }
            break;
        case 'boinc_workunit':
            ob_start();
            // Get the workunit ID from the URL
            $result_id = arg(1);
            require_boinc(array('util', 'boinc_db'));
            $wu = BoincWorkunit::lookup_id($result_id);
            project_workunit($wu);
            // Output of project_workunit() gets caught in the buffer
            $vars['footer'] = ob_get_clean();
        default:
    }
}
コード例 #17
0
ファイル: submit.php プロジェクト: nicolas17/boincgit-test
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();
}