mirror of https://github.com/BOINC/boinc.git
- API: fix C compile error
- initial checkin of remote job stuff for app from ICT svn path=/trunk/boinc/; revision=25543
This commit is contained in:
parent
759c23ed27
commit
8b9c871002
|
@ -83,7 +83,6 @@ struct APP_INIT_DATA;
|
|||
|
||||
extern int boinc_init(void);
|
||||
extern int boinc_finish(int status);
|
||||
extern int boinc_temporary_exit(int delay, const char* reason=NULL);
|
||||
extern int boinc_get_init_data_p(struct APP_INIT_DATA*);
|
||||
extern int boinc_parse_init_data_file(void);
|
||||
extern int boinc_send_trickle_up(char* variety, char* text);
|
||||
|
@ -139,6 +138,7 @@ extern int boinc_report_app_status_aux(
|
|||
double cpu_time, double checkpoint_cpu_time, double _fraction_done,
|
||||
int other_pid, double bytes_sent, double bytes_received
|
||||
);
|
||||
extern int boinc_temporary_exit(int delay, const char* reason=NULL);
|
||||
|
||||
/////////// API ENDS HERE
|
||||
|
||||
|
|
|
@ -3248,3 +3248,14 @@ David 9 Apr 2012
|
|||
client/
|
||||
coproc_detect.cpp
|
||||
scheduler_op.cpp
|
||||
|
||||
David 9 Apr 2012
|
||||
- API: fix C compile error
|
||||
- initial checkin of remote job stuff for app from ICT
|
||||
|
||||
tools/
|
||||
tt_boinc
|
||||
api/
|
||||
boinc_api.h
|
||||
html/user/
|
||||
tree_threader.php
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
// Handler for TreeThreader remote job submission.
|
||||
|
||||
require_once("../inc/boinc_db.inc");
|
||||
require_once("../inc/submit_db.inc");
|
||||
require_once("../inc/xml.inc");
|
||||
require_once("../inc/dir_hier.inc");
|
||||
require_once("../inc/result.inc");
|
||||
require_once("../inc/submit_util.inc");
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
ini_set('display_startup_errors', true);
|
||||
|
||||
function error($s) {
|
||||
echo "<error>\n<message>$s</message>\n</error>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
function handle_submit($r) {
|
||||
}
|
||||
|
||||
function handle_abort($r) {
|
||||
}
|
||||
|
||||
function handle_status($r) {
|
||||
}
|
||||
|
||||
function handle_get_output($r) {
|
||||
}
|
||||
|
||||
function handle_retire($r) {
|
||||
}
|
||||
|
||||
xml_header();
|
||||
|
||||
$r = simplexml_load_string($_POST['request']);
|
||||
|
||||
if (!$r) {
|
||||
error("can't parse request message");
|
||||
}
|
||||
|
||||
switch ($r->getName()) {
|
||||
case 'submit': handle_submit($r); break;
|
||||
case 'abort': handle_abort($r); break;
|
||||
case 'status': handle_status($r); break;
|
||||
case 'get_output': handle_get_output($r); break;
|
||||
case 'retire': handle_retire($r); break;
|
||||
default: error("bad command");
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,135 @@
|
|||
#! /usr/bin/env php
|
||||
<?php
|
||||
|
||||
// Job submission and control script for TreeThreader application
|
||||
// from the Institute for Computing Technology in Beijing
|
||||
//
|
||||
|
||||
define("PROJECT", "http://test.foo.bar");
|
||||
|
||||
function usage() {
|
||||
die("
|
||||
Usage:
|
||||
tt_boinc submit sequence_file authenticator
|
||||
submit batch, print batch ID
|
||||
tt_boinc abort batchid auth
|
||||
abort batch, delete files
|
||||
tt_boinc status batchid auth
|
||||
show fraction done
|
||||
tt_boinc get_output batchid auth
|
||||
show URL of output file
|
||||
tt_boinc retire batchid auth
|
||||
");
|
||||
}
|
||||
|
||||
function do_http_op($xml) {
|
||||
$ch = curl_init(PROJECT."/tree_threader.php");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "request=$xml");
|
||||
$reply = curl_exec($ch);
|
||||
if (!$reply) return array(null, "HTTP error");
|
||||
$r = simplexml_load_string($reply);
|
||||
if (!$r) return array(null, "Can't parse reply XML: <pre>".htmlentities($reply)."</pre>");
|
||||
return array($r, null);
|
||||
}
|
||||
|
||||
function handle_submit() {
|
||||
global $argc, $argv;
|
||||
if ($argc != 4) usage();
|
||||
$seq = file_get_contents($argv[2]);
|
||||
if ($seq === false) {
|
||||
die("Can't read sequence file ".$argv[2]."\n");
|
||||
}
|
||||
$auth = $argv[3];
|
||||
$req_xml = "
|
||||
<tt_request>
|
||||
<action>submit</action>
|
||||
<sequence><![CDATA[
|
||||
$seq
|
||||
]]></sequence>
|
||||
<auth>$auth</auth>
|
||||
</tt_request>
|
||||
";
|
||||
list($reply, $errmsg) = do_http_op($req_xml);
|
||||
if ($errmsg) die("Error: $errmsg\n");
|
||||
$id = (int)$reply->id;
|
||||
echo "batch ID: %d\n";
|
||||
}
|
||||
|
||||
function handle_abort() {
|
||||
global $argc, $argv;
|
||||
if ($argc != 4) usage();
|
||||
$batchid = $argv[3];
|
||||
$auth = $argv[4];
|
||||
$req_xml = "
|
||||
<tt_request>
|
||||
<action>abort</action>
|
||||
<batchid>$batchid</batchid>
|
||||
<auth>$auth</auth>
|
||||
</tt_request>
|
||||
";
|
||||
list($reply, $errmsg) = do_http_op($req_xml);
|
||||
if ($errmsg) die("Error: $errmsg\n");
|
||||
echo "success\n";
|
||||
}
|
||||
|
||||
function handle_status() {
|
||||
global $argc, $argv;
|
||||
if ($argc != 4) usage();
|
||||
$batchid = $argv[3];
|
||||
$auth = $argv[4];
|
||||
$req_xml = "
|
||||
<tt_request>
|
||||
<action>status</action>
|
||||
<batchid>$batchid</batchid>
|
||||
<auth>$auth</auth>
|
||||
</tt_request>
|
||||
";
|
||||
list($reply, $errmsg) = do_http_op($req_xml);
|
||||
if ($errmsg) die("Error: $errmsg\n");
|
||||
}
|
||||
|
||||
function handle_get_output() {
|
||||
global $argc, $argv;
|
||||
if ($argc != 4) usage();
|
||||
$batchid = $argv[3];
|
||||
$auth = $argv[4];
|
||||
$req_xml = "
|
||||
<tt_request>
|
||||
<action>get_output</action>
|
||||
<batchid>$batchid</batchid>
|
||||
<auth>$auth</auth>
|
||||
</tt_request>
|
||||
";
|
||||
list($reply, $errmsg) = do_http_op($req_xml);
|
||||
if ($errmsg) die("Error: $errmsg\n");
|
||||
}
|
||||
|
||||
function handle_retire() {
|
||||
global $argc, $argv;
|
||||
if ($argc != 4) usage();
|
||||
$batchid = $argv[3];
|
||||
$auth = $argv[4];
|
||||
$req_xml = "
|
||||
<tt_request>
|
||||
<action>retire</action>
|
||||
<batchid>$batchid</batchid>
|
||||
<auth>$auth</auth>
|
||||
</tt_request>
|
||||
";
|
||||
list($reply, $errmsg) = do_http_op($req_xml);
|
||||
if ($errmsg) die("Error: $errmsg\n");
|
||||
}
|
||||
|
||||
if ($argc < 2) usage();
|
||||
switch ($argv[1]) {
|
||||
case "submit": handle_submit(); break;
|
||||
case "abort": handle_abort(); break;
|
||||
case "status": handle_status(); break;
|
||||
case "get_output": handle_get_output(); break;
|
||||
case "retire": handle_retire(); break;
|
||||
default: usage();
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue