- Timestamp:
- Sep 19, 2014, 4:05:27 PM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/sc_prepare_chip.pl (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/ippScripts/scripts/sc_prepare_chip.pl
r36680 r37403 18 18 19 19 # Hard coded values 20 my $remote_root = '/scratch3/watersc1/'; # Far side destination base location 20 # my $remote_root = '/scratch3/watersc1/'; # Far side destination base location 21 my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location 22 $remote_root = '/scratch3/watersc1/'; 23 my $remote_raw = "${remote_root}/raw/"; # Directory to find raw data in. 21 24 my $threads = 2; # How many threads are we going to use? 22 25 my $job_cost = 150 / 60 / 60; # Estimate of how long a job runs, in hours. … … 126 129 $detselect_command2 .= " -det_id $det_id "; 127 130 $detselect_command2 .= " -iteration $det_iter "; 131 $detselect_command2 .= " -dbname $dbname " if defined($dbname); 128 132 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 129 133 run(command => $detselect_command2, verbose => 0); … … 150 154 #print Dumper(%detrends); 151 155 156 my @return_component_list = ("DBINFO.IMFILE","PPIMAGE.STATS","LOG.IMFILE","PPIMAGE.BACKMDL","PPIMAGE.PATTERN"); 152 157 153 158 # … … 157 162 my $uri_check = $path_base . ".check"; 158 163 my $uri_config = $path_base . ".config"; 164 my $uri_generate= $path_base . ".generate"; 165 my $uri_return = $path_base . ".return"; 159 166 160 167 my $disk_command = $ipprc->file_resolve($uri_command,1); … … 162 169 my $disk_check = $ipprc->file_resolve($uri_check,1); 163 170 my $disk_config = $ipprc->file_resolve($uri_config,1); 171 my $disk_generate= $ipprc->file_resolve($uri_generate,1); 172 my $disk_return = $ipprc->file_resolve($uri_return,1); 164 173 165 174 my (undef, $remote_config) = uri_convert($uri_config); # Needs to be done after we've created it. … … 168 177 open(CHECK, ">$disk_check") || &my_die("Couldn't open file? $disk_check",$chip_id,$PS_EXIT_SYS_ERROR); 169 178 open(CONFIG, ">$disk_config") || &my_die("Couldn't open file? $disk_config",$chip_id,$PS_EXIT_SYS_ERROR); 179 open(GENERATE, ">$disk_generate") || &my_die("Couldn't open file? $disk_generate",$chip_id,$PS_EXIT_SYS_ERROR); 180 open(RETURN, ">$disk_return") || &my_die("Couldn't open file? $disk_return", $chip_id, $PS_EXIT_SYS_ERROR); 181 170 182 171 183 # … … 185 197 186 198 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 187 run(command => $command, verbose => $verbose);199 run(command => $command, verbose => 0); 188 200 unless ($success) { 189 201 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 254 266 255 267 my $chipData = $mdcParser->parse(join "", @$stdout_buf) or 256 &my_die("Unable to parse chiptool -pendingimfile information.", 257 $chip_id,$error_code); 268 next; 269 # &my_die("Unable to parse chiptool -pendingimfile information.", 270 # $chip_id,$error_code); 258 271 my $chipData2= parse_md_list($chipData); 259 272 … … 270 283 271 284 # Process the image and burntool table 272 my ( undef,$remote_uri) = uri_to_outputs($uri);285 my ($ipp_uri,$remote_uri) = uri_to_outputs_raw($uri); 273 286 my $btt = $uri; 274 287 $btt =~ s/fits$/burn.tbl/; 275 my ( undef,$remote_btt) = uri_to_outputs($btt);288 my ($ipp_btt,$remote_btt) = uri_to_outputs_raw($btt); 276 289 277 290 # Initialize the ppI command … … 287 300 my $det_code = $det_types{$det}; 288 301 my $duri = $detrends_to_use{$det}->{$class_id}; 289 my ( undef, $remote_det_uri) = uri_to_outputs($duri);302 my ($ipp_det_uri, $remote_det_uri) = uri_to_outputs_raw($duri); 290 303 $ppImage_command .= " $det_code $remote_det_uri "; 291 304 } … … 305 318 $ppImage_command .= " -recipe PSPHOT $recipe_psphot "; 306 319 $ppImage_command .= " -recipe PPSTATS CHIPSTATS -stats ${remote_outroot}.${class_id}.stats "; 307 $ppImage_command .= " -threads $threads";320 $ppImage_command .= " -threads 4 "; 308 321 $ppImage_command .= " -image_id $chip_imfile_id "; 309 322 $ppImage_command .= " -tracedest ${remote_outroot}.${class_id}.trace "; 310 323 $ppImage_command .= " -log ${remote_outroot}.${class_id}.log "; 311 324 312 push @main_commands, $ppImage_command;325 # push @main_commands, $ppImage_command; 313 326 314 327 # Calculate pre and post commands 315 328 my $remote_outroot_dir = dirname($remote_outroot); 316 push @pre_commands,"mkdir -p $remote_outroot_dir";329 my $pre_command = "mkdir -p $remote_outroot_dir"; 317 330 318 331 my $post_commandA = "chiptool -addprocessedimfile -exp_id $exp_id -chip_id $chip_id -class_id $class_id "; … … 321 334 $post_commandA .= " -dbname $dbname " if defined $dbname; 322 335 323 my $post_commandB = "echo -n $post_commandA > ${remote_outroot}.${class_id}.dbinfo &&";336 my $post_commandB = "echo -n \"$post_commandA\" > ${remote_outroot}.${class_id}.dbinfo "; 324 337 my $post_commandC = "ppStatsFromMetadata ${remote_outroot}.${class_id}.stats - CHIP_IMFILE >> ${remote_outroot}.${class_id}.dbinfo"; 325 338 326 push @post_commands, "$post_commandB $post_commandC";339 # push @post_commands, "$post_commandB $post_commandC"; 327 340 328 341 $job_index++; 342 343 print CONFIG "${pre_command} && ${ppImage_command} && ${post_commandB} && ${post_commandC}"; 344 345 346 # Determine which output files need to be returned. 347 foreach my $component (@return_component_list) { 348 # uri_convert_and_create( $ipprc->filename($component, $ipp_outroot, $class_id) ); 349 my $filename = $ipprc->filename($component, $ipp_outroot, $class_id); 350 my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename ); 351 my $remote_outroot_dir = dirname($ipp_disk); 352 print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk "; 353 # print " $filename $ipp_disk $remote_disk\n"; 354 # die; 355 } 356 357 print CONFIG "\n"; 329 358 } 330 359 } 331 360 332 361 # Actually put the commands into the output file. 333 my %unique_cmds = ();334 foreach my $cmd (@pre_commands) {335 unless(exists($unique_cmds{$cmd})) {336 print CONFIG $cmd . "\n";337 $unique_cmds{$cmd} = 1;338 }339 }340 foreach my $cmd (@main_commands) {341 unless(exists($unique_cmds{$cmd})) {342 print CONFIG $cmd . "\n";343 $unique_cmds{$cmd} = 1;344 }345 }346 foreach my $cmd (@post_commands) {347 unless(exists($unique_cmds{$cmd})) {348 print CONFIG $cmd . "\n";349 $unique_cmds{$cmd} = 1;350 }351 }362 # my %unique_cmds = (); 363 # foreach my $cmd (@pre_commands) { 364 # unless(exists($unique_cmds{$cmd})) { 365 # print CONFIG $cmd . "\n"; 366 # $unique_cmds{$cmd} = 1; 367 # } 368 # } 369 # foreach my $cmd (@main_commands) { 370 # unless(exists($unique_cmds{$cmd})) { 371 # print CONFIG $cmd . "\n"; 372 # $unique_cmds{$cmd} = 1; 373 # } 374 # } 375 # foreach my $cmd (@post_commands) { 376 # unless(exists($unique_cmds{$cmd})) { 377 # print CONFIG $cmd . "\n"; 378 # $unique_cmds{$cmd} = 1; 379 # } 380 # } 352 381 353 382 close(CONFIG); 354 383 close(TRANSFER); 355 384 close(CHECK); 385 close(RETURN); 386 close(GENERATE); 356 387 357 388 # … … 376 407 $node_req = int(($node_need * $job_cost) / ($fill_factor * $time_req)) + 1; 377 408 } 409 $time_req += 1; # Safety addition. 378 410 379 411 open(COMMAND, ">$disk_command") || &my_die("Couldn't open file? $disk_command",$chip_id,$PS_EXIT_SYS_ERROR); … … 425 457 } 426 458 459 sub uri_convert_and_create { 460 my $neb_uri = shift; 461 my $ipp_disk= $ipprc->file_resolve( $neb_uri , 1); 462 my $remote_disk = $ipp_disk; 463 464 unless(defined($ipp_disk)) { 465 my_die(); 466 } 467 468 $remote_disk =~ s%^.*/%%; # Remove nebulous path 469 $remote_disk =~ s%^\d+\.%%; # Remove ins_id 470 $remote_disk =~ s%:%/%g; # Replace colons with directories 471 $remote_disk = "${remote_root}/${remote_disk}"; 472 return($ipp_disk,$remote_disk); 473 } 474 427 475 sub uri_to_outputs { 428 476 my $neb_uri = shift; … … 433 481 print TRANSFER "$ipp_disk\n"; 434 482 print CHECK "$remote_disk\n"; 483 } 484 return($ipp_disk,$remote_disk); 485 } 486 487 sub uri_to_outputs_raw { 488 my $neb_uri = shift; 489 my ($ipp_disk, $remote_disk) = uri_convert( $neb_uri ); 490 $remote_disk = $remote_raw . $ipp_disk; 491 unless (exists($file_filter{$neb_uri})) { 492 $file_filter{$neb_uri} = 1; 493 print TRANSFER "$ipp_disk\n"; 494 print CHECK "$remote_disk\n"; 495 } 496 return($ipp_disk,$remote_disk); 497 } 498 499 sub uri_to_outputs_for_return { 500 my $neb_uri = shift; 501 my ($ipp_disk, $remote_disk) = uri_convert_and_create( $neb_uri ); 502 unless (exists($file_filter{$neb_uri})) { 503 $file_filter{$neb_uri} = 1; 504 print RETURN "$ipp_disk\n"; 505 print GENERATE "$remote_disk\n"; 435 506 } 436 507 return($ipp_disk,$remote_disk); … … 467 538 468 539 if (defined $id and not $no_update) { 469 my $command = "remotetool -updaterun - stage_id $id";540 my $command = "remotetool -updaterun -remote_id $id"; 470 541 $command .= " -fault $exit_code " if defined $exit_code; 471 542 $command .= " -set_state $exit_state " if defined $exit_state;
Note:
See TracChangeset
for help on using the changeset viewer.
