コード例 #1
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;
}
コード例 #2
0
ファイル: delete_spammers.php プロジェクト: privat1/boinc
function delete_teams()
{
    global $days, $test;
    $query = "nusers < 2 and seti_id=0 and total_credit=0";
    if ($days) {
        $x = time() - $days * 86400;
        $query .= " and create_time > {$x}";
    }
    $teams = BoincTeam::enum($query);
    foreach ($teams as $team) {
        $n = team_count_members($team->id);
        if ($n > 1) {
            continue;
        }
        if (!has_link($team->description)) {
            continue;
        }
        $user = BoincUser::lookup_id($team->userid);
        if ($user) {
            $n = BoincPost::count("user={$user->id}");
            if ($n) {
                continue;
            }
            $n = BoincHost::count("userid={$user->id}");
            if ($n) {
                continue;
            }
        }
        if ($test) {
            echo "would delete team:\n";
            echo "   ID: {$team->id}\n";
            echo "   name: {$team->name}\n";
            echo "   description: {$team->description}\n";
        } else {
            $team->delete();
            echo "deleted team ID {$team->id} name {$team->name}\n";
            if ($user) {
                do_delete_user($user);
            }
        }
    }
}
コード例 #3
0
ファイル: lammps.php プロジェクト: maexlich/boinc-igemathome
function estimated_makespan($njobs, $flops_per_job)
{
    $nhosts = BoincHost::count("expavg_credit > 1");
    if ($nhosts < 10) {
        $median_flops = 2000000000.0;
    } else {
        $n = (int) ($nhosts / 2);
        $hs = BoincHost::enum("expavg_credit>1 order by p_fpops limit {$n},1");
        $h = $hs[0];
        $median_flops = $h->p_fpops;
    }
    if ($njobs < $nhosts) {
        return $flops_per_job / $median_flops;
    } else {
        $k = (int) (($njobs + $nhosts - 1) / $nhosts);
        return $k * $flops_per_job / $median_flops;
    }
}
コード例 #4
0
function delete_profiles()
{
    global $test, $days;
    $profiles = BoincProfile::enum("");
    foreach ($profiles as $p) {
        if (has_link($p->response1) || has_link($p->response2)) {
            $user = BoincUser::lookup_id($p->userid);
            if (!$user) {
                echo "profile has missing user: %p->userid\n";
                continue;
            }
            if ($days) {
                if ($user->create_time < time() - $days * 86400) {
                    continue;
                }
            }
            $n = BoincHost::count("userid={$p->userid}");
            if ($n) {
                continue;
            }
            $n = BoincPost::count("user={$p->userid}");
            if ($n) {
                continue;
            }
            delete_user($user);
            if ($test) {
                echo "\n{$p->userid}\n{$p->response1}\n{$p->response2}\n";
            }
        }
    }
}