@@ -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,14 +420,14 @@ 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 { |
| 430 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
| 430 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
| 431 | 431 | if ($x) { |
| 432 | 432 | $total_flops += $x; |
| 433 | 433 | } else { |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 438 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 439 | 439 | $x = exec($cmd); |
| 440 | 440 | if (!is_numeric($x) || (double)$x == 0) { |
| 441 | 441 | xml_error(-1, "$cmd returned $x"); |
@@ -459,15 +459,15 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | $job_params = new StdClass; |
| 462 | - $job_params->rsc_disk_bound = (double) $r->job_params->rsc_disk_bound; |
|
| 463 | - $job_params->rsc_fpops_est = (double) $r->job_params->rsc_fpops_est; |
|
| 464 | - $job_params->rsc_fpops_bound = (double) $r->job_params->rsc_fpops_bound; |
|
| 465 | - $job_params->rsc_memory_bound = (double) $r->job_params->rsc_memory_bound; |
|
| 466 | - $job_params->delay_bound = (double) $r->job_params->delay_bound; |
|
| 462 | + $job_params->rsc_disk_bound = (double)$r->job_params->rsc_disk_bound; |
|
| 463 | + $job_params->rsc_fpops_est = (double)$r->job_params->rsc_fpops_est; |
|
| 464 | + $job_params->rsc_fpops_bound = (double)$r->job_params->rsc_fpops_bound; |
|
| 465 | + $job_params->rsc_memory_bound = (double)$r->job_params->rsc_memory_bound; |
|
| 466 | + $job_params->delay_bound = (double)$r->job_params->delay_bound; |
|
| 467 | 467 | // could add quorum-related stuff |
| 468 | 468 | |
| 469 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
| 470 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
| 469 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
| 470 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
| 471 | 471 | // possibly empty |
| 472 | 472 | |
| 473 | 473 | submit_jobs( |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | function n_outfiles($wu) { |
| 553 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
| 553 | + $path = project_dir()."/$wu->output_template_filename"; |
|
| 554 | 554 | $r = simplexml_load_file($path); |
| 555 | 555 | return count($r->file_info); |
| 556 | 556 | } |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | "; |
| 747 | 747 | if ($result->server_state == 5) { // over? |
| 748 | 748 | $paths = get_outfile_paths($result); |
| 749 | - foreach($paths as $path) { |
|
| 749 | + foreach ($paths as $path) { |
|
| 750 | 750 | if (is_file($path)) { |
| 751 | 751 | $size = filesize($path); |
| 752 | 752 | echo " <outfile> |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | } else { |
| 787 | 787 | $results = BoincResult::enum("workunitid=$job_id"); |
| 788 | 788 | foreach ($results as $r) { |
| 789 | - switch($r->outcome) { |
|
| 789 | + switch ($r->outcome) { |
|
| 790 | 790 | case 1: |
| 791 | 791 | case 3: |
| 792 | 792 | case 6: |
@@ -894,8 +894,8 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | list($user, $user_submit) = authenticate_user($r, $app); |
| 897 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
| 898 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
| 897 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
| 898 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
| 899 | 899 | if ($in === false || $out === false) { |
| 900 | 900 | xml_error(-1, "template file missing"); |
| 901 | 901 | } |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | function ping($r) { |
| 908 | 908 | xml_start_tag("ping"); |
| 909 | - BoincDb::get(); // errors out if DB down or web disabled |
|
| 909 | + BoincDb::get(); // errors out if DB down or web disabled |
|
| 910 | 910 | echo "<success>1</success> |
| 911 | 911 | </ping> |
| 912 | 912 | "; |
@@ -972,10 +972,10 @@ discard block |
||
| 972 | 972 | if ($request_log) { |
| 973 | 973 | $request_log_dir = parse_config(get_config(), "<log_dir>"); |
| 974 | 974 | if ($request_log_dir) { |
| 975 | - $request_log = $request_log_dir . "/" . $request_log; |
|
| 975 | + $request_log = $request_log_dir."/".$request_log; |
|
| 976 | 976 | } |
| 977 | 977 | if ($file = fopen($request_log, "a+")) { |
| 978 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
| 978 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
| 979 | 979 | fclose($file); |
| 980 | 980 | } |
| 981 | 981 | } |