Changeset 36844 for trunk/ippScripts/scripts/sc_prepare_chip.pl
- Timestamp:
- Jun 9, 2014, 6:17:18 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_prepare_chip.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_prepare_chip.pl
r36596 r36844 19 19 # Hard coded values 20 20 my $remote_root = '/scratch3/watersc1/'; # Far side destination base location 21 my $remote_raw = "${remote_root}/raw/"; # Directory to find raw data in. 21 22 my $threads = 2; # How many threads are we going to use? 22 23 my $job_cost = 150 / 60 / 60; # Estimate of how long a job runs, in hours. … … 150 151 #print Dumper(%detrends); 151 152 153 my @return_component_list = ("DBINFO.IMFILE","PPIMAGE.STATS","LOG.IMFILE","TRACE.IMFILE","PPIMAGE.BACKMDL","PPIMAGE.PATTERN"); 152 154 153 155 # … … 157 159 my $uri_check = $path_base . ".check"; 158 160 my $uri_config = $path_base . ".config"; 161 my $uri_generate= $path_base . ".generate"; 162 my $uri_return = $path_base . ".return"; 159 163 160 164 my $disk_command = $ipprc->file_resolve($uri_command,1); … … 162 166 my $disk_check = $ipprc->file_resolve($uri_check,1); 163 167 my $disk_config = $ipprc->file_resolve($uri_config,1); 168 my $disk_generate= $ipprc->file_resolve($uri_generate,1); 169 my $disk_return = $ipprc->file_resolve($uri_return,1); 164 170 165 171 my (undef, $remote_config) = uri_convert($uri_config); # Needs to be done after we've created it. … … 168 174 open(CHECK, ">$disk_check") || &my_die("Couldn't open file? $disk_check",$chip_id,$PS_EXIT_SYS_ERROR); 169 175 open(CONFIG, ">$disk_config") || &my_die("Couldn't open file? $disk_config",$chip_id,$PS_EXIT_SYS_ERROR); 176 open(GENERATE, ">$disk_generate") || &my_die("Couldn't open file? $disk_generate",$chip_id,$PS_EXIT_SYS_ERROR); 177 open(RETURN, ">$disk_return") || &my_die("Couldn't open file? $disk_return", $chip_id, $PS_EXIT_SYS_ERROR); 178 170 179 171 180 # … … 185 194 186 195 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 187 run(command => $command, verbose => $verbose);196 run(command => $command, verbose => 0); 188 197 unless ($success) { 189 198 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 254 263 255 264 my $chipData = $mdcParser->parse(join "", @$stdout_buf) or 256 &my_die("Unable to parse chiptool -pendingimfile information.", 257 $chip_id,$error_code); 265 next; 266 # &my_die("Unable to parse chiptool -pendingimfile information.", 267 # $chip_id,$error_code); 258 268 my $chipData2= parse_md_list($chipData); 259 269 … … 270 280 271 281 # Process the image and burntool table 272 my ( undef,$remote_uri) = uri_to_outputs($uri);282 my ($ipp_uri,$remote_uri) = uri_to_outputs_raw($uri); 273 283 my $btt = $uri; 274 284 $btt =~ s/fits$/burn.tbl/; 275 my ( undef,$remote_btt) = uri_to_outputs($btt);285 my ($ipp_btt,$remote_btt) = uri_to_outputs_raw($btt); 276 286 277 287 # Initialize the ppI command … … 287 297 my $det_code = $det_types{$det}; 288 298 my $duri = $detrends_to_use{$det}->{$class_id}; 289 my ( undef, $remote_det_uri) = uri_to_outputs($duri);299 my ($ipp_det_uri, $remote_det_uri) = uri_to_outputs_raw($duri); 290 300 $ppImage_command .= " $det_code $remote_det_uri "; 291 301 } … … 310 320 $ppImage_command .= " -log ${remote_outroot}.${class_id}.log "; 311 321 312 push @main_commands, $ppImage_command;322 # push @main_commands, $ppImage_command; 313 323 314 324 # Calculate pre and post commands 315 325 my $remote_outroot_dir = dirname($remote_outroot); 316 push @pre_commands,"mkdir -p $remote_outroot_dir";326 my $pre_command = "mkdir -p $remote_outroot_dir"; 317 327 318 328 my $post_commandA = "chiptool -addprocessedimfile -exp_id $exp_id -chip_id $chip_id -class_id $class_id "; … … 321 331 $post_commandA .= " -dbname $dbname " if defined $dbname; 322 332 323 my $post_commandB = "echo -n $post_commandA > ${remote_outroot}.${class_id}.dbinfo &&";333 my $post_commandB = "echo -n \"$post_commandA\" > ${remote_outroot}.${class_id}.dbinfo "; 324 334 my $post_commandC = "ppStatsFromMetadata ${remote_outroot}.${class_id}.stats - CHIP_IMFILE >> ${remote_outroot}.${class_id}.dbinfo"; 325 335 326 push @post_commands, "$post_commandB $post_commandC";336 # push @post_commands, "$post_commandB $post_commandC"; 327 337 328 338 $job_index++; 339 340 print CONFIG "${pre_command} && ${ppImage_command} && ${post_commandB} && ${post_commandC}"; 341 342 343 # Determine which output files need to be returned. 344 foreach my $component (@return_component_list) { 345 # uri_convert_and_create( $ipprc->filename($component, $ipp_outroot, $class_id) ); 346 my $filename = $ipprc->filename($component, $ipp_outroot, $class_id); 347 my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename ); 348 my $remote_outroot_dir = dirname($ipp_disk); 349 print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} "; 350 # print " $filename $ipp_disk $remote_disk\n"; 351 # die; 352 } 353 354 print CONFIG "\n"; 329 355 } 330 356 } 331 357 332 358 # 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 }359 # my %unique_cmds = (); 360 # foreach my $cmd (@pre_commands) { 361 # unless(exists($unique_cmds{$cmd})) { 362 # print CONFIG $cmd . "\n"; 363 # $unique_cmds{$cmd} = 1; 364 # } 365 # } 366 # foreach my $cmd (@main_commands) { 367 # unless(exists($unique_cmds{$cmd})) { 368 # print CONFIG $cmd . "\n"; 369 # $unique_cmds{$cmd} = 1; 370 # } 371 # } 372 # foreach my $cmd (@post_commands) { 373 # unless(exists($unique_cmds{$cmd})) { 374 # print CONFIG $cmd . "\n"; 375 # $unique_cmds{$cmd} = 1; 376 # } 377 # } 352 378 353 379 close(CONFIG); 354 380 close(TRANSFER); 355 381 close(CHECK); 382 close(RETURN); 383 close(GENERATE); 356 384 357 385 # … … 425 453 } 426 454 455 sub uri_convert_and_create { 456 my $neb_uri = shift; 457 my $ipp_disk= $ipprc->file_resolve( $neb_uri , 1); 458 my $remote_disk = $ipp_disk; 459 460 unless(defined($ipp_disk)) { 461 my_die(); 462 } 463 464 $remote_disk =~ s%^.*/%%; # Remove nebulous path 465 $remote_disk =~ s%^\d+\.%%; # Remove ins_id 466 $remote_disk =~ s%:%/%g; # Replace colons with directories 467 $remote_disk = "${remote_root}/${remote_disk}"; 468 return($ipp_disk,$remote_disk); 469 } 470 427 471 sub uri_to_outputs { 428 472 my $neb_uri = shift; … … 433 477 print TRANSFER "$ipp_disk\n"; 434 478 print CHECK "$remote_disk\n"; 479 } 480 return($ipp_disk,$remote_disk); 481 } 482 483 sub uri_to_outputs_raw { 484 my $neb_uri = shift; 485 my ($ipp_disk, $remote_disk) = uri_convert( $neb_uri ); 486 $remote_disk = $remote_raw . $ipp_disk; 487 unless (exists($file_filter{$neb_uri})) { 488 $file_filter{$neb_uri} = 1; 489 print TRANSFER "$ipp_disk\n"; 490 print CHECK "$remote_disk\n"; 491 } 492 return($ipp_disk,$remote_disk); 493 } 494 495 sub uri_to_outputs_for_return { 496 my $neb_uri = shift; 497 my ($ipp_disk, $remote_disk) = uri_convert_and_create( $neb_uri ); 498 unless (exists($file_filter{$neb_uri})) { 499 $file_filter{$neb_uri} = 1; 500 print RETURN "$ipp_disk\n"; 501 print GENERATE "$remote_disk\n"; 435 502 } 436 503 return($ipp_disk,$remote_disk);
Note:
See TracChangeset
for help on using the changeset viewer.
