@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // |
66 | 66 | function unzip_batch_file($user, $batch_file) { |
67 | 67 | @mkdir("../../buda_batches"); |
68 | - for ($i=0; $i<1000; $i++) { |
|
68 | + for ($i = 0; $i < 1000; $i++) { |
|
69 | 69 | $batch_dir = "../../buda_batches/$i"; |
70 | 70 | $batch_dir_name = $i; |
71 | 71 | $ret = @mkdir($batch_dir); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | $job_files = []; |
118 | 118 | $cmdline = ''; |
119 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
119 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
120 | 120 | if ($f2[0] == '.') continue; |
121 | 121 | if ($f2 == 'cmdline') { |
122 | 122 | $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline")); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
167 | 167 | $n = count($batch_desc->shared_files); |
168 | 168 | $batch_desc->shared_files_phys_names = []; |
169 | - for ($i=0; $i<$n; $i++) { |
|
169 | + for ($i = 0; $i < $n; $i++) { |
|
170 | 170 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
171 | 171 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
172 | 172 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | foreach ($batch_desc->jobs as $job) { |
177 | 177 | $n = count($batch_desc->unshared_files); |
178 | 178 | $job->phys_names = []; |
179 | - for ($i=0; $i<$n; $i++) { |
|
179 | + for ($i = 0; $i < $n; $i++) { |
|
180 | 180 | $path = sprintf('%s/%s/%s', |
181 | 181 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
182 | 182 | ); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | $wrapper_cmdline = sprintf('"--dockerfile %s %s %s"', |
226 | 226 | $variant_desc->dockerfile, |
227 | - $wrapper_verbose?'--verbose':'', |
|
227 | + $wrapper_verbose ? '--verbose' : '', |
|
228 | 228 | $cmdline |
229 | 229 | ); |
230 | 230 | $cmd = sprintf( |
@@ -93,9 +93,9 @@ |
||
93 | 93 | global $job_keywords; |
94 | 94 | $kw = $job_keywords[$id]; |
95 | 95 | $u = $uprefs[$id]; |
96 | - $yes_checked = ($u == KW_YES)?"checked":""; |
|
97 | - $no_checked = ($u == KW_NO)?"checked":""; |
|
98 | - $maybe_checked = ($u == KW_MAYBE)?"checked":""; |
|
96 | + $yes_checked = ($u == KW_YES) ? "checked" : ""; |
|
97 | + $no_checked = ($u == KW_NO) ? "checked" : ""; |
|
98 | + $maybe_checked = ($u == KW_MAYBE) ? "checked" : ""; |
|
99 | 99 | |
100 | 100 | echo sprintf('<tr id="%s" hidden>%s', "row$id", "\n"); |
101 | 101 | echo sprintf(' <td width=50%% id="%s"></td>%s', "text$id", "\n"); |
@@ -298,7 +298,7 @@ |
||
298 | 298 | |
299 | 299 | render(); |
300 | 300 | |
301 | -EOT; |
|
301 | +eot; |
|
302 | 302 | echo "</script>\n"; |
303 | 303 | } |
304 | 304 |
@@ -31,14 +31,14 @@ |
||
31 | 31 | if (file_exists($path)) { |
32 | 32 | $x = file($path); |
33 | 33 | $yes = explode(' ', trim($x[0])); |
34 | - if ($yes[0]=='') $yes=[]; |
|
34 | + if ($yes[0] == '') $yes = []; |
|
35 | 35 | $yes = array_map('intval', $yes); |
36 | 36 | $no = explode(' ', trim($x[1])); |
37 | - if ($no[0]=='') $no=[]; |
|
37 | + if ($no[0] == '') $no = []; |
|
38 | 38 | $no = array_map('intval', $no); |
39 | 39 | return [$yes, $no]; |
40 | 40 | } else { |
41 | - return [[],[]]; |
|
41 | + return [[], []]; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // show list of BUDA apps and variants, |
59 | 59 | // w/ buttons for adding and deleting |
60 | 60 | // |
61 | -function app_list($notice=null) { |
|
61 | +function app_list($notice = null) { |
|
62 | 62 | global $buda_root; |
63 | 63 | if (!is_dir($buda_root)) { |
64 | 64 | mkdir($buda_root); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | // |
298 | 298 | $x = "<input_template>\n"; |
299 | 299 | $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files); |
300 | - for ($i=0; $i<$ninfiles; $i++) { |
|
300 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
301 | 301 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
302 | 302 | } |
303 | 303 | $x .= " <workunit>\n"; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | ); |
328 | 328 | |
329 | 329 | $x .= sprintf(" <max_delay>%f</max_delay>\n", |
330 | - $variant_desc->max_delay_days * 86400. |
|
330 | + $variant_desc->max_delay_days*86400. |
|
331 | 331 | ); |
332 | 332 | |
333 | 333 | $x .= " </workunit>\n<input_template>\n"; |
@@ -537,22 +537,22 @@ discard block |
||
537 | 537 | form_input_text('Internal name<br><small>No spaces</small>', 'name'); |
538 | 538 | } |
539 | 539 | form_input_text('User-visible name', 'long_name', |
540 | - $desc?$desc->long_name:null |
|
540 | + $desc ? $desc->long_name : null |
|
541 | 541 | ); |
542 | 542 | form_input_textarea( |
543 | 543 | 'Description<br><small>... of what the app does and of the research goals</small>', |
544 | 544 | 'description', |
545 | - $desc?$desc->description:null |
|
545 | + $desc ? $desc->description : null |
|
546 | 546 | ); |
547 | 547 | form_select2_multi('Science keywords', |
548 | 548 | 'sci_kw', |
549 | 549 | keyword_select_options(KW_CATEGORY_SCIENCE), |
550 | - $desc?$desc->sci_kw:null |
|
550 | + $desc ? $desc->sci_kw : null |
|
551 | 551 | ); |
552 | 552 | form_input_text( |
553 | 553 | 'URL of web page describing app', |
554 | 554 | 'url', |
555 | - !empty($desc->url)?$desc->url:'' |
|
555 | + !empty($desc->url) ? $desc->url : '' |
|
556 | 556 | ); |
557 | 557 | // don't include location keywords; |
558 | 558 | // various people may submit jobs to this app |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } else { |
243 | 243 | form_input_text("Plan class$pc", 'variant', $variant); |
244 | 244 | } |
245 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
245 | + form_select("dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
246 | 246 | form_select2_multi("Application files$sb", 'app_files', $sbitems, $variant_desc->app_files); |
247 | 247 | form_input_text( |
248 | 248 | 'Input file names<br><small>Space-separated</small>', |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | // Note: we don't currently allow indirect file access. |
457 | 457 | // If we did, we'd need to create job.toml to mount project dir |
458 | 458 | |
459 | - app_list("Variant $variant added for app $app."); |
|
459 | + app_list("variant $variant added for app $app."); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | function variant_delete() { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | if ($ret) { |
484 | 484 | error_page("delete failed"); |
485 | 485 | } |
486 | - $notice = "Variant $variant of app $app removed."; |
|
486 | + $notice = "variant $variant of app $app removed."; |
|
487 | 487 | app_list($notice); |
488 | 488 | } else { |
489 | 489 | page_head("Confirm"); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | if ($ret) { |
513 | 513 | error_page('delete failed'); |
514 | 514 | } |
515 | - $notice = "App $app removed."; |
|
515 | + $notice = "app $app removed."; |
|
516 | 516 | app_list($notice); |
517 | 517 | } else { |
518 | 518 | page_head('Confirm'); |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | } |
570 | 570 | $dir = "$buda_root/$name"; |
571 | 571 | if (file_exists($dir)) { |
572 | - error_page("App $name already exists."); |
|
572 | + error_page("app $name already exists."); |
|
573 | 573 | } |
574 | 574 | mkdir($dir); |
575 | 575 | header("Location: buda.php"); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | implode('<br>', $kws), |
70 | 70 | $u->quota, |
71 | 71 | $u->max_jobs_in_progress, |
72 | - ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---' |
|
72 | + ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---' |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | - $quota = (double) get_str('quota'); |
|
176 | + $quota = (double)get_str('quota'); |
|
177 | 177 | if ($quota != $us->quota) { |
178 | 178 | $us->update("quota=$quota"); |
179 | 179 | } |
180 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
180 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
181 | 181 | if ($mj != $us->max_jobs_in_progress) { |
182 | 182 | $us->update("max_jobs_in_progress=$mj"); |
183 | 183 | } |