@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if ($template) { |
60 | 60 | $t = (double)$template->workunit->rsc_fpops_est; |
61 | 61 | } |
62 | - foreach($r->batch->job as $job) { |
|
62 | + foreach ($r->batch->job as $job) { |
|
63 | 63 | $y = (double)$job->rsc_fpops_est; |
64 | 64 | if ($y) { |
65 | 65 | $x += $y; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | function est_elapsed_time($r, $template) { |
86 | 86 | // crude estimate: batch FLOPs / project FLOPS |
87 | 87 | // |
88 | - return batch_flop_count($r, $template) / project_flops(); |
|
88 | + return batch_flop_count($r, $template)/project_flops(); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // if batch-level input template filename was given, read it; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | // |
96 | 96 | function read_input_template($app, $r) { |
97 | 97 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
98 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
98 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
99 | 99 | } else { |
100 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
100 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
101 | 101 | } |
102 | 102 | if (file_exists($path)) { |
103 | 103 | $x = simplexml_load_file($path); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | function validate_batch($jobs, $template) { |
146 | 146 | $i = 0; |
147 | 147 | $n = count($template->file_info); |
148 | - foreach($jobs as $job) { |
|
148 | + foreach ($jobs as $job) { |
|
149 | 149 | $m = count($job->input_files); |
150 | 150 | if ($n != $m) { |
151 | 151 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // stage all the files |
215 | 215 | // |
216 | 216 | function stage_files(&$jobs, $user) { |
217 | - foreach($jobs as $job) { |
|
217 | + foreach ($jobs as $job) { |
|
218 | 218 | foreach ($job->input_files as $file) { |
219 | 219 | if ($file->mode != "remote") { |
220 | 220 | $file->name = stage_file($file, $user); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // |
228 | 228 | function submit_jobs( |
229 | 229 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
230 | - $input_template_filename, // batch-level; can also specify per job |
|
230 | + $input_template_filename, // batch-level; can also specify per job |
|
231 | 231 | $output_template_filename, |
232 | 232 | $user |
233 | 233 | ) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // one line per job |
238 | 238 | // |
239 | 239 | $x = ""; |
240 | - foreach($jobs as $job) { |
|
240 | + foreach ($jobs as $job) { |
|
241 | 241 | if ($job->name) { |
242 | 242 | $x .= " --wu_name $job->name"; |
243 | 243 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $x .= "\n"; |
273 | 273 | } |
274 | 274 | |
275 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
275 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
276 | 276 | |
277 | 277 | if ($user->seti_id) { |
278 | 278 | $cmd .= " --target_user $user->id "; |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | // |
384 | 384 | function xml_get_jobs($r) { |
385 | 385 | $jobs = array(); |
386 | - foreach($r->batch->job as $j) { |
|
386 | + foreach ($r->batch->job as $j) { |
|
387 | 387 | $job = new StdClass; |
388 | 388 | $job->input_files = array(); |
389 | 389 | $job->command_line = (string)$j->command_line; |
@@ -436,16 +436,16 @@ discard block |
||
436 | 436 | // |
437 | 437 | function logical_end_time($r, $jobs, $user, $app) { |
438 | 438 | $total_flops = 0; |
439 | - foreach($jobs as $job) { |
|
439 | + foreach ($jobs as $job) { |
|
440 | 440 | //print_r($job); |
441 | 441 | if ($job->rsc_fpops_est) { |
442 | 442 | $total_flops += $job->rsc_fpops_est; |
443 | 443 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
444 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
444 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
445 | 445 | } else if ($r->batch->job_params->rsc_fpops_est) { |
446 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
446 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
447 | 447 | } else { |
448 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
448 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
449 | 449 | if ($x) { |
450 | 450 | $total_flops += $x; |
451 | 451 | } else { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
456 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
456 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
457 | 457 | $x = exec($cmd); |
458 | 458 | if (!is_numeric($x) || (double)$x == 0) { |
459 | 459 | xml_error(-1, "$cmd returned $x"); |
@@ -538,15 +538,15 @@ discard block |
||
538 | 538 | } |
539 | 539 | |
540 | 540 | $job_params = new StdClass; |
541 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
542 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
543 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
544 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
545 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
541 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
542 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
543 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
544 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
545 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
546 | 546 | // could add quorum-related stuff |
547 | 547 | |
548 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
549 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
548 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
549 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
550 | 550 | // possibly empty |
551 | 551 | |
552 | 552 | submit_jobs( |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | } |
640 | 640 | |
641 | 641 | function n_outfiles($wu) { |
642 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
642 | + $path = project_dir()."/$wu->output_template_filename"; |
|
643 | 643 | $r = simplexml_load_file($path); |
644 | 644 | return count($r->file_info); |
645 | 645 | } |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | "; |
847 | 847 | if ($result->server_state == 5) { // over? |
848 | 848 | $paths = get_outfile_paths($result); |
849 | - foreach($paths as $path) { |
|
849 | + foreach ($paths as $path) { |
|
850 | 850 | if (is_file($path)) { |
851 | 851 | $size = filesize($path); |
852 | 852 | echo " <outfile> |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | } else { |
891 | 891 | $results = BoincResult::enum("workunitid=$job_id"); |
892 | 892 | foreach ($results as $r) { |
893 | - switch($r->outcome) { |
|
893 | + switch ($r->outcome) { |
|
894 | 894 | case 1: |
895 | 895 | case 3: |
896 | 896 | case 6: |
@@ -1005,8 +1005,8 @@ discard block |
||
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | $user = check_remote_submit_permissions($r, $app); |
1008 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
1009 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
1008 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
1009 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
1010 | 1010 | if ($in === false || $out === false) { |
1011 | 1011 | log_write("template file missing"); |
1012 | 1012 | xml_error(-1, "template file missing"); |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | function ping($r) { |
1020 | 1020 | xml_start_tag("ping"); |
1021 | - BoincDb::get(); // errors out if DB down or web disabled |
|
1021 | + BoincDb::get(); // errors out if DB down or web disabled |
|
1022 | 1022 | echo "<success>1</success> |
1023 | 1023 | </ping> |
1024 | 1024 | "; |
@@ -1092,9 +1092,9 @@ discard block |
||
1092 | 1092 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1093 | 1093 | if ($request_log) { |
1094 | 1094 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1095 | - $request_log = $log_dir . "/" . $request_log; |
|
1095 | + $request_log = $log_dir."/".$request_log; |
|
1096 | 1096 | if ($file = fopen($request_log, "a")) { |
1097 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $req . "\n</submit_rpc_handler>\n"); |
|
1097 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$req."\n</submit_rpc_handler>\n"); |
|
1098 | 1098 | fclose($file); |
1099 | 1099 | } |
1100 | 1100 | } |