@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if ($template) { |
| 59 | 59 | $t = (double)$template->workunit->rsc_fpops_est; |
| 60 | 60 | } |
| 61 | - foreach($r->batch->job as $job) { |
|
| 61 | + foreach ($r->batch->job as $job) { |
|
| 62 | 62 | $y = (double)$job->rsc_fpops_est; |
| 63 | 63 | if ($y) { |
| 64 | 64 | $x += $y; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function est_elapsed_time($r, $template) { |
| 85 | 85 | // crude estimate: batch FLOPs / project FLOPS |
| 86 | 86 | // |
| 87 | - return batch_flop_count($r, $template) / project_flops(); |
|
| 87 | + return batch_flop_count($r, $template)/project_flops(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // if batch-level input template filename was given, read it; |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | // |
| 95 | 95 | function read_input_template($app, $r) { |
| 96 | 96 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
| 97 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
| 97 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
| 98 | 98 | } else { |
| 99 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
| 99 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
| 100 | 100 | } |
| 101 | 101 | if (file_exists($path)) { |
| 102 | 102 | $x = simplexml_load_file($path); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | function validate_batch($jobs, $template) { |
| 142 | 142 | $i = 0; |
| 143 | 143 | $n = count($template->file_info); |
| 144 | - foreach($jobs as $job) { |
|
| 144 | + foreach ($jobs as $job) { |
|
| 145 | 145 | $m = count($job->input_files); |
| 146 | 146 | if ($n != $m) { |
| 147 | 147 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | // stage all the files |
| 203 | 203 | // |
| 204 | 204 | function stage_files(&$jobs) { |
| 205 | - foreach($jobs as $job) { |
|
| 205 | + foreach ($jobs as $job) { |
|
| 206 | 206 | foreach ($job->input_files as $file) { |
| 207 | 207 | if ($file->mode != "remote") { |
| 208 | 208 | $file->name = stage_file($file); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // |
| 216 | 216 | function submit_jobs( |
| 217 | 217 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
| 218 | - $input_template_filename, // batch-level; can also specify per job |
|
| 218 | + $input_template_filename, // batch-level; can also specify per job |
|
| 219 | 219 | $output_template_filename, |
| 220 | 220 | $user |
| 221 | 221 | ) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | // one line per job |
| 226 | 226 | // |
| 227 | 227 | $x = ""; |
| 228 | - foreach($jobs as $job) { |
|
| 228 | + foreach ($jobs as $job) { |
|
| 229 | 229 | if ($job->name) { |
| 230 | 230 | $x .= " --wu_name $job->name"; |
| 231 | 231 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $x .= "\n"; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
| 263 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
| 264 | 264 | |
| 265 | 265 | if ($user->seti_id) { |
| 266 | 266 | $cmd .= " --target_user $user->id "; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | // send stdin/stderr to a temp file |
| 298 | 298 | $cmd .= sprintf(' >%s 2>&1', |
| 299 | - "/tmp/create_work_" . getmypid() . ".err" |
|
| 299 | + "/tmp/create_work_".getmypid().".err" |
|
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | 302 | $h = popen($cmd, "w"); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | // |
| 370 | 370 | function xml_get_jobs($r) { |
| 371 | 371 | $jobs = array(); |
| 372 | - foreach($r->batch->job as $j) { |
|
| 372 | + foreach ($r->batch->job as $j) { |
|
| 373 | 373 | $job = new StdClass; |
| 374 | 374 | $job->input_files = array(); |
| 375 | 375 | $job->command_line = (string)$j->command_line; |
@@ -420,16 +420,16 @@ discard block |
||
| 420 | 420 | // |
| 421 | 421 | function logical_end_time($r, $jobs, $user, $app) { |
| 422 | 422 | $total_flops = 0; |
| 423 | - foreach($jobs as $job) { |
|
| 423 | + foreach ($jobs as $job) { |
|
| 424 | 424 | //print_r($job); |
| 425 | 425 | if ($job->rsc_fpops_est) { |
| 426 | 426 | $total_flops += $job->rsc_fpops_est; |
| 427 | 427 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
| 428 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
| 428 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
| 429 | 429 | } else if ($r->batch->job_params->rsc_fpops_est) { |
| 430 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
| 430 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
| 431 | 431 | } else { |
| 432 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
| 432 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
| 433 | 433 | if ($x) { |
| 434 | 434 | $total_flops += $x; |
| 435 | 435 | } else { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 440 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 441 | 441 | $x = exec($cmd); |
| 442 | 442 | if (!is_numeric($x) || (double)$x == 0) { |
| 443 | 443 | xml_error(-1, "$cmd returned $x"); |
@@ -515,15 +515,15 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | $job_params = new StdClass; |
| 518 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
| 519 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
| 520 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
| 521 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
| 522 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
| 518 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
| 519 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
| 520 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
| 521 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
| 522 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
| 523 | 523 | // could add quorum-related stuff |
| 524 | 524 | |
| 525 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
| 526 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
| 525 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
| 526 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
| 527 | 527 | // possibly empty |
| 528 | 528 | |
| 529 | 529 | submit_jobs( |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | function n_outfiles($wu) { |
| 616 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
| 616 | + $path = project_dir()."/$wu->output_template_filename"; |
|
| 617 | 617 | $r = simplexml_load_file($path); |
| 618 | 618 | return count($r->file_info); |
| 619 | 619 | } |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | "; |
| 821 | 821 | if ($result->server_state == 5) { // over? |
| 822 | 822 | $paths = get_outfile_paths($result); |
| 823 | - foreach($paths as $path) { |
|
| 823 | + foreach ($paths as $path) { |
|
| 824 | 824 | if (is_file($path)) { |
| 825 | 825 | $size = filesize($path); |
| 826 | 826 | echo " <outfile> |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | } else { |
| 865 | 865 | $results = BoincResult::enum("workunitid=$job_id"); |
| 866 | 866 | foreach ($results as $r) { |
| 867 | - switch($r->outcome) { |
|
| 867 | + switch ($r->outcome) { |
|
| 868 | 868 | case 1: |
| 869 | 869 | case 3: |
| 870 | 870 | case 6: |
@@ -979,8 +979,8 @@ discard block |
||
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | list($user, $user_submit) = check_remote_submit_permissions($r, $app); |
| 982 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
| 983 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
| 982 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
| 983 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
| 984 | 984 | if ($in === false || $out === false) { |
| 985 | 985 | log_write("template file missing"); |
| 986 | 986 | xml_error(-1, "template file missing"); |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | function ping($r) { |
| 994 | 994 | xml_start_tag("ping"); |
| 995 | - BoincDb::get(); // errors out if DB down or web disabled |
|
| 995 | + BoincDb::get(); // errors out if DB down or web disabled |
|
| 996 | 996 | echo "<success>1</success> |
| 997 | 997 | </ping> |
| 998 | 998 | "; |
@@ -1059,9 +1059,9 @@ discard block |
||
| 1059 | 1059 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
| 1060 | 1060 | if ($request_log) { |
| 1061 | 1061 | $log_dir = parse_config(get_config(), "<log_dir>"); |
| 1062 | - $request_log = $log_dir . "/" . $request_log; |
|
| 1062 | + $request_log = $log_dir."/".$request_log; |
|
| 1063 | 1063 | if ($file = fopen($request_log, "a")) { |
| 1064 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
| 1064 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
| 1065 | 1065 | fclose($file); |
| 1066 | 1066 | } |
| 1067 | 1067 | } |