2008-02-11 23:38:31 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// 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/>.
|
2008-02-11 23:38:31 +00:00
|
|
|
|
|
|
|
require_once("../inc/bossa_db.inc");
|
|
|
|
|
2008-07-14 19:13:19 +00:00
|
|
|
function do_pass() {
|
2008-07-15 21:43:45 +00:00
|
|
|
$int_max = 2147483647;
|
2008-07-14 19:13:19 +00:00
|
|
|
$now = time();
|
2008-07-15 21:43:45 +00:00
|
|
|
$insts = BossaJobInst::enum("timeout < $now");
|
2008-07-14 19:13:19 +00:00
|
|
|
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);
|
2008-07-15 21:43:45 +00:00
|
|
|
job_timed_out($job, $inst, $user);
|
2008-02-12 20:33:05 +00:00
|
|
|
}
|
2008-07-15 21:43:45 +00:00
|
|
|
$inst->update("timeout=$int_max");
|
2008-07-14 19:13:19 +00:00
|
|
|
BossaDb::commit();
|
2008-02-12 20:33:05 +00:00
|
|
|
}
|
2008-07-14 19:13:19 +00:00
|
|
|
return true;
|
2008-02-11 23:38:31 +00:00
|
|
|
}
|
|
|
|
|
2008-07-15 21:43:45 +00:00
|
|
|
$app_name = $argv[1];
|
|
|
|
$app = BossaApp::lookup("short_name='$app_name'");
|
2008-07-14 19:13:19 +00:00
|
|
|
if (!$app) {
|
2008-07-15 21:43:45 +00:00
|
|
|
echo "No app named $app_name\n";
|
2008-07-14 19:13:19 +00:00
|
|
|
exit;
|
2008-02-11 23:38:31 +00:00
|
|
|
}
|
|
|
|
|
2008-07-15 21:43:45 +00:00
|
|
|
$bs = "../inc/".$app_name.".inc";
|
2008-07-14 19:13:19 +00:00
|
|
|
require_once($bs);
|
|
|
|
while (1) {
|
|
|
|
if (!do_pass()) {
|
2008-07-15 21:43:45 +00:00
|
|
|
echo("Sleeping\n");
|
2008-07-14 19:13:19 +00:00
|
|
|
sleep(10);
|
2008-02-11 23:38:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|