mirror of https://github.com/BOINC/boinc.git
ICT job submission
svn path=/trunk/boinc/; revision=26073
This commit is contained in:
parent
b412b9d172
commit
487916c8e9
|
@ -5,16 +5,19 @@
|
||||||
// from the Institute for Computing Technology in Beijing
|
// from the Institute for Computing Technology in Beijing
|
||||||
//
|
//
|
||||||
|
|
||||||
define("PROJECT", "http://casbak.ihep.ac.cn/castest/");
|
define("PROJECT", "http://casbak.ihep.ac.cn/casw/");
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
|
global $argv;
|
||||||
die("
|
die("
|
||||||
Usage:
|
Usage:
|
||||||
tt_boinc submit sequence_file authenticator
|
$argv[0] submit sequence_file (submit batch, print batch ID)
|
||||||
submit batch, print batch ID
|
$argv[0] get_output batch_id (show URL of output file)
|
||||||
tt_boinc get_output batch_id auth
|
\n");
|
||||||
show URL of output file
|
}
|
||||||
");
|
|
||||||
|
function get_auth() {
|
||||||
|
return trim(file_get_contents("auth"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_http_op($xml, $file=null) {
|
function do_http_op($xml, $file=null) {
|
||||||
|
@ -38,9 +41,10 @@ function do_http_op($xml, $file=null) {
|
||||||
|
|
||||||
function handle_submit() {
|
function handle_submit() {
|
||||||
global $argc, $argv;
|
global $argc, $argv;
|
||||||
if ($argc != 4) usage();
|
if ($argc != 3) usage();
|
||||||
if (!is_file($argv[2])) die("seq file missing");
|
if (!is_file($argv[2])) die("seq file missing");
|
||||||
$auth = $argv[3];
|
//$auth = $argv[3];
|
||||||
|
$auth = get_auth();
|
||||||
$req_xml = "
|
$req_xml = "
|
||||||
<tt_request>
|
<tt_request>
|
||||||
<action>submit</action>
|
<action>submit</action>
|
||||||
|
@ -49,15 +53,16 @@ function handle_submit() {
|
||||||
";
|
";
|
||||||
list($reply, $errmsg) = do_http_op($req_xml, $argv[2]);
|
list($reply, $errmsg) = do_http_op($req_xml, $argv[2]);
|
||||||
if ($errmsg) die("Error: $errmsg\n");
|
if ($errmsg) die("Error: $errmsg\n");
|
||||||
if ($reply->message) die("Error: $reply->message);
|
print_r($reply);
|
||||||
echo "batch ID: ".(int)$reply->batch_id."\n";
|
echo "batch ID: ".(int)$reply->batch_id."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_get_output() {
|
function handle_get_output() {
|
||||||
global $argc, $argv;
|
global $argc, $argv;
|
||||||
if ($argc != 4) usage();
|
if ($argc != 3) usage();
|
||||||
$batch_id = $argv[2];
|
$batch_id = $argv[2];
|
||||||
$auth = $argv[3];
|
//$auth = $argv[3];
|
||||||
|
$auth = get_auth();
|
||||||
$req_xml = "
|
$req_xml = "
|
||||||
<tt_request>
|
<tt_request>
|
||||||
<action>get_output</action>
|
<action>get_output</action>
|
|
@ -4,22 +4,21 @@
|
||||||
// FIRST WHACK AT A REMOTE JOB SUBMISSION TOOL; NOT FINISHED
|
// FIRST WHACK AT A REMOTE JOB SUBMISSION TOOL; NOT FINISHED
|
||||||
|
|
||||||
|
|
||||||
require_once("../html/inc/submit.inc");
|
require_once("submit.inc");
|
||||||
|
|
||||||
//define("PROJECT", "http://casbak.ihep.ac.cn/castest/");
|
define("PROJECT", "http://casbak.ihep.ac.cn/casw");
|
||||||
define("PROJECT", "http://isaac.ssl.berkeley.edu/test/");
|
|
||||||
define("APP_NAME", "uppercase");
|
define("APP_NAME", "uppercase");
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
die("
|
global $argv;
|
||||||
|
die("
|
||||||
Usage:
|
Usage:
|
||||||
submit sequence_file
|
$argv[0] submit sequence_file (submit 1 job, print batch ID)
|
||||||
submit 1 job, print batch ID
|
$argv[0] query batch_id|all (get the status of a specific batch or all batches)
|
||||||
get_output batch_id
|
$argv[0] get_output batch_id (show URL of output file)
|
||||||
show URL of output file
|
$argv[0] abort batch_id (abort a batch)
|
||||||
abort batch_id
|
$argv[0] retire batch_id (retire a batch)
|
||||||
retire batch_id
|
\n");
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_auth() {
|
function get_auth() {
|
||||||
|
@ -49,6 +48,7 @@ function handle_submit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_query() {
|
function handle_query() {
|
||||||
|
global $argc,$argv;
|
||||||
$req->project = PROJECT;
|
$req->project = PROJECT;
|
||||||
$req->authenticator = get_auth();
|
$req->authenticator = get_auth();
|
||||||
list($batches, $errmsg) = boinc_query_batches($req);
|
list($batches, $errmsg) = boinc_query_batches($req);
|
||||||
|
@ -56,16 +56,33 @@ function handle_query() {
|
||||||
echo "Error: $errmsg\n";
|
echo "Error: $errmsg\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($batches as $batch) {
|
if($argv[2]!='all')$batch_id=$argv[2];
|
||||||
echo "batch $batch->id: ";
|
else $batch_id=-1;
|
||||||
switch ($batch->state) {
|
|
||||||
case 1: echo "In progress"; break;
|
if($batch_id==-1){
|
||||||
case 2: echo "Completed"; break;
|
foreach ($batches as $batch) {
|
||||||
case 3: echo "Aborted"; break;
|
echo "batch $batch->id: ";
|
||||||
case 4: echo "Retired"; break;
|
switch ($batch->state) {
|
||||||
}
|
case 1: echo "In progress\n"; break;
|
||||||
}
|
case 2: echo "Completed\n"; break;
|
||||||
}
|
case 3: echo "Aborted\n"; break;
|
||||||
|
case 4: echo "Retired\n"; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
foreach ($batches as $batch) {
|
||||||
|
if ($batch->id==$batch_id){
|
||||||
|
echo "batch $batch_id: ";
|
||||||
|
switch ($batch->state) {
|
||||||
|
case 1: echo "In progress\n"; break;
|
||||||
|
case 2: echo "Completed\n"; break;
|
||||||
|
case 3: echo "Aborted\n"; break;
|
||||||
|
case 4: echo "Retired\n"; break;
|
||||||
|
}//switch
|
||||||
|
} //if
|
||||||
|
}//foreach
|
||||||
|
}//else
|
||||||
|
}//query_batch()
|
||||||
|
|
||||||
function handle_get_output() {
|
function handle_get_output() {
|
||||||
global $argc, $argv;
|
global $argc, $argv;
|
||||||
|
@ -105,7 +122,7 @@ function handle_retire() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($argc < 2) usage();
|
if ($argc < 3) usage();
|
||||||
switch ($argv[1]) {
|
switch ($argv[1]) {
|
||||||
case "submit": handle_submit(); break;
|
case "submit": handle_submit(); break;
|
||||||
case "query": handle_query(); break;
|
case "query": handle_query(); break;
|
||||||
|
|
Loading…
Reference in New Issue