function av_desc($gavid)
{
    if ($gavid >= 1000000) {
        $appid = (int) ($gavid / 1000000);
        $app = BoincApp::lookup_id($appid);
        if (!$app) {
            return tra("Anonymous platform, missing app");
        }
        $rsc_type = $gavid % 1000000;
        $r = rsc_name($rsc_type);
        return "{$app->user_friendly_name} (" . tra("anonymous platform") . ", {$r})";
    } else {
        $av = BoincAppVersion::lookup_id($gavid);
        if (!$av) {
            return tra("Missing app version");
        }
        $app = BoincApp::lookup_id($av->appid);
        if (!$app) {
            return tra("Missing app");
        }
        $platform = BoincPlatform::lookup_id($av->platformid);
        if (!$platform) {
            return tra("Missing platform");
        }
        $pc = strlen($av->plan_class) ? "({$av->plan_class})" : "";
        $v = number_format($av->version_num / 100, 2);
        return "{$app->user_friendly_name} {$v} {$platform->name} {$pc}";
    }
}
Exemplo n.º 2
0
function do_updates()
{
    $id = post_int("id");
    $app = BoincApp::lookup_id($id);
    if (!$app) {
        admin_error_page("no such app");
    }
    $n = post_str("deprecated", true) ? 1 : 0;
    $app->update("deprecated={$n}");
    $n = post_num("weight");
    $app->update("weight={$n}");
    $n = post_int("homogeneous_redundancy");
    $app->update("homogeneous_redundancy={$n}");
    $n = post_int("target_nresults");
    $app->update("target_nresults={$n}");
    $n = post_str("homogeneous_app_version", true) ? 1 : 0;
    $app->update("homogeneous_app_version={$n}");
    $n = post_str("non_cpu_intensive", true) ? 1 : 0;
    $app->update("non_cpu_intensive={$n}");
    $n = post_str("beta", true) ? 1 : 0;
    $app->update("beta={$n}");
    $n = post_str("fraction_done_exact", true) ? 1 : 0;
    $app->update("fraction_done_exact={$n}");
    echo "Application {$id} updated.\n        <p>\n        You must restart the project for this to take effect.\n    ";
}
Exemplo n.º 3
0
function user_row($u)
{
    $user = BoincUser::lookup_id($u->user_id);
    echo "\n        <tr>\n        <td>\n        <a href=manage_project.php?action=edit_form&user_id={$u->user_id}>{$user->name}</a>\n        (ID: {$user->id})\n        </td>\n    ";
    echo "<td>";
    if ($u->submit_all) {
        echo "All applications\n";
    } else {
        $uas = BoincUserSubmitApp::enum("user_id={$u->user_id}");
        foreach ($uas as $ua) {
            $app = BoincApp::lookup_id($ua->app_id);
            echo "{$app->name} ";
        }
        if (count($uas) == 0) {
            echo "---";
        }
    }
    echo "</td>\n";
    echo "<td>{$u->quota}</td>\n";
    echo "<td>{$u->max_jobs_in_progress}</td>\n";
    echo "<td>";
    if ($u->logical_start_time > time()) {
        echo local_time_str($u->logical_start_time);
    } else {
        echo "---";
    }
    echo "\n        </td>\n        </tr>\n    ";
}
Exemplo n.º 4
0
function user_row($u)
{
    $user = BoincUser::lookup_id($u->user_id);
    echo "\n        <tr>\n        <td>{$user->name} (ID: {$user->id})\n        <a href=manage_project.php?action=edit_form&user_id={$u->user_id}>Edit permissions</a>\n        </td>\n    ";
    echo "<td>";
    if ($u->submit_all) {
        echo "All applications\n";
    } else {
        $uas = BoincUserSubmitApp::enum("user_id={$u->user_id}");
        foreach ($uas as $ua) {
            $app = BoincApp::lookup_id($ua->app_id);
            echo "{$app->name} ";
        }
    }
    echo "</td>\n";
    echo "<td>{$u->quota}</td>\n";
    echo "<td>\n        </td>\n        </tr>\n    ";
}
Exemplo n.º 5
0
function process_batch($b)
{
    $app = BoincApp::lookup_id($b->app_id);
    if (!$app) {
        echo "no app for batch {$b->id}\n";
        return;
    }
    if ($b->fraction_done > 0 && $b->credit_canonical > 0) {
        $credit_total = $b->credit_canonical / $b->fraction_done;
        $fpops_total = $credit_total * (86400000000000.0 / 200);
    } else {
        $db = BoincDb::get();
        $fpops_total = $db->sum("workunit", "rsc_fpops_est*target_nresults", "where batch={$b->id}");
    }
    echo "batch {$b->id} fpops_total {$fpops_total}\n";
    if ($fpops_total == 0) {
        return;
    }
    // adjust the user's logical start time
    //
    $user = BoincUser::lookup_id($b->user_id);
    if (!$user) {
        die("no user {$b->user_id}\n");
    }
    $us = BoincUserSubmit::lookup_userid("{$user->id}");
    if (!$us) {
        die("no user submit record\n");
    }
    $lst = $us->logical_start_time;
    $cmd = "cd ../../bin; ./adjust_user_priority --user {$user->id} --flops {$fpops_total} --app {$app->name}";
    system($cmd);
    $us = BoincUserSubmit::lookup_userid("{$user->id}");
    $let = $us->logical_start_time;
    $let = (int) $let;
    // set the priority of workunits and results in this batch
    // to the user's new logical start time
    //
    $clause = "priority={$let} where batch={$b->id}";
    BoincResult::update_aux($clause);
    BoincWorkunit::update_aux($clause);
}
Exemplo n.º 6
0
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// 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/>.
// show details of an app
require_once '../inc/util_ops.inc';
$appid = get_int("appid");
$app = BoincApp::lookup_id($appid);
if (!$app) {
    admin_error_page("no such app");
}
admin_page_head("Details for {$app->name} ({$app->user_friendly_name})");
start_table();
row2("Min average efficiency", $app->min_avg_pfc);
echo "\n    <p>\n    In the list below, 'Credit scale factor' should\n    be roughly 1 for CPU versions, 0.1 for GPU versions.\n    If values are far outside this range,\n    you may have bad FLOPs estimates.\n    In this case, you may want to\n    <ol>\n    <li> <a href=job_times.php?appid={$appid}>Get a better FLOPs estimate</a>\n    <li> <a href=app_reset.php?appid={$appid}>reset credit statistics for this application</a>.\n    </ol>\n";
end_table();
echo "<h2>App versions</h2>\n";
$avs = BoincAppVersion::enum("appid={$appid}");
$avs = current_versions($avs);
foreach ($avs as $av) {
    $platform = BoincPlatform::lookup_id($av->platformid);
    start_table();
    row2("ID", $av->id);
Exemplo n.º 7
0
function get_templates($r)
{
    xml_start_tag("get_templates");
    $app_name = (string) $r->app_name;
    if ($app_name) {
        $app = get_submit_app($app_name);
    } else {
        $job_name = (string) $r->job_name;
        $wu = get_wu($job_name);
        $app = BoincApp::lookup_id($wu->appid);
    }
    list($user, $user_submit) = authenticate_user($r, $app);
    $in = file_get_contents(project_dir() . "/templates/" . $app->name . "_in");
    $out = file_get_contents(project_dir() . "/templates/" . $app->name . "_out");
    if ($in === false || $out === false) {
        xml_error(-1, "template file missing");
    }
    echo "<templates>\n{$in}\n{$out}\n</templates>\n        </get_templates>\n    ";
}
Exemplo n.º 8
0
function handle_show_all($user)
{
    $userid = get_int("userid");
    $appid = get_int("appid");
    $state = get_int("state");
    if ($userid) {
        // user looking at their own batches
        //
        if ($userid != $user->id) {
            error_page("wrong user");
        }
        $batches = BoincBatch::enum("user_id = {$user->id} and state={$state} order by id desc");
        fill_in_app_and_user_names($batches);
        show_batches_in_state($batches, $state);
    } else {
        // admin looking at batches
        //
        check_admin_access($user, $appid);
        if ($appid) {
            $app = BoincApp::lookup_id($appid);
            if (!$app) {
                error_page("no such app");
            }
            $batches = BoincBatch::enum("app_id = {$appid} and state={$state} order by id desc");
        } else {
            $batches = BoincBatch::enum("state={$state} order by id desc");
        }
        fill_in_app_and_user_names($batches);
        show_batches_in_state($batches, $state);
    }
}
Exemplo n.º 9
0
            echo "updated user {$user->id}\n";
        }
    }
}
function update_users($app_id)
{
    $n = 0;
    $maxid = BoincUser::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        $users = BoincUser::enum("id>={$n} and id<{$m}");
        foreach ($users as $user) {
            update_user($user, $app_id);
        }
        $n = $m;
    }
}
if ($argc != 2) {
    die("usage: app_select_edit.php app_id\n");
}
$app_id = $argv[1];
if (!BoincApp::lookup_id($app_id)) {
    die("No such app: {$app_id}\n");
}
// change comments below for testing
//echo get_new_prefs(BoincUser::lookup_id(1), $app_id);
// show the new project prefs for a user, but don't update DB
//update_user(BoincUser::lookup_id(1), $app_id);
// update DB for a particular user
update_users($app_id);
// update DB for all users
Exemplo n.º 10
0
function handle_query_batch($user)
{
    $batch_id = get_int('batch_id');
    $batch = BoincBatch::lookup_id($batch_id);
    $app = BoincApp::lookup_id($batch->app_id);
    $wus = BoincWorkunit::enum("batch = {$batch->id}");
    $batch = get_batch_params($batch, $wus);
    page_head("Batch {$batch_id}");
    start_table();
    row2("name", $batch->name);
    row2("application", $app->name);
    row2("state", batch_state_string($batch->state));
    row2("# jobs", $batch->njobs);
    row2("# error jobs", $batch->nerror_jobs);
    row2("progress", sprintf("%.0f%%", $batch->fraction_done * 100));
    if ($batch->completion_time) {
        row2("completed", local_time_str($batch->completion_time));
    }
    row2("GFLOP/hours, estimated", number_format(credit_to_gflop_hours($batch->credit_estimate), 2));
    row2("GFLOP/hours, actual", number_format(credit_to_gflop_hours($batch->credit_canonical), 2));
    row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id) / 1000000.0, 2));
    end_table();
    if (batch_output_file_size($batch->id) <= 100000000.0) {
        $url = boinc_get_output_files_url($user, $batch_id);
        show_button($url, "Get zipped output files");
    } else {
        echo "<br/>The output file size of this batch is too big, it will be uploaded by FTP<br/>";
    }
    switch ($batch->state) {
        case BATCH_STATE_IN_PROGRESS:
            echo "<br>";
            show_button("submit.php?action=abort_batch_confirm&batch_id={$batch_id}", "Abort batch");
            break;
        case BATCH_STATE_COMPLETE:
        case BATCH_STATE_ABORTED:
            echo "<br>";
            show_button("submit.php?action=retire_batch_confirm&batch_id={$batch_id}", "Retire batch");
            break;
    }
    echo "<h2>Jobs</h2>\n";
    start_table();
    table_header("Job ID and name<br><span class=note>click for details or to get output files</span>", "status", "Canonical instance<br><span class=note>click to see result page on BOINC server</span>", "Download Results");
    foreach ($wus as $wu) {
        $resultid = $wu->canonical_resultid;
        $durl = boinc_get_wu_output_files_url($user, $wu->id);
        if ($resultid) {
            $x = "<a href=result.php?resultid={$resultid}>{$resultid}</a>";
            $y = '<font color="green">completed</font>';
            $text = "<a href={$durl}> Download Result Files</a>";
        } else {
            $x = "---";
            $text = "---";
            if ($batch->state == BATCH_STATE_COMPLETE) {
                $y = '<font color="red">failed</font>';
            } else {
                $y = "in progress";
            }
        }
        echo "<tr>\n                <td><a href=submit.php?action=query_job&wuid={$wu->id}>{$wu->id} &middot; {$wu->name}</a></td>\n                <td>{$y}</td>\n                <td>{$x}</td>\n                <td>{$text}</td>\n            </tr>\n        ";
    }
    end_table();
    echo "<p><a href=submit.php>Return to job control page</a>\n";
    page_tail();
}
Exemplo n.º 11
0
function show_appl($app_id)
{
    $app = BoincApp::lookup_id($app_id);
    page_head("App {$app->user_friendly_name} credit");
    $avs = BoincAppVersion::enum("appid={$app_id} and deprecated=0");
    start_table();
    table_header("platform/class/version", "PFC nsamples", "PFC avg", "PFC scale");
    $avs = current_versions($avs);
    foreach ($avs as $av) {
        $plat = BoincPlatform::lookup_id($av->platformid);
        table_row("<a href=credit.php?av_id={$av->id}>{$plat->user_friendly_name} {$av->plan_class} {$av->version_num}</a>", $av->pfc_n, $av->pfc_avg, $av->pfc_scale);
    }
    end_table();
    page_tail();
}
Exemplo n.º 12
0
function print_batch_params($batch)
{
    $app = BoincApp::lookup_id($batch->app_id);
    if (!$app) {
        $app->name = "none";
    }
    echo "\n        <id>{$batch->id}</id>\n        <create_time>{$batch->create_time}</create_time>\n        <est_completion_time>{$batch->est_completion_time}</est_completion_time>\n        <njobs>{$batch->njobs}</njobs>\n        <fraction_done>{$batch->fraction_done}</fraction_done>\n        <nerror_jobs>{$batch->nerror_jobs}</nerror_jobs>\n        <state>{$batch->state}</state>\n        <completion_time>{$batch->completion_time}</completion_time>\n        <credit_estimate>{$batch->credit_estimate}</credit_estimate>\n        <credit_canonical>{$batch->credit_canonical}</credit_canonical>\n        <name>{$batch->name}</name>\n        <app_name>{$app->name}</app_name>\n";
}