mirror of https://github.com/BOINC/boinc.git
- boinc_submit: add --jobs and --abort options
svn path=/trunk/boinc/; revision=15547
This commit is contained in:
parent
288c0df997
commit
e9fe83cf8b
|
@ -5442,3 +5442,11 @@ Rom 3 July 2008
|
||||||
CAGrantBOINCProjectsRights.cpp
|
CAGrantBOINCProjectsRights.cpp
|
||||||
CAGrantBOINCUsersRights.cpp
|
CAGrantBOINCUsersRights.cpp
|
||||||
CAMigrateBOINCData.cpp
|
CAMigrateBOINCData.cpp
|
||||||
|
|
||||||
|
David 3 July 2008
|
||||||
|
- boinc_submit: add --jobs and --abort options
|
||||||
|
|
||||||
|
html/inc/
|
||||||
|
boinc_db.inc
|
||||||
|
tools/
|
||||||
|
boinc_submit
|
||||||
|
|
|
@ -180,6 +180,14 @@ class BoincWorkunit {
|
||||||
if (!$ret) return $ret;
|
if (!$ret) return $ret;
|
||||||
return $db->insert_id();
|
return $db->insert_id();
|
||||||
}
|
}
|
||||||
|
static function enum($clause) {
|
||||||
|
$db = BoincDb::get();
|
||||||
|
return $db->enum('workunit', 'BoincWorkunit', $clause);
|
||||||
|
}
|
||||||
|
function update($clause) {
|
||||||
|
$db = BoincDb::get();
|
||||||
|
return $db->update($this, 'workunit', $clause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BoincApp {
|
class BoincApp {
|
||||||
|
@ -298,6 +306,10 @@ class BoincPlatform {
|
||||||
$db = BoincDb::get();
|
$db = BoincDb::get();
|
||||||
return $db->enum('platform', 'BoincPlatform', $clause);
|
return $db->enum('platform', 'BoincPlatform', $clause);
|
||||||
}
|
}
|
||||||
|
static function lookup_id($id) {
|
||||||
|
$db = BoincDb::get();
|
||||||
|
return $db->lookup_id($id, 'platform', 'BoincPlatform');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -406,7 +406,7 @@ function parse_args($argc, $argv) {
|
||||||
case '--abort':
|
case '--abort':
|
||||||
$wuid = $argv[++$i];
|
$wuid = $argv[++$i];
|
||||||
abort_job($wuid);
|
abort_job($wuid);
|
||||||
case '--show':
|
case '--jobs':
|
||||||
show_jobs();
|
show_jobs();
|
||||||
default:
|
default:
|
||||||
if ($program) {
|
if ($program) {
|
||||||
|
@ -421,30 +421,38 @@ function parse_args($argc, $argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function abort_job($wuid) {
|
function abort_job($wuid) {
|
||||||
$wu = BoincWorkunit::lookup_id($wu_id);
|
$wu = BoincWorkunit::lookup_id($wuid);
|
||||||
if (!$wu) error_page("No such job");
|
if (!$wu) error("No such job");
|
||||||
$app = BoincApp::lookup_id($wu->appid);
|
$app = BoincApp::lookup_id($wu->appid);
|
||||||
if (!strstr($app->name, "single_job")) {
|
if (!strstr($app->name, "single_job")) {
|
||||||
error_page("Not a boinc_submit job");
|
error("Not a boinc_submit job");
|
||||||
|
}
|
||||||
|
if ($wu->error_mask) {
|
||||||
|
echo "Job $wuid has already been aborted.\n";
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$x = $wu->error_mask | 16;
|
$x = $wu->error_mask | 16;
|
||||||
$now = time();
|
$now = time();
|
||||||
BoincResult::update_aux("server_state=5, outcome=5 where server_state=2 and workunitid=$wuid");
|
BoincResult::update_aux("server_state=5, outcome=5 where server_state=2 and workunitid=$wuid");
|
||||||
$wu->update("error_mask=$x and transition_time=$now");
|
$wu->update("error_mask=$x, transition_time=$now");
|
||||||
|
echo "Job $wuid has been aborted.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_jobs() {
|
function show_jobs() {
|
||||||
$apps = BoincApp::enum();
|
$apps = BoincApp::enum("");
|
||||||
foreach($apps as $app) {
|
foreach($apps as $app) {
|
||||||
if (!strstr($app->name, "single_job")) continue;
|
if (!strstr($app->name, "single_job")) continue;
|
||||||
$platform = BoincPlatform::lookup_id($app->platformid);
|
$avs = BoincAppVersion::enum("appid=$app->id");
|
||||||
|
$av = $avs[0];
|
||||||
|
$platform = BoincPlatform::lookup_id($av->platformid);
|
||||||
echo "Jobs for $platform->user_friendly_name:\n";
|
echo "Jobs for $platform->user_friendly_name:\n";
|
||||||
$wus = BoincWorkunit::enum("appid=$app->id");
|
$wus = BoincWorkunit::enum("appid=$app->id");
|
||||||
foreach $wus as $wu {
|
foreach ($wus as $wu) {
|
||||||
echo "$wu->id: state $wu->assimilate_state\n";
|
show_job($wu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_result($result, $i) {
|
function show_result($result, $i) {
|
||||||
|
@ -461,8 +469,17 @@ function show_result($result, $i) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function show_job($wu) {
|
||||||
|
echo "Job $wu->id: ";
|
||||||
|
switch ($wu->assimilate_state) {
|
||||||
|
case 0: echo "in progress\n"; break;
|
||||||
|
case 1: echo "being assimilated\n"; break;
|
||||||
|
case 2: echo "completed\n"; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function show_wu_status($wu) {
|
function show_wu_status($wu) {
|
||||||
$now = date("F j, Y, g:i a");
|
$now = date("F j, Y, g:i A");
|
||||||
switch ($wu->assimilate_state) {
|
switch ($wu->assimilate_state) {
|
||||||
case 0:
|
case 0:
|
||||||
echo "$now: job $wu->id is in progress\n";
|
echo "$now: job $wu->id is in progress\n";
|
||||||
|
|
Loading…
Reference in New Issue