Skip to content
forked from BOINC/boinc

Commit

Permalink
svn path=/trunk/boinc/; revision=24961
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpanderson committed Jan 1, 2012
1 parent 324f24b commit 8b4df38
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion html/inc/sandbox.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
//
function sandbox_physical_path($user, $md5) {
global $fanout;
$f = "sb_".$user->id.$md5;
$f = "sb_".$user->id."_".$md5;
return dir_hier_path($f, "../../download", $fanout);
}

Expand Down
25 changes: 14 additions & 11 deletions html/user/lammps.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ function prepare_batch($user) {
page_tail();
}

function submit_job($app, $batch_id, $rsc_fpops_est, $cmdline, $i) {
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $rsc_fpops_est";
function submit_job($app, $batch_id, $info, $cmdline, $i) {
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est";
if ($cmdline) {
$cmd .= " --command_line \"$cmdline\"";
}
$cmd .= " --wu_name batch_".$batch_id."_".$i;
foreach ($job->input_files as $file) {
$cmd .= " $file->name";
}
$cmd .= " $info->structure_file_path";
$cmd .= " $info->command_file_path";
echo "<br> $cmd\n"; return;

$ret = system($cmd);
if ($ret === FALSE) {
error_page("can't create job");
Expand All @@ -108,21 +109,23 @@ function submit_job($app, $batch_id, $rsc_fpops_est, $cmdline, $i) {

function submit_batch($user, $app) {
$tmpfile = get_str('tmpfile');
$x = file_get_contents("/tmp/$tmpfile");
$info = deserialize($x);
$x = file_get_contents("$tmpfile");
$info = unserialize($x);

$cmdlines = file($info->cmdline_file_path);
$njobs = count($cmdlines);

$now = time();
$batch_name = time_str($now);
$batch_id = BoincBatch::insert(
"(user_id, create_time, njobs, name, app_id) values ($user->id, $now, $njobs, '$batch_name', $app->id)"
);

// $batch_id = BoincBatch::insert(
// "(user_id, create_time, njobs, name, app_id) values ($user->id, $now, $njobs, '$batch_name', $app->id)"
// );
$batch_id=99;

$i = 0;
foreach ($cmdlines as $cmdline) {
submit_job($app, $batch_id, $info->rsc_fpops_est, $cmdline, $i);
submit_job($app, $batch_id, $info, $cmdline, $i);
$i++;
}
}
Expand Down
19 changes: 14 additions & 5 deletions html/user/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

require_once("../inc/submit_db.inc");
require_once("../inc/util.inc");
require_once("../inc/result.inc");
require_once("../inc/submit_util.inc");
require_once("../project/project.inc");

Expand All @@ -41,6 +42,12 @@ function handle_main($user) {
$wus = BoincWorkunit::enum("batch = $batch->id");
$batch = get_batch_params($batch, $wus);
}
$app = BoincApp::lookup_id($batch->app_id);
if ($app) {
$batch->app_name = $app->name;
} else {
$batch->app_name = "unknown";
}
}

foreach ($batches as $batch) {
Expand Down Expand Up @@ -74,11 +81,12 @@ function handle_main($user) {
$first = false;
echo "<h2>Completed batches</h2>\n";
start_table();
table_header("name", "ID", "# jobs", "submitted");
table_header("name", "ID", "app", "# jobs", "submitted");
}
table_row(
"<a href=submit.php?action=query_batch&batch_id=$batch->id>$batch->name</a>",
"<a href=submit.php?action=query_batch&batch_id=$batch->id>$batch->id</a>",
$batch->app_name,
$batch->njobs,
local_time_str($batch->create_time)
);
Expand All @@ -96,11 +104,12 @@ function handle_main($user) {
$first = false;
echo "<h2>Aborted batches</h2>\n";
start_table();
table_header("name", "ID", "# jobs", "submitted");
table_header("name", "ID", "app", "# jobs", "submitted");
}
table_row(
"<a href=submit.php?action=query_batch&batch_id=$batch->id>$batch->name</a>",
"<a href=submit.php?action=query_batch&batch_id=$batch->id>$batch->id</a>",
$batch->app_name,
$batch->njobs,
local_time_str($batch->create_time)
);
Expand Down Expand Up @@ -163,7 +172,7 @@ function handle_query_batch($user) {
);
$wus = BoincWorkunit::enum("batch = $batch->id");
foreach($wus as $wu) {
$resultid = $wu->canonical_instance_id;
$resultid = $wu->canonical_resultid;
if ($resultid) {
$x = "<a href=result.php?resultid=$resultid>$resultid</a>";
$y = "completed";
Expand All @@ -173,7 +182,7 @@ function handle_query_batch($user) {
}

echo "<tr>
<td><a href=submit.php?action=query_job&job_id=$id>$id</a></td>
<td><a href=submit.php?action=query_job&wuid=$wu->id>$wu->id</a></td>
<td>$y</td>
<td>$x</td>
</tr>
Expand All @@ -197,7 +206,7 @@ function handle_query_job() {
"Instance ID<br><span class=note>click for result page</span>",
"State", "Output files"
);
$results = BoincResult::enum("workunitid=$job_id");
$results = BoincResult::enum("workunitid=$wuid");
foreach($results as $result) {
echo "<tr>
<td><a href=result.php?resultid=$result->id>$result->id</a></td>
Expand Down

0 comments on commit 8b4df38

Please sign in to comment.