From 6c0293750047a3ba370e51daf695866db444e0c5 Mon Sep 17 00:00:00 2001 From: Wenjing Wu Date: Thu, 12 Apr 2012 07:30:45 +0000 Subject: [PATCH] - CAS@home stuff svn path=/trunk/boinc/; revision=25548 --- checkin_notes | 7 ++++ html/user/tree_threader.php | 39 +++++++++++++++++----- tools/tt_boinc | 64 +++---------------------------------- 3 files changed, 42 insertions(+), 68 deletions(-) diff --git a/checkin_notes b/checkin_notes index 0e11a7e1d1..c272cef7ea 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3259,3 +3259,10 @@ David 9 Apr 2012 boinc_api.h html/user/ tree_threader.php + +David 12 Apr 2012 + - CAS@home stuff + tools/ + tt_boinc.cpp + html/user/ + tree_threader.cpp diff --git a/html/user/tree_threader.php b/html/user/tree_threader.php index 037fe6f40e..8b4526bbd0 100644 --- a/html/user/tree_threader.php +++ b/html/user/tree_threader.php @@ -19,7 +19,7 @@ error_reporting(E_ALL); ini_set('display_errors', true); ini_set('display_startup_errors', true); -$app_name = "uppercase"; +$app_name = "treeThreader"; function error($s) { echo "\n$s\n\n"; @@ -27,6 +27,8 @@ function error($s) { } function handle_submit($r, $user, $app) { + global $app_name; + // read the list of template filenames // $files = file("../../tree_threader_template_files"); @@ -34,16 +36,37 @@ function handle_submit($r, $user, $app) { $njobs = sizeof($files); $now = time(); $batch_id = BoincBatch::insert( - "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'test batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" + "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" ); + if (!$batch_id) die("couldn't create batch\n"); + + // write the sequence to a file + // + $seq_fname = "three_threader_seq_$batch_id"; + $config = simplexml_load_string(file_get_contents("../../config.xml")); + $fanout = (int)$config->config->uldl_dir_fanout; + $download_dir = trim((string)$config->config->download_dir); + + $seq_path = dir_hier_path($seq_fname, $download_dir, $fanout); + $ret = file_put_contents($seq_path, (string)$r->sequence); + if ($ret === false) { + error("couldn't write sequence file"); + } + echo "write sequence file to $seq_path\n"; + + $i = 0; foreach ($files as $file) { - $cmd = "cd ../..; ./bin/create_work --appname tree_thread --batch $batch_id $file"; + $file = trim($file); + $wu_name = "ICT_".$batch_id."_$i"; + $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $file ss3.kmeans.8 $seq_fname"; $ret = system($cmd); if ($ret === false) { error("can't create job"); - } + } else { + echo "created job: $ret\n"; + } } - echo "$batchid\n"; + echo "$batch_id\n"; } // Enumerate all the successfully completed WUs for this batch. @@ -52,7 +75,7 @@ function handle_submit($r, $user, $app) { // and return the resulting URL // function handle_get_output($r, $batch) { - $wus = BoincWorkUnit::enum("batchid=$batch->id"); + $wus = BoincWorkUnit::enum("batch=$batch->id"); $outdir = "/tmp/tree_threader_".$batch->id; foreach ($wus as $wu) { if (!$wu->canonical_resultid) continue; @@ -126,7 +149,7 @@ database.connect() projectxml.default_project().commit_all() ]]> - 157f96a018b0b2f2b466e2ce3c7f54db + 06e5740fb78352852cd8aeef6cdd2893 EOF; $r = simplexml_load_string($x); @@ -156,7 +179,7 @@ if (!$user_submit->submit_all) { switch ((string)$r->action) { case 'submit': handle_submit($r, $user, $app); break; case 'get_output': - $batch_id = (int)$r->batchid; + $batch_id = (int)$r->batch_id; $batch = BoincBatch::lookup_id($batch_id); if (!$batch) error("no such batch"); if ($batch->user_id != $user->id) error("not owner of batch"); diff --git a/tools/tt_boinc b/tools/tt_boinc index 630333f12c..b3fe1e9c2e 100755 --- a/tools/tt_boinc +++ b/tools/tt_boinc @@ -12,13 +12,8 @@ function usage() { 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 +tt_boinc get_output batch_id auth show URL of output file -tt_boinc retire batchid auth "); } @@ -51,70 +46,22 @@ $seq $auth "; + echo $req_xml; exit; list($reply, $errmsg) = do_http_op($req_xml); if ($errmsg) die("Error: $errmsg\n"); $id = (int)$reply->id; echo "batch ID: $id\n"; } -function handle_abort() { - global $argc, $argv; - if ($argc != 4) usage(); - $batchid = $argv[3]; - $auth = $argv[4]; - $req_xml = " - - abort - $batchid - $auth - -"; - 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 = " - - status - $batchid - $auth - -"; - 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]; + $batch_id = $argv[3]; $auth = $argv[4]; $req_xml = " get_output - $batchid - $auth - -"; - 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 = " - - retire - $batchid + $batch_id $auth "; @@ -125,10 +72,7 @@ function handle_retire() { 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(); }