Exemple #1
0
function show_assign($asgn)
{
    $when = time_str($asgn->create_time);
    switch ($asgn->target_type) {
        case 0:
            $x = "All hosts";
            break;
        case 1:
            $x = "<a href=db_action.php?table=host&id={$asgn->id}>Host {$asgn->target_id}</a>";
            break;
        case 2:
            if ($asgn->multi) {
                $y = "All hosts belonging to ";
            } else {
                $y = "One host belonging to ";
            }
            $x = "{$y}<a href=db_action.php?table=user&id={$asgn->target_id}>Host {$asgn->target_id}</a>";
            break;
        case 3:
            if ($asgn->multi) {
                $y = "All hosts belonging to ";
            } else {
                $y = "One host belonging to ";
            }
            $x = "{$y}<a href=db_action.php?table=team&id={$asgn->target_id}>Team {$asgn->target_id}</a>";
            break;
    }
    echo "<tr>\n        <td>{$asgn->id} (created {$when})</td>\n        <td>{$x}</td>\n        <td><a href=db_action.php?table=workunit&id={$asgn->workunitid}>{$asgn->workunitid}</a></td>\n        <td><a href=db_action.php?table=result&id={$asgn->resultid}>{$asgn->resultid}</a></td>\n        </tr>\n    ";
}
Exemple #2
0
function send_problem_email($user, $host)
{
    global $master_url;
    $body = "";
    $host_content = "ID: " . $host->id . "\n    Created: " . time_str($host->create_time) . "\n    Venue: " . $host->venue . "\n    Total credit: " . $host->total_credit . "\n    Average credit: " . $host->expavg_credit . "\n    Average update time: " . time_str($host->expavg_time) . "\n    IP address: {$host->last_ip_addr} (same the last {$host->nsame_ip_addr} times)\n    Domain name: " . $host->domain_name;
    $x = $host->timezone / 3600;
    if ($x >= 0) {
        $x = "+{$x}";
    }
    $host_content .= "\n    Local Time = UTC {$x} hours\n    Number of CPUs: " . $host->p_ncpus . "\n    CPU: {$host->p_vendor} {$host->p_model}\n    FP ops/sec: " . $host->p_fpops . "\n    Int ops/sec: " . $host->p_iops . "\n    memory bandwidth: " . $host->p_membw . "\n    Operating System: {$host->os_name} {$host->os_version}";
    $x = $host->m_nbytes / (1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Memory: {$y} MB";
    $x = $host->m_cache / 1024;
    $y = round($x, 2);
    $host_content .= "\n    Cache: {$y} KB";
    $x = $host->m_swap / (1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Swap Space: {$y} MB";
    $x = $host->d_total / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Total Disk Space: {$y} GB";
    $x = $host->d_free / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Free Disk Space: {$y} GB\n    Avg network bandwidth (upstream): {$host->n_bwup} bytes/sec\n    Avg network bandwidth (downstream): {$host->n_bwdown} bytes/sec";
    $x = $host->avg_turnaround / 86400;
    $host_content .= "\n    Average turnaround: " . round($x, 2) . " days\n    Number of RPCs: {$host->rpc_seqno}\n    Last RPC: " . time_str($host->rpc_time) . "\n    % of time client on: " . 100 * $host->on_frac . " %\n    % of time host connected: " . 100 * $host->connected_frac . " %\n    % of time user active: " . 100 * $host->active_frac . " %\n    # of results today: " . $host->nresults_today;
    $subject = PROJECT . " notice for {$user->name}";
    $body = PROJECT . " notification:\n\nDear {$user->name}\nYour machine (host # {$host->id}) described below appears to have a misconfigured BOINC\ninstallation.  Could you please have a look at it?\n\nSincerely,\n        The " . PROJECT . " team\n";
    $body .= "\n\nThis is the content of our database:\n" . $host_content . "\n\nFor further information and assistance with " . PROJECT . " go to {$master_url}";
    echo nl2br($body) . "<br><br>";
    return send_email($user, $subject, $body);
}
function show_user($user)
{
    echo "\n        <tr class=row1>\n        <td>", user_links($user), " (ID {$user->id})</td>\n    ";
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
        echo "\n            <td> <a href=team_display.php?teamid={$team->id}>{$team->name}</a> </td>\n        ";
    } else {
        echo "<td><br></td>";
    }
    echo "\n        <td align=right>", format_credit($user->expavg_credit), "</td>\n        <td align=right>", format_credit_large($user->total_credit), "</td>\n        <td>", $user->country, "</td>\n        <td>", time_str($user->create_time), "</td>\n        </tr>\n    ";
}
function show_delta($delta)
{
    global $xml;
    $user = BoincUser::lookup_id($delta->userid);
    $when = time_str($delta->timestamp);
    $what = $delta->joining ? "joined" : "quit";
    if ($xml) {
        echo "    <action>\n        <id>{$user->id}</id>\n        <name>{$user->name}</name>\n        <action>{$what}</action>\n        <total_credit>{$delta->total_credit}</total_credit>\n        <when>{$when}</when>\n    </action>\n";
    } else {
        echo "<tr>\n           <td>{$when}</td>\n           <td>", user_links($user), " (ID {$user->id})</td>\n           <td>{$what}</td>\n           <td>{$delta->total_credit}</td>\n           </tr>\n        ";
    }
}
Exemple #5
0
function show_batches($user)
{
    $batches = BoincBatch::enum("user_id={$user->id}");
    page_head("Batches");
    start_table();
    table_header("Batch ID", "Submitted", "# jobs");
    foreach ($batches as $batch) {
        echo "<tr>\n            <td><a href=submit_status.php?action=show_batch&batch_id={$batch->id}>{$batch->id}</a></td>\n            <td>" . time_str($batch->create_time) . "</td>\n            <td>{$batch->njobs}</td>\n            </tr>\n        ";
    }
    end_table();
    page_tail();
}
Exemple #6
0
function show_user_row($user, $i)
{
    echo '
		<tr class="row1">
		<td>$i</td>
		<td>' . user_links($user) . '</td>
		<td class="right">' . format_credit_large($user->expavg_credit) . '</td>
		<td class="right">' . format_credit_large($user->total_credit) . '</td>
		<td>' . $user->country . '</td>
		<td>' . time_str($user->create_time) . '</td>
		</tr>
	';
}
function main()
{
    echo "------------ Starting at " . time_str(time()) . "-------\n";
    $f = fopen("temp.xml", "w");
    $teams = BoincTeam::enum(null);
    fwrite($f, "<teams>\n");
    foreach ($teams as $team) {
        handle_team($team, $f);
    }
    fwrite($f, "</teams>\n");
    fclose($f);
    if (!rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml")) {
        echo "Rename failed\n";
    }
}
Exemple #8
0
function list_files($user, $err_msg)
{
    $dir = sandbox_dir($user);
    $d = opendir($dir);
    if (!$d) {
        error_page("Can't open sandbox directory");
    }
    page_head("file sandbox for {$user->name}");
    echo "\n        <form action=sandbox.php method=post ENCTYPE=\"multipart/form-data\">\n        <input type=hidden name=action value=upload_file>\n        Upload a file to your sandbox:\n        <p><input size=80 type=file name=new_file>\n        <p> <input type=submit value=Upload>\n        </form>\n        <hr>\n    ";
    if (strcmp($err_msg, "") != 0) {
        echo "<p>{$err_msg}<hr>";
    }
    $files = array();
    while (($f = readdir($d)) !== false) {
        if ($f == '.') {
            continue;
        }
        if ($f == '..') {
            continue;
        }
        $files[] = $f;
    }
    if (count($files) == 0) {
        echo "Your sandbox is currently empty.";
    } else {
        sort($files);
        start_table();
        table_header("Name<br><span class=note>(click to view)</span>", "Modified", "Size (bytes)", "MD5", "Delete", "Download");
        foreach ($files as $f) {
            $path = "{$dir}/{$f}";
            list($error, $size, $md5) = sandbox_parse_link_file($path);
            if ($error) {
                table_row($f, "Can't parse link file", "", "<a href=sandbox.php?action=delete_files&name={$f}>delete</a>");
                continue;
            }
            $p = sandbox_physical_path($user, $md5);
            if (!is_file($p)) {
                table_row($f, "Physical file not found", "", "");
                continue;
            }
            $ct = time_str(filemtime($path));
            table_row("<a href=sandbox.php?action=view_file&name={$f}>{$f}</a>", $ct, $size, $md5, button_text("sandbox.php?action=delete_file&name={$f}", "Delete"), button_text("sandbox.php?action=download_file&name={$f}", "Download"));
        }
        end_table();
    }
    page_tail();
}
Exemple #9
0
function show_view($view)
{
    if ($view->end_time) {
        $d = $view->end_time - $view->start_time;
        $dur = "{$d} seconds";
    } else {
        $dur = "---";
    }
    if ($view->result_id) {
        $result = BoltResult::lookup_id($view->result_id);
        $qs = str_replace("action=answer", "action=answer_page", $result->response);
        $score = number_format($result->score * 100);
        $x = "<br>Score: {$score}%\n\t\t\t<br><a href=bolt_sched.php?{$qs}>Answer page</a>";
    }
    echo "<tr>\n\t\t<td valign=top>{$view->id}</td>\n\t\t<td valign=top>" . time_str($view->start_time) . "</td>\n\t\t<td valign=top>{$dur}</td>\n\t\t<td valign=top>{$view->item_name}</td>\n\t\t<td valign=top>" . mode_name($view->mode) . " {$x}</td>\n\t";
    //<td valign=top>".phase_name($view->phase)."</td>
    echo "\n\t\t<td valign=top>" . action_name($view->action) . "</td>\n\t\t</tr>\n\t";
}
Exemple #10
0
// 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/>.
// lock all threads older than N days
$cli_only = true;
require_once "../inc/util_ops.inc";
$max_age_days = 90;
// lock threads older than this
if ($argc > 2) {
    if ($argv[1] == "--ndays") {
        $max_age_days = $argv[2];
    }
}
$t = time_str(time());
echo "starting at {$t}\n";
$t = time() - $max_age_days * 86400;
$db = BoincDb::get();
if (!$db) {
    die("can't open DB\n");
}
$db->do_query("update " . $db->db_name . ".thread, " . $db->db_name . ".forum set " . $db->db_name . ".thread.locked=1 where " . $db->db_name . ".thread.forum=" . $db->db_name . ".forum.id and " . $db->db_name . ".forum.parent_type=0 and " . $db->db_name . ".thread.timestamp<{$t} and " . $db->db_name . ".thread.locked=0 and " . $db->db_name . ".thread.sticky=0");
$n = $db->affected_rows();
$t = time_str(time());
echo "finished at {$t}; locked {$n} threads\n";
Exemple #11
0
function batches_form($app)
{
    page_head("Manage jobs for {$app->name}");
    echo "\n        <form action=manage_app.php>\n        <input type=hidden name=action value=batches_action>\n        <input type=hidden name=app_id value={$app->id}>\n    ";
    start_table();
    table_header("Batch ID", "Submitter", "Submitted", "State", "# jobs", "Abort?");
    $batches = BoincBatch::enum("app_id={$app->id}");
    foreach ($batches as $batch) {
        $user = BoincUser::lookup_id($batch->user_id);
        echo "<tr>\n            <td>{$batch->id}</td>\n            <td>{$user->name}</td>\n            <td>" . time_str($batch->create_time) . "</td>\n            <td>" . batch_state_string($batch->state) . "\n            <td>{$batch->njobs}</td>\n            <td><input type=checkbox name=abort_{$batch->id}></td>\n            </tr>\n        ";
    }
    echo "<tr>\n        <td colspan=5>Abort all jobs for {$app->name}?</td>\n        <td><input type=checkbox name=abort_all></td>\n        </tr>\n    ";
    echo "<tr>\n        <td><br></td>\n        <td><br></td>\n        <td><br></td>\n        <td><input class=\"btn btn-default\" type=submit value=OK></td>\n        </tr>\n    ";
    end_table();
    page_tail();
}
Exemple #12
0
function qcn_trigger_detail(&$res, $bg_color, $auth, $user, $bDownloadAll)
{
    global $unixtimeArchive;
    if ($auth || $user->id == $res->hostid) {
        $loc_res = 4;
    } else {
        $loc_res = 2;
    }
    // CMC took out hostnamebyid below
    $sensor_type = $res->sensor_description;
    $archpre = $res->is_archive ? "a" : "r";
    // prefix to signify if it's an archive record or not
    $file_url = get_file_url($res);
    if ($auth) {
        if ($bDownloadAll) {
            echo "<input type=\"hidden\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"{$res->triggerid}\"" . ">\n";
            //echo "<tr><td><input type=\"hidden\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"$res->triggerid\"" .
            //     "></font size></td></tr>\n";
            return;
        } else {
            echo "\n        <tr bgcolor=\"" . $bg_color . "\">\n";
            echo "\n        <td><font size=\"1\"><input type=\"checkbox\" name=\"cb_" . $archpre . "_reqfile[]\" id=\"cb_" . $archpre . "_reqfile[]\" value=\"{$res->triggerid}\"" . ($res->varietyid != 0 || $res->received_file == 100 || $res->trigger_timereq > 0 || $res->trigger_time < $unixtimeArchive ? " disabled " : " ") . "></font size></td>\n        <td><font size=\"1\"><input type=\"checkbox\" name=\"cb_" . $archpre . "_dlfile[]\" id=\"cb_" . $archpre . "_dlfile[]\" value=\"{$res->triggerid}\"" . ($res->received_file != 100 || file_url == "N/A" ? " disabled " : ($bDownloadAll ? " checked " : " ")) . "></font size></td>";
        }
    }
    echo "\n        <td><font size=\"1\">{$res->triggerid}</font size></td>";
    echo "<td><font size=\"1\"><a href=\"show_host_detail.php?hostid={$res->hostid}\">" . $res->hostid . "</a></font size></td>";
    if ($auth) {
        echo "   <td><font size=\"1\">{$res->ipaddr}<br>{$res->hostname}</font size></td>";
    }
    //    echo "<td><font size=\"1\">$res->result_name</font size></td>";
    echo "\n        <td><font size=\"1\">" . time_str($res->trigger_time) . "</font size></td>\n        <td><font size=\"1\">" . round($res->delay_time, 2) . "</font size></td>\n        <td><font size=\"1\">" . time_str($res->trigger_sync) . "</font size></td>\n        <td><font size=\"1\">" . round($res->sync_offset, 2) . "</font size></td>\n        <td><font size=\"1\">" . round($res->trigger_mag, 2) . "</font size></td>\n        <td><font size=\"1\">" . round($res->significance, 2) . "</font size></td>\n        <td><font size=\"1\">" . round($res->trigger_lat, $loc_res) . "</font size></td>\n        <td><font size=\"1\">" . round($res->trigger_lon, $loc_res) . "</font size></td>\n        <td><font size=\"1\">" . ($res->numreset ? $res->numreset : 0) . "</font size></td>\n        <td><font size=\"1\">{$res->delta_t}</font size></td>\n        <td><font size=\"1\">{$sensor_type}</font size></td>\n        <td><font size=\"1\">{$res->sw_version}</font size></td>\n        <td><font size=\"1\">{$res->is_geoip}<font size></td>";
    echo "\n        <td><font size=\"1\">" . time_str($res->trigger_timereq) . "</font size></td>";
    //      echo"  <td><font size=\"1\">" . ($res->received_file == 100 ? " Yes " : " No " ) . "</font size></td>";
    if ($file_url != "N/A") {
        echo "<td><font size=\"1\"><a href=\"" . $file_url . "\">Download</a></font size></td>";
        echo "<td><font size=\"1\"><a href=\"javascript:void(0)\"onclick=\"window.open('" . BASEURL . "/earthquakes/view/view_data.php?dat=" . basename($file_url) . "&fthumb=340','linkname','height=550,width=400,scrollbars=no')\">View</a></font size></td>";
    } else {
        echo "<td><font size=\"1\">N/A</font size></td>";
        echo "<td><font size=\"1\">N/A</font size></td>";
    }
    if ($res->qcn_quakeid) {
        echo "<td><font size=\"1\"><A HREF=\"{$res->quake_url}\">{$res->qcn_quakeid}</A></font size></td>";
        echo "<td><font size=\"1\">" . round($res->quake_distance_km, 2) . "</font size></td>";
        echo "<td><font size=\"1\">" . round($res->quake_magnitude, 2) . "</font size></td>";
        echo "<td><font size=\"1\">" . time_str($res->quake_time) . "</font size></td>";
        echo "<td><font size=\"1\">" . round($res->quake_lat, $loc_res) . "</font size></td>";
        echo "<td><font size=\"1\">" . round($res->quake_lon, $loc_res) . "</font size></td>";
        echo "<td><font size=\"1\">{$res->description}</font size></td>";
        //           echo "<td><font size=\"1\">$res->guid</font size></td>";
        echo "<td><font size=\"1\">" . ($res->is_archive ? "Y" : "N") . "</font size></td>";
    } else {
        echo "<td><font size=\"1\">N/A</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">&nbsp</font size></td>";
        //           echo "<td><font size=\"1\">&nbsp</font size></td>";
        echo "<td><font size=\"1\">" . ($res->is_archive ? "Y" : "N") . "</font size></td>";
    }
    echo "</tr>\n    ";
}
Exemple #13
0
function show_status_html($x)
{
    page_head(tra("Project status"));
    $j = $x->jobs;
    $daemons = $x->daemons;
    start_table();
    echo "<tr><td width=50% valign=top>\n         <h2>" . tra("Server status") . "</h2>\n    ";
    start_table();
    table_header(tra("Program"), tra("Host"), tra("Status"));
    foreach ($daemons->local_daemons as $d) {
        daemon_html($d);
    }
    foreach ($daemons->remote_daemons as $d) {
        daemon_html($d);
    }
    foreach ($daemons->disabled_daemons as $d) {
        daemon_html($d);
    }
    end_table();
    if ($j->db_revision) {
        echo tra("Database schema version: "), $j->db_revision;
    }
    if ($daemons->cached_time) {
        echo "<br>Remote daemon status as of ", time_str($daemons->cached_time);
    }
    if ($daemons->missing_remote_status) {
        echo "<br>Status of remote daemons is missing\n";
    }
    if (function_exists('server_status_project_info')) {
        echo "<br>";
        server_status_project_info();
    }
    echo "</td><td>\n";
    echo "<h2>" . tra("Computing status") . "</h2>\n";
    start_table();
    echo "<tr><td>\n";
    start_table();
    table_header(tra("Work"), "#");
    item_html("Tasks ready to send", $j->results_ready_to_send);
    item_html("Tasks in progress", $j->results_in_progress);
    item_html("Workunits waiting for validation", $j->wus_need_validate);
    item_html("Workunits waiting for assimilation", $j->wus_need_assimilate);
    item_html("Workunits waiting for file deletion", $j->wus_need_file_delete);
    item_html("Tasks waiting for file deletion", $j->results_need_file_delete);
    item_html("Transitioner backlog (hours)", number_format($j->transitioner_backlog, 2));
    end_table();
    echo "</td><td>\n";
    start_table();
    table_header(tra("Users"), "#");
    item_html("With credit", $j->users_with_credit);
    item_html("With recent credit", $j->users_with_recent_credit);
    item_html("Registered in past 24 hours", $j->users_past_24_hours);
    table_header(tra("Computers"), "#");
    item_html("With credit", $j->hosts_with_credit);
    item_html("With recent credit", $j->hosts_with_recent_credit);
    item_html("Registered in past 24 hours", $j->hosts_past_24_hours);
    item_html("Current GigaFLOPS", round($j->flops, 2));
    end_table();
    end_table();
    start_table();
    echo "<tr><th colspan=5>" . tra("Tasks by application") . "</th></tr>\n";
    table_header(tra("Application"), tra("Unsent"), tra("In progress"), tra("Runtime of last 100 tasks in hours: average, min, max"), tra("Users in last 24 hours"));
    $i = 0;
    foreach ($j->apps as $app) {
        $avg = round($app->info->avg, 2);
        $min = round($app->info->min, 2);
        $max = round($app->info->max, 2);
        $x = $max ? "{$avg} ({$min} - {$max})" : "---";
        $u = $app->info->users;
        echo "<tr class=row{$i}>\n            <td>{$app->user_friendly_name}</td>\n            <td>{$app->unsent}</td>\n            <td>{$app->in_progress}</td>\n            <td>{$x}</td>\n            <td>{$u}</td>\n            </tr>\n        ";
        $i = 1 - $i;
    }
    end_table();
    echo "<p>Task data as of " . time_str($j->cached_time);
    echo "</td></tr>\n";
    end_table();
    page_tail();
}
Exemple #14
0
// 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/>.
// limit a given host to 1 job per day
// TODO: document; use new DB interface
include_once "../inc/db.inc";
include_once "../inc/util.inc";
include_once "../inc/db_ops.inc";
include_once "../inc/util_ops.inc";
include_once "../inc/prefs.inc";
db_init();
if (get_int('hostid')) {
    $hostid = get_int('hostid');
} else {
    error_page("no hostid");
}
$timestr = time_str(time(0));
$title = "host " . $hostid . " max_results_day set to 1 at " . $timestr;
admin_page_head($title);
if ($hostid > 0) {
    $result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=" . $hostid);
}
echo $title;
admin_page_tail();
Exemple #15
0
    $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), $cache_args);
}
echo "<br/>";
echo "<form method=\"get\" action=\"errorwus.php\">\n";
print_checkbox("Hide canceled WUs", "hide_canceled", $hide_canceled);
print_checkbox("Hide WUs with only d/l errors", "hide_dlerr", $hide_dlerr);
if ($appid) {
    echo "<input type=\"hidden\" name=\"appid\" value=\"{$appid}\"/>";
}
echo "<input type=\"hidden\" name=\"level\" value=\"{$notification_level}\"/>";
echo "<input class=\"btn btn-default\" type=\"submit\" value=\"OK\">\n";
echo "</form>\n";
echo "Page last updated " . time_str($last_update);
if (!in_rops()) {
    echo "<form action=\"cancel_workunits_action.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"back\" value=\"errorwus\"/>";
}
echo "<br/><table border=\"1\">\n";
echo "<tr><th>WU ID</th><th>WU name</th><th>App ID</th><th>Quorum</th><th>Unsent</th><th>In Progress</th><th>Success</th>";
echo "<th>Download Errors</th><th>Compute Errors</th><th>Validate Errors</th><th>Error mask</th></tr>\n";
$hidden = 0;
foreach ($row_array as $row) {
    if ($hide_canceled == 'on' && ($row->error_mask & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED) {
        $hidden++;
        continue;
    }
    if ($hide_dlerr == 'on' && $row->download_errors > 0 && $row->compute_errors == 0 && $row->validate_errors == 0) {
        $hidden++;
// 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/>.
// script to decay exponential average per-app credit
require_once "../inc/boinc_db.inc";
require_once "../inc/credit.inc";
require_once "../inc/util.inc";
function decay($is_user)
{
    $now = time();
    if ($is_user) {
        $cs = BoincCreditUser::enum("");
    } else {
        $cs = BoincCreditTeam::enum("");
    }
    foreach ($cs as $c) {
        update_average($now, 0, 0, $c->expavg, $c->expavg_time);
        if ($is_user) {
            $c->update("expavg={$c->expavg}, expavg_time={$c->expavg_time} where userid={$c->userid} and appid={$c->appid}");
        } else {
            $c->update("expavg={$c->expavg}, expavg_time={$c->expavg_time} where teamid={$c->teamid} and appid={$c->appid}");
        }
    }
}
echo "Starting: ", time_str(time()), "\n";
decay(true);
decay(false);
echo "Ending: ", time_str(time()), "\n";
Exemple #17
0
}
$now = time();
$xmlstring = "<server_status>\n  <update_time>{$now}</update_time>\n";
if ($version) {
    $xmlstring .= "<software_version>{$version}</software_version>\n";
}
$xmlstring .= "  <daemon_status>\n";
if ($xml) {
    xml_header();
    echo $xmlstring;
} else {
    page_head(tra("Project status"));
    if ($version) {
        echo tra("Server software version: %1", $version) . " / ";
    }
    echo time_str(time()), "\n        <table width=100%>\n        <tr>\n        <td width=40% valign=top>\n        <h2>" . tra("Server status") . "</h2>\n        <table border=0 cellpadding=4>\n        <tr><th>" . tra("Program") . "</th><th>" . tra("Host") . "</th><th>" . tra("Status") . "</th></tr>\n    ";
}
// Are the data-driven web sites running? Check for existence of stop_web.
// If it is there, set $web_running to -1 for "disabled",
// otherwise it will be already set to 1 for "enabled."
// Set $www_host to the name of server hosting WWW site.
//
$web_running = !file_exists("../../stop_web");
if ($web_running == 0) {
    $web_running = -1;
}
show_status($www_host, tra("data-driven web pages"), $web_running);
// Check for httpd.pid file of upload/download server.
//
$uldl_running = file_exists($uldl_pid);
if ($uldl_running == 0) {
function show_bossa_user()
{
    $user_id = get_int('user_id');
    $app_id = get_int('app_id');
    $user = BoincUser::lookup_id("{$user_id}");
    BossaUser::lookup($user);
    $app = BossaApp::lookup_id($app_id);
    include_app_file($app_id);
    admin_page_head("{$user->name} ({$app->name})");
    $x = user_summary($user);
    if ($x) {
        echo "User info: {$x}<br>";
    }
    $insts = BossaJobInst::enum("user_id={$user_id}");
    start_table();
    table_header("Job", "Calibration?", "Start", "Duration", "Response");
    foreach ($insts as $inst) {
        $job = BossaJob::lookup_id($inst->job_id);
        table_row("{$inst->job_id} <a href=bossa_admin.php?action=job_show_insts&job_id={$inst->job_id}>(details)</a><br>" . job_summary($job), calibration_job_string($inst, $job), time_str($inst->create_time), job_duration($inst), instance_summary($inst->get_opaque_data()));
    }
    end_table();
    admin_page_tail();
}
        if ($workunitquery) {
            $workunit = mysql_fetch_object($workunitquery);
            if ($workunit) {
                $prefix = '<a href="queue_show_job.php?workunitid=' . $job->workunit . '">';
                $workunitname = $prefix . workunit_name($workunit) . '</a>';
                $status = workunit_status_string($workunit);
                if ($status == "running") {
                    $status = "<font color='green'><b>" . $status . "</b></font>";
                }
                if ($status == "queued") {
                    $status = "<font color='blue'><b>" . $status . "</b></font>";
                }
                if ($status == "ERROR") {
                    $status = "<font color='red'><b>" . $status . "</b></font>";
                }
                $jobsubmittime = time_str($workunit->create_time);
            } else {
                $workunitname = "<font color='red'>WORKUNIT NOT FOUND IN DATABASE</font>";
                $status = "<font color='red'>UNKNOWN</font>";
                $jobsubmittime = "<font color='red'>UNKNOWN</font>";
            }
            mysql_free_result($workunitquery);
        }
        $workunitstring = "<a href=workunit.php?wuid=" . $job->workunit . ">" . $job->workunit . "</a>";
        row5($jobindex + 1, $jobsubmittime, $status, $workunitname, $workunitstring);
    }
} else {
    row1("You have NO jobs listed !<br>");
}
end_table();
$max_jobs = max_nr_of_jobs_of_user($user);
if ($is_admin) {
    echo "</tr><td colspan={$Nbf} align='RIGHT'>\n        <input name='special_user' type='SUBMIT' value='Apply'>\n        </td></tr>\n    ";
}
end_table();
echo "</form>\n";
echo "\n\n</td><td valign='TOP'>\n\n";
// Suspended posting privileges
echo "<form name='banishment' action=manage_user.php method=\"POST\">\n    <input type='hidden' name='userid' value='" . $user->id . "'>\n";
start_table();
row1("Suspension: {$user->name}");
if ($user->prefs->banished_until) {
    $dt = $user->prefs->banished_until - time();
    if ($dt > 0) {
        $x = " Suspended until " . time_str($user->prefs->banished_until) . "<br/> (Expires in " . time_diff($dt) . ")";
    } else {
        $x = " last suspended " . time_str($user->prefs->banished_until);
    }
    row1($x);
} else {
    $dt = 0;
}
echo "<tr><td>\nSuspend user for:\n <blockquote>\n        <input type='radio' name='suspend_for' value='3600'> 1 hour   <br/>\n        <input type='radio' name='suspend_for' value='7200'> 2 hours  <br/>\n        <input type='radio' name='suspend_for' value='18000'> 6 hours  <br/>\n        <input type='radio' name='suspend_for' value='36000'> 12 hours  <br/>\n        <input type='radio' name='suspend_for' value='86400'> 24 hours  <br/>\n";
if ($is_admin) {
    // in case we are only a moderator
    echo "\n        <input type='radio' name='suspend_for' value='172800'> 48 hours  <br/>\n        <input type='radio' name='suspend_for' value='", 86400 * 7, "'> 1 week  <br/>\n        <input type='radio' name='suspend_for' value='", 86400 * 14, "'> 2 weeks  <br/>\n";
}
if ($dt > 0) {
    echo "\n        <input type='radio' name='suspend_for' value='-1'>  <b>unsuspend</b>   <br/>";
}
echo "\n </blockquote>\n\n";
echo "<P>Reason (required):\n";
Exemple #21
0
function show_tasks()
{
    page_head("File transfers");
    table_start();
    table_header(array("ID", "Created", "File", "Local", "Remote", "Status", "Last error"));
    $tasks = task_enum();
    foreach ($tasks as $task) {
        $store = store_lookup_id($task->local_store_id);
        table_row(array($task->id, time_str($task->create_time), $task->file_name, $store->name, $task->remote_site . ': ' . $task->remote_store, task_status($task), $task->last_error . ' (' . time_str($task->last_error_time) . ')'));
    }
    table_end();
    if (count($tasks) == 0) {
        echo "No tasks";
    }
    page_tail();
}
Exemple #22
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("logical end time", time_str($batch->logical_end_time));
    row2("expiration time", time_str($batch->expire_time));
    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><p class=\"text-muted\">click for details or to get output files</p>", "status", "Canonical instance<br><p class=\"text-muted\">click to see result page on BOINC server</p>", "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();
}
Exemple #23
0
function show_user_row($user, $i)
{
    echo "\n        <tr class=row1>\n        <td>{$i}</td>\n        <td>", user_links($user), "</td>\n        <td align=right>", format_credit_large($user->expavg_credit), "</td>\n        <td align=right>", format_credit_large($user->total_credit), "</td>\n        <td>", $user->country, "</td>\n        <td>", time_str($user->create_time), "</td>\n        </tr>\n    ";
}
Exemple #24
0
echo "<input class=\"btn btn-default\" type=\"submit\" value=\"Display\">\n";
echo "</form>\n";
$query = "SELECT * FROM user ORDER BY create_time DESC LIMIT {$limit}";
$result = _mysql_query($query);
if (_mysql_num_rows($result) < 1) {
    echo "There are no new users.";
    admin_page_tail();
}
start_table();
table_header("ID", "Name", "Email", "Team", "Country", "Joined");
while ($row = _mysql_fetch_object($result)) {
    $id = $row->id;
    $name = $row->name;
    $email = $row->email_addr;
    $country = $row->country;
    $joined = time_str($row->create_time);
    $email_validated = $row->email_validated;
    $team_name = "";
    if ($row->teamid > 0) {
        $team = BoincTeam::lookup_id($row->teamid);
        $team_name = $team->name;
    }
    // Special Users:
    $roles = "";
    $user = $row;
    BoincForumPrefs::lookup($user);
    $special_bits = $user->prefs->special_user;
    if ($special_bits != "0") {
        for ($i = 0; $i < 7; $i++) {
            $bit = substr($special_bits, $i, 1);
            if ($bit == '1') {
Exemple #25
0
function main()
{
    echo "------------ Starting at " . time_str(time()) . "-------\n";
    $f = fopen("http://boinc.berkeley.edu/boinc_teams.xml", "r");
    if (!$f) {
        echo "Can't get times file\n";
        exit;
    }
    while ($s = fgets($f)) {
        if (strstr($s, '<team>')) {
            handle_team($f);
        }
    }
    echo "------------ Finished at " . time_str(time()) . "-------\n";
}
Exemple #26
0
function do_read($logged_in_user)
{
    $id = get_int("id");
    $message = BoincPrivateMessage::lookup_id($id);
    if (!$message || $message->userid != $logged_in_user->id) {
        error_page(tra("no such message"));
    }
    page_head(tra("Private messages") . " : " . $message->subject);
    pm_header();
    $sender = BoincUser::lookup_id($message->senderid);
    start_table();
    echo "<tr><th>" . tra("Subject") . "</th><td>" . $message->subject . "</td></tr>";
    echo "<tr><th>" . tra("Sender") . "</th><td>" . user_links($sender, BADGE_HEIGHT_SMALL);
    show_block_link($message->senderid);
    echo "</td></tr>";
    echo "<tr><th>" . tra("Date") . "</th><td>" . time_str($message->date) . "</td></tr>";
    echo "<tr><th>" . tra("Message") . "</th><td>" . output_transform($message->content, $options) . "</td></tr>";
    echo "<tr><td class=\"pm_footer\"></td><td>\n";
    echo "<a href=\"pm.php?action=new&amp;replyto={$id}\">" . tra("Reply") . "</a>\n";
    echo " &middot; <a href=\"pm.php?action=delete&amp;id={$id}\">" . tra("Delete") . "</a>\n";
    echo " &middot; <a href=\"pm.php?action=inbox\">" . tra("Inbox") . "</a>\n";
    end_table();
    if ($message->opened == 0) {
        $message->update("opened=1");
    }
}
    }
}
if ($back) {
    if ($back == "errorwus") {
        $args = "?refresh_cache=1";
        if ($hide_canceled && $hide_canceled == "on") {
            $args .= "&hide_canceled=on";
        }
        if ($hide_dlerr && $hide_dlerr == "on") {
            $args .= "&hide_dlerr=on";
        }
        if ($appid) {
            $args .= "&appid={$appid}";
        }
        echo "<p><a href=\"errorwus.php{$args}\">Return to All-error Workunits page</a> (refreshes the cache)</p>";
    } else {
        if ($back == "cancelwus") {
            if ($clause) {
                $clause = urlencode($clause);
                echo "<p><a href=\"cancel_workunits.php?limit={$limit}&uclause={$clause}\">";
                echo "Cancel next (max {$limit}) Workunits</a></p>";
            }
            echo "<p><a href=\"cancel_workunits.php\">Return to Cancel Workunits page</a></p>";
        }
    }
}
echo "<p>";
echo "Page last updated ";
echo time_str(time());
echo "</p>\n";
admin_page_tail();
Exemple #28
0
// 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
// (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) {
function show_cpu_list($data)
{
    page_head("CPU performance");
    echo "\n        This table shows peak CPU speed\n        (based on Whetstone benchmarks)\n        of computers participating in this project.\n        <p>\n    ";
    start_table();
    row_heading_array(array("CPU model", "Number of computers", "Avg. cores/computer", "GFLOPS/core", "GFLOPs/computer"));
    $i = 0;
    $total_nhosts = 0;
    $total_gflops = 0;
    foreach ($data->cpus as $d) {
        row_array(array($d->model, $d->nhosts, number_format($d->mean_ncores, 2), number_format($d->p_fpops / 1000000000.0, 2), number_format($d->mean_ncores * $d->p_fpops / 1000000000.0, 2)), "row{$i}");
        $total_nhosts += $d->nhosts;
        $total_gflops += $d->nhosts * $d->mean_ncores * $d->p_fpops / 1000000000.0;
        $i = 1 - $i;
    }
    row_array(array("Total", number_format($total_nhosts, 0) . " computers", "", "", number_format($total_gflops / 1000.0, 2) . " TeraFLOPS"), "row{$i}");
    end_table();
    echo "Generated " . time_str($data->time);
    page_tail();
}
Exemple #30
0
            if ($x->gpu_active_frac) {
                $av *= $x->gpu_active_frac;
            } else {
                $av *= $x->active_frac;
            }
        } else {
            $av = $x->on_frac * $x->active_frac;
        }
        $a[] = 1 / $x->et_avg * $av;
    }
    _mysql_free_result($result);
    sort($a);
    $n = count($a);
    $f = fopen("../../size_census_" . $app->name, "w");
    for ($i = 1; $i < $app->n_size_classes; $i++) {
        $k = (int) ($i * $n / $app->n_size_classes);
        fprintf($f, "%e\n", $a[$k]);
    }
    fclose($f);
}
echo "Starting: ", time_str(time()), "\n";
if ($argc == 2 && $argv[1] == "--all_apps") {
    $apps = BoincApp::enum("deprecated=0");
} else {
    $apps = BoincApp::enum("deprecated=0 and n_size_classes>1");
}
foreach ($apps as $app) {
    do_app($app);
}
echo "Finished: ", time_str(time()), "\n";