Changeset 12021 for trunk/ippScripts/scripts/stack_skycell.pl
- Timestamp:
- Feb 23, 2007, 3:12:46 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/stack_skycell.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/stack_skycell.pl
r12013 r12021 33 33 use Pod::Usage qw( pod2usage ); 34 34 35 my ($ p6_id, $camera, $dbname, $workdir, $no_update, $no_op);35 my ($stack_id, $camera, $dbname, $workdir, $no_update, $no_op); 36 36 GetOptions( 37 ' p6_id|d=s' => \$p6_id, # Phase 6identifier37 'stack_id|d=s' => \$stack_id, # Stack identifier 38 38 'camera|c=s' => \$camera, # Camera name 39 39 'dbname|d=s' => \$dbname, # Database name … … 45 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 46 pod2usage( 47 -msg => "Required options: -- p6_id --camera",47 -msg => "Required options: --stack_id --camera", 48 48 -exitval => 3, 49 ) unless defined $ p6_id49 ) unless defined $stack_id 50 50 and defined $camera; 51 51 … … 54 54 # Look for programs we need 55 55 my $missing_tools; 56 my $stacktool = can_run(' p6tool') or (warn "Can't find p6tool" and $missing_tools = 1);56 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 57 57 my $ppStac = can_run('ppStac') or (warn "Can't find ppStac" and $missing_tools = 1); 58 58 if ($missing_tools) { … … 65 65 my $files; 66 66 { 67 my $command = "$stacktool -inputscfile - p6_id $p6_id";67 my $command = "$stacktool -inputscfile -stack_id $stack_id"; 68 68 $command .= " -dbname $dbname" if defined $dbname; 69 69 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 71 71 unless ($success) { 72 72 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 73 &my_die("Unable to perform stacktool -inputscfile: $error_code", $ p6_id, $error_code);73 &my_die("Unable to perform stacktool -inputscfile: $error_code", $stack_id, $error_code); 74 74 } 75 75 76 76 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 77 &my_die("Unable to parse metadata config doc", $ p6_id, $PS_EXIT_PROG_ERROR);77 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 78 78 $files = parse_md_list($metadata) or 79 &my_die("Unable to parse metadata list", $ p6_id, $PS_EXIT_PROG_ERROR);80 } 81 82 &my_die("Subtraction list contains more than two elements", $ p6_id, $PS_EXIT_SYS_ERROR) unless79 &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR); 80 } 81 82 &my_die("Subtraction list contains more than two elements", $stack_id, $PS_EXIT_SYS_ERROR) unless 83 83 scalar @$files >= 2; 84 84 … … 90 90 $inputList .= "$uri "; 91 91 if (defined $skycell_id) { 92 &my_die("Skycell identifiers don't match", $ p6_id, $PS_EXIT_SYS_ERROR) unless92 &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless 93 93 $file->{skycell_id} eq $skycell_id; 94 94 } else { … … 106 106 107 107 # Get the output filenames 108 my $outputFile = "$skycell_id.sub.$ p6_id"; # Root name108 my $outputFile = "$skycell_id.sub.$stack_id"; # Root name 109 109 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 110 110 … … 123 123 unless ($success) { 124 124 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 125 &my_die("Unable to perform ppImage: $error_code", $ p6_id, $error_code);126 } 127 &my_die("Couldn't find expected output file: $outputName", $ p6_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;128 # &my_die("Couldn't find expected output file: $bin1Name", $ p6_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;129 # &my_die("Couldn't find expected output file: $bin2Name", $ p6_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;130 # &my_die("Couldn't find expected output file: $outputStats", $ p6_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;125 &my_die("Unable to perform ppImage: $error_code", $stack_id, $error_code); 126 } 127 &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $outputName; 128 # &my_die("Couldn't find expected output file: $bin1Name", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name; 129 # &my_die("Couldn't find expected output file: $bin2Name", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name; 130 # &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 131 131 132 132 # Get the statistics on the residual image 133 133 if (0) { ### Disabled because ppStac doesn't output stats yet 134 134 my $statsFile; # File handle 135 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $ p6_id, $PS_EXIT_SYS_ERROR);135 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 136 136 my @contents = <$statsFile>; # Contents of file 137 137 close $statsFile; 138 138 my $metadata = $mdcParser->parse(join "", @contents) or 139 &my_die("Unable to parse metadata config doc", $ p6_id, $PS_EXIT_PROG_ERROR);140 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $ p6_id, $PS_EXIT_PROG_ERROR);139 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 140 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 141 141 } 142 142 } … … 152 152 # Add the subtraction result 153 153 { 154 my $command = "$stacktool -addsumscfile - p6_id $p6_id -uri $outputName -b1_uri $outputRoot";154 my $command = "$stacktool -addsumscfile -stack_id $stack_id -uri $outputName -b1_uri $outputRoot"; 155 155 $command .= " -bg $bg -bg_stdev $bg_stdev"; 156 156 $command .= " -dbname $dbname" if defined $dbname; … … 160 160 unless ($success) { 161 161 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 162 &my_die("Unable to perform stacktool -adddiffscfile: $error_code", $ p6_id, $error_code);162 &my_die("Unable to perform stacktool -adddiffscfile: $error_code", $stack_id, $error_code); 163 163 } 164 164 … … 168 168 # Register the run as completed 169 169 { 170 my $command = "$stacktool -updaterun - p6_id $p6_id -state stop"; # Command to run p6tool170 my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool 171 171 $command .= " -dbname $dbname" if defined $dbname; 172 172 … … 185 185 { 186 186 my $msg = shift; # Warning message on die 187 my $ p6_id = shift; # Phase 5identifier187 my $stack_id = shift; # Stack identifier 188 188 my $exit_code = shift; # Exit code to add 189 189 190 190 warn($msg); 191 if ($ p6_id and not $no_update) {192 my $command = "$stacktool -updaterun - p6_id $p6_id -state stop -code $exit_code";191 if ($stack_id and not $no_update) { 192 my $command = "$stacktool -updaterun -stack_id $stack_id -state stop -code $exit_code"; 193 193 $command .= " -dbname $dbname" if defined $dbname; 194 194 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
