@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($template) { |
55 | 55 | $t = (double)$template->workunit->rsc_fpops_est; |
56 | 56 | } |
57 | - foreach($r->batch->job as $job) { |
|
57 | + foreach ($r->batch->job as $job) { |
|
58 | 58 | $y = (double)$job->rsc_fpops_est; |
59 | 59 | if ($y) { |
60 | 60 | $x += $y; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | function est_elapsed_time($r, $template) { |
80 | 80 | // crude estimate: batch FLOPs / project FLOPS |
81 | 81 | // |
82 | - return batch_flop_count($r, $template) / project_flops(); |
|
82 | + return batch_flop_count($r, $template)/project_flops(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // if batch-level input template filename was given, read it; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | // |
90 | 90 | function read_input_template($app, $r) { |
91 | 91 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
92 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
92 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
93 | 93 | } else { |
94 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
94 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
95 | 95 | } |
96 | 96 | if (file_exists($path)) { |
97 | 97 | $x = simplexml_load_file($path); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | function validate_batch($jobs, $template) { |
135 | 135 | $i = 0; |
136 | 136 | $n = count($template->file_info); |
137 | - foreach($jobs as $job) { |
|
137 | + foreach ($jobs as $job) { |
|
138 | 138 | $m = count($job->input_files); |
139 | 139 | if ($n != $m) { |
140 | 140 | xml_error(-1, "wrong # of input files for job $i: need $n, got $m"); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // stage all the files |
190 | 190 | // |
191 | 191 | function stage_files(&$jobs) { |
192 | - foreach($jobs as $job) { |
|
192 | + foreach ($jobs as $job) { |
|
193 | 193 | foreach ($job->input_files as $file) { |
194 | 194 | if ($file->mode != "remote") { |
195 | 195 | $file->name = stage_file($file); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // |
203 | 203 | function submit_jobs( |
204 | 204 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
205 | - $input_template_filename, // batch-level; can also specify per job |
|
205 | + $input_template_filename, // batch-level; can also specify per job |
|
206 | 206 | $output_template_filename |
207 | 207 | ) { |
208 | 208 | global $input_templates, $output_templates; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // one line per job |
212 | 212 | // |
213 | 213 | $x = ""; |
214 | - foreach($jobs as $job) { |
|
214 | + foreach ($jobs as $job) { |
|
215 | 215 | if ($job->name) { |
216 | 216 | $x .= " --wu_name $job->name"; |
217 | 217 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | $x .= "\n"; |
244 | 244 | } |
245 | 245 | |
246 | - $errfile = "/tmp/create_work_" . getmypid() . ".err"; |
|
247 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
246 | + $errfile = "/tmp/create_work_".getmypid().".err"; |
|
247 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
248 | 248 | if ($input_template_filename) { |
249 | 249 | $cmd .= " --wu_template templates/$input_template_filename"; |
250 | 250 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | // |
341 | 341 | function xml_get_jobs($r) { |
342 | 342 | $jobs = array(); |
343 | - foreach($r->batch->job as $j) { |
|
343 | + foreach ($r->batch->job as $j) { |
|
344 | 344 | $job = new StdClass; |
345 | 345 | $job->input_files = array(); |
346 | 346 | $job->command_line = (string)$j->command_line; |
@@ -420,16 +420,16 @@ discard block |
||
420 | 420 | // - use that for batch logical end time and job priority |
421 | 421 | // |
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"); |
@@ -461,15 +461,15 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | $job_params = new StdClass; |
464 | - $job_params->rsc_disk_bound = (double) $r->job_params->rsc_disk_bound; |
|
465 | - $job_params->rsc_fpops_est = (double) $r->job_params->rsc_fpops_est; |
|
466 | - $job_params->rsc_fpops_bound = (double) $r->job_params->rsc_fpops_bound; |
|
467 | - $job_params->rsc_memory_bound = (double) $r->job_params->rsc_memory_bound; |
|
468 | - $job_params->delay_bound = (double) $r->job_params->delay_bound; |
|
464 | + $job_params->rsc_disk_bound = (double)$r->job_params->rsc_disk_bound; |
|
465 | + $job_params->rsc_fpops_est = (double)$r->job_params->rsc_fpops_est; |
|
466 | + $job_params->rsc_fpops_bound = (double)$r->job_params->rsc_fpops_bound; |
|
467 | + $job_params->rsc_memory_bound = (double)$r->job_params->rsc_memory_bound; |
|
468 | + $job_params->delay_bound = (double)$r->job_params->delay_bound; |
|
469 | 469 | // could add quorum-related stuff |
470 | 470 | |
471 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
472 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
471 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
472 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
473 | 473 | // possibly empty |
474 | 474 | |
475 | 475 | submit_jobs( |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | function n_outfiles($wu) { |
555 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
555 | + $path = project_dir()."/$wu->output_template_filename"; |
|
556 | 556 | $r = simplexml_load_file($path); |
557 | 557 | return count($r->file_info); |
558 | 558 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | "; |
749 | 749 | if ($result->server_state == 5) { // over? |
750 | 750 | $paths = get_outfile_paths($result); |
751 | - foreach($paths as $path) { |
|
751 | + foreach ($paths as $path) { |
|
752 | 752 | if (is_file($path)) { |
753 | 753 | $size = filesize($path); |
754 | 754 | echo " <outfile> |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | } else { |
789 | 789 | $results = BoincResult::enum("workunitid=$job_id"); |
790 | 790 | foreach ($results as $r) { |
791 | - switch($r->outcome) { |
|
791 | + switch ($r->outcome) { |
|
792 | 792 | case 1: |
793 | 793 | case 3: |
794 | 794 | case 6: |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | } |
897 | 897 | |
898 | 898 | list($user, $user_submit) = authenticate_user($r, $app); |
899 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
900 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
899 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
900 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
901 | 901 | if ($in === false || $out === false) { |
902 | 902 | xml_error(-1, "template file missing"); |
903 | 903 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | function ping($r) { |
910 | 910 | xml_start_tag("ping"); |
911 | - BoincDb::get(); // errors out if DB down or web disabled |
|
911 | + BoincDb::get(); // errors out if DB down or web disabled |
|
912 | 912 | echo "<success>1</success> |
913 | 913 | </ping> |
914 | 914 | "; |
@@ -974,10 +974,10 @@ discard block |
||
974 | 974 | if ($request_log) { |
975 | 975 | $request_log_dir = parse_config(get_config(), "<log_dir>"); |
976 | 976 | if ($request_log_dir) { |
977 | - $request_log = $request_log_dir . "/" . $request_log; |
|
977 | + $request_log = $request_log_dir."/".$request_log; |
|
978 | 978 | } |
979 | 979 | if ($file = fopen($request_log, "a+")) { |
980 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
980 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
981 | 981 | fclose($file); |
982 | 982 | } |
983 | 983 | } |