@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // show list of BUDA apps and variants, |
37 | 37 | // w/ buttons for adding and deleting |
38 | 38 | // |
39 | -function app_list($notice=null) { |
|
39 | +function app_list($notice = null) { |
|
40 | 40 | global $buda_root; |
41 | 41 | if (!is_dir($buda_root)) { |
42 | 42 | mkdir($buda_root); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // |
225 | 225 | $x = "<input_template>\n"; |
226 | 226 | $ninfiles = count($desc->input_file_names); |
227 | - for ($i=0; $i<$ninfiles; $i++) { |
|
227 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
228 | 228 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
229 | 229 | } |
230 | 230 | $x .= " <workunit>\n"; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | ); |
246 | 246 | |
247 | 247 | $x .= sprintf(" <max_delay>%f</max_delay>\n", |
248 | - $desc->max_delay_days * 86400. |
|
248 | + $desc->max_delay_days*86400. |
|
249 | 249 | ); |
250 | 250 | |
251 | 251 | $x .= " <buda_app_name>$app</buda_app_name>\n"; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } else { |
319 | 319 | $creating = true; |
320 | 320 | } |
321 | - $variant = sprintf('%s_%s', $cpu_type, $plan_class?$plan_class:'cpu'); |
|
321 | + $variant = sprintf('%s_%s', $cpu_type, $plan_class ? $plan_class : 'cpu'); |
|
322 | 322 | if (!is_valid_filename($variant)) { |
323 | 323 | error_page(filename_rules()); |
324 | 324 | } |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | -function app_form($desc=null) { |
|
467 | - page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app'); |
|
466 | +function app_form($desc = null) { |
|
467 | + page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app'); |
|
468 | 468 | form_start('buda.php'); |
469 | 469 | form_input_hidden('action', 'app_action'); |
470 | 470 | if ($desc) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ); |
196 | 196 | } |
197 | 197 | form_input_text("Plan class$pc", 'plan_class', $variant_desc->plan_class); |
198 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
198 | + form_select("dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
199 | 199 | form_select2_multi("Application files$sb", 'app_files', $sbitems, $variant_desc->app_files); |
200 | 200 | form_submit('OK'); |
201 | 201 | form_end(); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | // Note: we don't currently allow indirect file access. |
394 | 394 | // If we did, we'd need to create job.toml to mount project dir |
395 | 395 | |
396 | - app_list("Variant $variant added for app $app."); |
|
396 | + app_list("variant $variant added for app $app."); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | function variant_delete() { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | if ($ret) { |
421 | 421 | error_page("delete failed"); |
422 | 422 | } |
423 | - $notice = "Variant $variant of app $app removed."; |
|
423 | + $notice = "variant $variant of app $app removed."; |
|
424 | 424 | app_list($notice); |
425 | 425 | } else { |
426 | 426 | page_head("Confirm"); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | if ($ret) { |
451 | 451 | error_page('delete failed'); |
452 | 452 | } |
453 | - $notice = "App $app removed."; |
|
453 | + $notice = "app $app removed."; |
|
454 | 454 | app_list($notice); |
455 | 455 | } else { |
456 | 456 | page_head('Confirm'); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | } |
548 | 548 | $dir = "$buda_root/$app_name"; |
549 | 549 | if (file_exists($dir)) { |
550 | - error_page("App $app_name already exists."); |
|
550 | + error_page("app $app_name already exists."); |
|
551 | 551 | } |
552 | 552 | mkdir($dir); |
553 | 553 | $desc->user_id = $user->id; |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | |
640 | 640 | $is_assim_move = is_assim_move($app); |
641 | 641 | |
642 | - page_head("Batch $batch_id"); |
|
642 | + page_head("batch $batch_id"); |
|
643 | 643 | text_start(800); |
644 | 644 | start_table(); |
645 | 645 | row2("name", $batch->name); |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | |
924 | 924 | if (get_int('confirmed', true)) { |
925 | 925 | abort_batch($batch); |
926 | - page_head("Batch $batch_id aborted"); |
|
926 | + page_head("batch $batch_id aborted"); |
|
927 | 927 | return_link(); |
928 | 928 | page_tail(); |
929 | 929 | } else { |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | |
953 | 953 | if (get_int('confirmed', true)) { |
954 | 954 | retire_batch($batch); |
955 | - page_head("Batch $batch_id retired"); |
|
955 | + page_head("batch $batch_id retired"); |
|
956 | 956 | return_link(); |
957 | 957 | page_tail(); |
958 | 958 | } else { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // |
83 | 83 | function unzip_batch_file($user, $batch_file) { |
84 | 84 | @mkdir("../../buda_batches"); |
85 | - for ($i=0; $i<1000; $i++) { |
|
85 | + for ($i = 0; $i < 1000; $i++) { |
|
86 | 86 | $batch_dir = "../../buda_batches/$i"; |
87 | 87 | $batch_dir_name = $i; |
88 | 88 | $ret = @mkdir($batch_dir); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | $job_files = []; |
135 | 135 | $cmdline = ''; |
136 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
136 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
137 | 137 | if ($f2[0] == '.') continue; |
138 | 138 | if ($f2 == 'cmdline') { |
139 | 139 | $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline")); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
188 | 188 | $n = count($batch_desc->shared_files); |
189 | 189 | $batch_desc->shared_files_phys_names = []; |
190 | - for ($i=0; $i<$n; $i++) { |
|
190 | + for ($i = 0; $i < $n; $i++) { |
|
191 | 191 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
192 | 192 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
193 | 193 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | foreach ($batch_desc->jobs as $job) { |
198 | 198 | $n = count($batch_desc->unshared_files); |
199 | 199 | $job->phys_names = []; |
200 | - for ($i=0; $i<$n; $i++) { |
|
200 | + for ($i = 0; $i < $n; $i++) { |
|
201 | 201 | $path = sprintf('%s/%s/%s', |
202 | 202 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
203 | 203 | ); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $job_cmds .= "$job_cmd\n"; |
237 | 237 | } |
238 | 238 | $wrapper_cmdline = sprintf('"%s %s"', |
239 | - $wrapper_verbose?'--verbose':'', |
|
239 | + $wrapper_verbose ? '--verbose' : '', |
|
240 | 240 | $cmdline |
241 | 241 | ); |
242 | 242 | $cmd = sprintf( |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $max_runtime_days = (double)$max_runtime_days; |
284 | 284 | if ($max_runtime_days <= 0) error_page('bad runtime limit'); |
285 | 285 | if ($max_runtime_days > 100) error_page('bad runtime limit'); |
286 | - $max_fpops = $max_runtime_days * 4.3e9 * 86400; |
|
286 | + $max_fpops = $max_runtime_days*4.3e9*86400; |
|
287 | 287 | |
288 | 288 | $exp_runtime_days = get_str('exp_runtime_days'); |
289 | 289 | if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime'); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($exp_runtime_days > $max_runtime_days) { |
294 | 294 | error_page('exp must be < max runtime'); |
295 | 295 | } |
296 | - $exp_fpops = $exp_runtime_days * 4.3e9 * 86400; |
|
296 | + $exp_fpops = $exp_runtime_days*4.3e9*86400; |
|
297 | 297 | |
298 | 298 | $app_desc = get_buda_app_desc($app); |
299 | 299 |