- Timestamp:
- Nov 8, 2011, 2:44:12 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/chip_imfile.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110906/ippScripts/scripts/chip_imfile.pl
r32355 r32630 34 34 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 35 35 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 36 my $nebrepair = can_run('neb-repair') or (warn "Can't find neb-repair" and $missing_tools = 1); 37 36 38 if ($missing_tools) { 37 39 warn("Can't find required tools."); … … 44 46 my ( $exp_id, $chip_id, $class_id, $chip_imfile_id, $uri, $camera, $outroot, $dbname, $run_state, $reduction, $threads, $verbose, 45 47 $no_update, $save_temps, $no_op, $redirect, $magicked, $deburned ); 46 47 my $zaplog = 0;48 48 49 49 GetOptions( … … 65 65 'no-op' => \$no_op, # Don't do any operations? 66 66 'redirect-output' => \$redirect, 67 'zaplog' => \$zaplog,68 67 'save-temps' => \$save_temps, # Save temporary files? 69 68 ) or pod2usage( 2 ); … … 92 91 } 93 92 94 my ($log Dest, $traceDest);93 my ($logRule, $traceDest); 95 94 if ($run_state eq 'new') { 96 $log Dest = prepare_output("LOG.IMFILE", $outroot, $class_id, $zaplog);95 $logRule = "LOG.IMFILE"; 97 96 $traceDest = prepare_output("TRACE.IMFILE", $outroot, $class_id, 1); 98 97 } else { 99 $log Dest = prepare_output("LOG.IMFILE.UPDATE", $outroot, $class_id, 1);98 $logRule = "LOG.IMFILE.UPDATE"; 100 99 $traceDest = prepare_output("TRACE.IMFILE.UPDATE", $outroot, $class_id, 1); 101 100 } 102 101 103 102 if ($redirect) { 104 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR ); 103 my $logDest = $ipprc->filename($logRule, $outroot, $class_id); 104 105 $ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR ); 106 105 107 print STDOUT "\n\n"; 106 108 print STDOUT "Starting script $0 on $host\n\n"; … … 330 332 # get the UNIX version of the (possible) neb: or path: filename 331 333 my $uriReal = $ipprc->file_resolve( $uri ); 334 # Catch errors here 335 if (!$uriReal) { 336 my $repair_cmd = "$nebrepair $uri"; 337 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 338 unless ($repair_success) { 339 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 340 } 341 $uriReal = $ipprc->file_resolve( $uri ); 342 } 343 332 344 &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal; 333 345 … … 336 348 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose); 337 349 unless ($success) { 350 # Catch errors here 351 my $repair_cmd = "$nebrepair $uri"; 352 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 353 unless ($repair_success) { 354 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 355 } 356 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose); 357 } 358 unless ($success) { 338 359 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 339 360 &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); … … 348 369 $burntoolTable_uri =~ s/fits$/burn.tbl/; 349 370 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 371 if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) { 372 my $repair_cmd = "$nebrepair $burntoolTable_uri"; 373 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 374 unless ($repair_success) { 375 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 376 } 377 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 378 } 350 379 unless ($ipprc->file_exists($burntoolTable_uri)) { 380 # Catch errors here 351 381 &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR); 352 382 } … … 451 481 $command .= " -image_id $chip_imfile_id" if defined $chip_imfile_id; 452 482 $command .= " -source_id $source_id" if defined $source_id; 453 $command .= " -tracedest $traceDest -log $logDest";483 $command .= " -tracedest $traceDest"; 454 484 $command .= " -dbname $dbname" if defined $dbname; 455 485 … … 727 757 &my_die("Couldn't find expected output file: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 728 758 } 759 # Funpack to confirm we've really made things correctly 760 my $diskfile = $ipprc->file_resolve($file); 761 if ($diskfile =~ /fits/) { 762 my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 763 my $check_command = "$funpack -S $diskfile > /dev/null"; 764 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 765 run(command => $check_command, verbose => $verbose); 766 if (!$success) { 767 &my_die("Output file not a valid fits file: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 768 } 769 } 770 ##### 729 771 730 772 if ($replicate and $neb) {
Note:
See TracChangeset
for help on using the changeset viewer.
