コード例 #1
0
function do_pass()
{
    $int_max = 2147483647;
    $now = time();
    $insts = BossaJobInst::enum("timeout < {$now}");
    if (!count($insts)) {
        return false;
    }
    foreach ($insts as $inst) {
        BossaDb::start_transaction();
        $inst = BossaJobInst::lookup_id($inst->id);
        // reread instance within transation
        if ($inst->transition_time < $now) {
            $job = BossaJob::lookup_id($inst->job_id);
            $user = BoincUser::lookup_id($inst->user_id);
            BossaUser::lookup($user);
            job_timed_out($job, $inst, $user);
        }
        $inst->update("timeout={$int_max}");
        BossaDb::commit();
    }
    return true;
}
コード例 #2
0
// 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/>.
require_once "../inc/util.inc";
require_once "../inc/bossa_db.inc";
require_once "../inc/bossa_impl.inc";
$user = get_logged_in_user();
$inst = BossaJobInst::lookup_id(get_int('bji'));
if (!$inst) {
    error_page("No such job instance");
}
if ($inst->user_id != $user->id) {
    error_page("Bad user ID");
}
if ($inst->finish_time) {
    error_page("You already finished this job");
}
$job = BossaJob::lookup_id($inst->job_id);
if (!$job) {
    error_page("No such job");
}
$app = BossaApp::lookup_id($job->app_id);
$file = "../inc/{$app->short_name}.inc";
コード例 #3
0
function clear_batch($batch_id)
{
    admin_page_head("Deleting instances");
    if (BossaJobInst::delete_aux("batch_id={$batch_id}")) {
        echo "Job instances deleted.";
        $jobs = BossaJob::enum("batch_id={$batch_id}");
        foreach ($jobs as $job) {
            $job->update("priority_0=1");
        }
    } else {
        echo "Database error.";
    }
    $jobs = BossaJob::enum("batch_id={$batch_id}");
    foreach ($jobs as $job) {
        $job->update("state=1");
    }
    admin_page_tail();
}