@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($template) { |
62 | 62 | $t = (double)$template->workunit->rsc_fpops_est; |
63 | 63 | } |
64 | - foreach($r->batch->job as $job) { |
|
64 | + foreach ($r->batch->job as $job) { |
|
65 | 65 | $y = (double)$job->rsc_fpops_est; |
66 | 66 | if ($y) { |
67 | 67 | $x += $y; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | function est_elapsed_time($r, $template) { |
88 | 88 | // crude estimate: batch FLOPs / project FLOPS |
89 | 89 | // |
90 | - return batch_flop_count($r, $template) / project_flops(); |
|
90 | + return batch_flop_count($r, $template)/project_flops(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // if batch-level input template filename was given, read it; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // |
98 | 98 | function read_input_template($app, $r) { |
99 | 99 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
100 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
100 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
101 | 101 | } else { |
102 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
102 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
103 | 103 | } |
104 | 104 | if (file_exists($path)) { |
105 | 105 | $x = simplexml_load_file($path); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | function validate_batch($jobs, $template) { |
145 | 145 | $i = 0; |
146 | 146 | $n = count($template->file_info); |
147 | - foreach($jobs as $job) { |
|
147 | + foreach ($jobs as $job) { |
|
148 | 148 | $m = count($job->input_files); |
149 | 149 | if ($n != $m) { |
150 | 150 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // stage all the files |
206 | 206 | // |
207 | 207 | function stage_files(&$jobs) { |
208 | - foreach($jobs as $job) { |
|
208 | + foreach ($jobs as $job) { |
|
209 | 209 | foreach ($job->input_files as $file) { |
210 | 210 | if ($file->mode != "remote") { |
211 | 211 | $file->name = stage_file($file); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // |
219 | 219 | function submit_jobs( |
220 | 220 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
221 | - $input_template_filename, // batch-level; can also specify per job |
|
221 | + $input_template_filename, // batch-level; can also specify per job |
|
222 | 222 | $output_template_filename |
223 | 223 | ) { |
224 | 224 | global $input_templates, $output_templates; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // one line per job |
228 | 228 | // |
229 | 229 | $x = ""; |
230 | - foreach($jobs as $job) { |
|
230 | + foreach ($jobs as $job) { |
|
231 | 231 | if ($job->name) { |
232 | 232 | $x .= " --wu_name $job->name"; |
233 | 233 | } |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | $x .= "\n"; |
263 | 263 | } |
264 | 264 | |
265 | - $errfile = "/tmp/create_work_" . getmypid() . ".err"; |
|
266 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
265 | + $errfile = "/tmp/create_work_".getmypid().".err"; |
|
266 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
267 | 267 | if ($priority !== null) { |
268 | 268 | $cmd .= " --priority $priority"; |
269 | 269 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | // |
364 | 364 | function xml_get_jobs($r) { |
365 | 365 | $jobs = array(); |
366 | - foreach($r->batch->job as $j) { |
|
366 | + foreach ($r->batch->job as $j) { |
|
367 | 367 | $job = new StdClass; |
368 | 368 | $job->input_files = array(); |
369 | 369 | $job->command_line = (string)$j->command_line; |
@@ -414,16 +414,16 @@ discard block |
||
414 | 414 | // |
415 | 415 | function logical_end_time($r, $jobs, $user, $app) { |
416 | 416 | $total_flops = 0; |
417 | - foreach($jobs as $job) { |
|
417 | + foreach ($jobs as $job) { |
|
418 | 418 | //print_r($job); |
419 | 419 | if ($job->rsc_fpops_est) { |
420 | 420 | $total_flops += $job->rsc_fpops_est; |
421 | 421 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
422 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
422 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
423 | 423 | } else if ($r->batch->job_params->rsc_fpops_est) { |
424 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
424 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
425 | 425 | } else { |
426 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
426 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
427 | 427 | if ($x) { |
428 | 428 | $total_flops += $x; |
429 | 429 | } else { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } |
432 | 432 | } |
433 | 433 | } |
434 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
434 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
435 | 435 | $x = exec($cmd); |
436 | 436 | if (!is_numeric($x) || (double)$x == 0) { |
437 | 437 | xml_error(-1, "$cmd returned $x"); |
@@ -509,15 +509,15 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | $job_params = new StdClass; |
512 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
513 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
514 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
515 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
516 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
512 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
513 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
514 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
515 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
516 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
517 | 517 | // could add quorum-related stuff |
518 | 518 | |
519 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
520 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
519 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
520 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
521 | 521 | // possibly empty |
522 | 522 | |
523 | 523 | submit_jobs( |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | function n_outfiles($wu) { |
609 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
609 | + $path = project_dir()."/$wu->output_template_filename"; |
|
610 | 610 | $r = simplexml_load_file($path); |
611 | 611 | return count($r->file_info); |
612 | 612 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | "; |
814 | 814 | if ($result->server_state == 5) { // over? |
815 | 815 | $paths = get_outfile_paths($result); |
816 | - foreach($paths as $path) { |
|
816 | + foreach ($paths as $path) { |
|
817 | 817 | if (is_file($path)) { |
818 | 818 | $size = filesize($path); |
819 | 819 | echo " <outfile> |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | } else { |
858 | 858 | $results = BoincResult::enum("workunitid=$job_id"); |
859 | 859 | foreach ($results as $r) { |
860 | - switch($r->outcome) { |
|
860 | + switch ($r->outcome) { |
|
861 | 861 | case 1: |
862 | 862 | case 3: |
863 | 863 | case 6: |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | } |
973 | 973 | |
974 | 974 | list($user, $user_submit) = check_remote_submit_permissions($r, $app); |
975 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
976 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
975 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
976 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
977 | 977 | if ($in === false || $out === false) { |
978 | 978 | log_write("template file missing"); |
979 | 979 | xml_error(-1, "template file missing"); |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | |
986 | 986 | function ping($r) { |
987 | 987 | xml_start_tag("ping"); |
988 | - BoincDb::get(); // errors out if DB down or web disabled |
|
988 | + BoincDb::get(); // errors out if DB down or web disabled |
|
989 | 989 | echo "<success>1</success> |
990 | 990 | </ping> |
991 | 991 | "; |
@@ -1052,9 +1052,9 @@ discard block |
||
1052 | 1052 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1053 | 1053 | if ($request_log) { |
1054 | 1054 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1055 | - $request_log = $log_dir . "/" . $request_log; |
|
1055 | + $request_log = $log_dir."/".$request_log; |
|
1056 | 1056 | if ($file = fopen($request_log, "a")) { |
1057 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
1057 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
1058 | 1058 | fclose($file); |
1059 | 1059 | } |
1060 | 1060 | } |