diff --git a/html/user/tree_threader.php b/html/user/tree_threader.php index d80b1adf52..037fe6f40e 100644 --- a/html/user/tree_threader.php +++ b/html/user/tree_threader.php @@ -19,6 +19,8 @@ error_reporting(E_ALL); ini_set('display_errors', true); ini_set('display_startup_errors', true); +$app_name = "uppercase"; + function error($s) { echo "\n$s\n\n"; exit; @@ -90,7 +92,45 @@ function handle_get_output($r, $batch) { xml_header(); +if (0) { $r = simplexml_load_string($_POST['request']); +} else { +$x = << + submit + + + i686-pc-linux-gnu + Linux/x86 + + + astropulse + AstroPulse + + + +See http://boinc.berkeley.edu/tool_xadd.php +''' + +import boinc_path_config +from Boinc import database, db_mid, projectxml + +database.connect() +projectxml.default_project().commit_all() + +]]> + 157f96a018b0b2f2b466e2ce3c7f54db + +EOF; +$r = simplexml_load_string($x); +} if (!$r) { error("can't parse request message"); @@ -99,11 +139,11 @@ if (!$r) { // authenticate the user // $auth = (string)$r->auth; -$user = BoincUser::lookup("auth='$auth'"); +$user = BoincUser::lookup("authenticator='$auth'"); if (!$user) error("invalid authenticator"); $user_submit = BoincUserSubmit::lookup_userid($user->id); if (!$user_submit) error("no submit access"); -$app = BoincApp::lookup("name='tree_threader'"); +$app = BoincApp::lookup("name='$app_name'"); if (!$app) error("no tree_threader app"); if (!$user_submit->submit_all) { @@ -113,7 +153,7 @@ if (!$user_submit->submit_all) { } } -switch ($r->getName()) { +switch ((string)$r->action) { case 'submit': handle_submit($r, $user, $app); break; case 'get_output': $batch_id = (int)$r->batchid; diff --git a/tools/tree_threader_splitter b/tools/tree_threader_splitter new file mode 100755 index 0000000000..0026bc87c3 --- /dev/null +++ b/tools/tree_threader_splitter @@ -0,0 +1,82 @@ +#! /usr/bin/env php +config->uldl_dir_fanout; + +function finish_group($i) { + global $now, $fanout, $flist; + $dir = "tree_threader_template_".$now."_$i"; + $dirpath = "/tmp/$dir"; + $cmd = "zip -r $dirpath $dirpath"; + system($cmd); + $f = "$dir.zip"; + $path = dir_hier_path($f, "download", $fanout); + if (rename("/tmp/$f", $path)) { + echo "renamed /tmp/$f to $path\n"; + } else { + die("can't rename /tmp/$f to $path\n"); + } + fprintf($flist, "$f\n"); +} + +$dir = $argv[1]; +$d = opendir($dir); +$igp = 0; +$gpsize = 0; +while (($f = readdir($d)) !== false) { + $p = "$dir/$f"; + echo "processing $p\n"; + if (!is_file($p)) continue; + if ($gpsize == 0) { + start_group($igp); + } + add_file_to_group($igp, $p); + $gpsize++; + if ($gpsize == $files_per_group) { + finish_group($igp); + $gpsize = 0; + $igp++; + } +} +if ($gpsize) { + finish_group($igp); +} +fclose($flist); + +?> + diff --git a/tools/tree_threader_splitter.php b/tools/tree_threader_splitter.php deleted file mode 100644 index b42bc33898..0000000000 --- a/tools/tree_threader_splitter.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/tools/tt_boinc b/tools/tt_boinc index 5841859696..630333f12c 100755 --- a/tools/tt_boinc +++ b/tools/tt_boinc @@ -5,7 +5,7 @@ // from the Institute for Computing Technology in Beijing // -define("PROJECT", "http://test.foo.bar"); +define("PROJECT", "http://isaac.ssl.berkeley.edu/test/"); function usage() { die(" @@ -23,7 +23,7 @@ tt_boinc retire batchid auth } function do_http_op($xml) { - $ch = curl_init(PROJECT."/tree_threader.php"); + $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"); @@ -54,7 +54,7 @@ $seq list($reply, $errmsg) = do_http_op($req_xml); if ($errmsg) die("Error: $errmsg\n"); $id = (int)$reply->id; - echo "batch ID: %d\n"; + echo "batch ID: $id\n"; } function handle_abort() {