Changeset 19680
- Timestamp:
- Sep 23, 2008, 10:01:25 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/stack_skycell.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/stack_skycell.pl
r19674 r19680 55 55 56 56 my $logDest = "$outroot.log"; 57 58 my $do_stats; 59 if ($run_state eq 'new') { 60 $do_stats = 1; 61 } else { 62 $logDest .= ".update"; 63 } 57 64 $ipprc->redirect_output($logDest) if $redirect; 58 65 … … 192 199 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 193 200 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 201 $traceDest .= ".update" if $run_state eq 'update'; 194 202 my $configuration = $ipprc->filename("PPSTACK.CONFIG", $outroot); 203 204 # for update we need to resolve the config filename here because the code that reads it 205 # doesn't know how to resolve paths. (The information is stored in the configuration file) 206 $configuration = $ipprc->file_resolve($configuration) if ($run_state eq 'update'); 195 207 196 208 # Perform stacking 197 209 unless ($no_op) { 198 210 my $command = "$ppStack $listName $outroot"; 199 $command .= " -stats $outputStats" ;211 $command .= " -stats $outputStats" if $do_stats;; 200 212 $command .= " -recipe PPSUB STACK"; 201 $command .= " -recipe PPSTATS WARPSTATS" ;213 $command .= " -recipe PPSTATS WARPSTATS" if $do_stats;; 202 214 $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE"; 203 215 $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF"; … … 207 219 $command .= " -debug-stack" if defined $debug; 208 220 $command .= " -tracedest $traceDest -log $logDest"; 209 $command .= " -dumpconfig $configuration";210 221 $command .= " -dbname $dbname" if defined $dbname; 222 if ($run_state eq 'new') { 223 $command .= " -dumpconfig $configuration"; 224 } else { 225 $command .= " -ipprc $configuration"; 226 } 227 211 228 212 229 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 222 239 # &my_die("Couldn't find expected output file: $bin1Name", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name); 223 240 # &my_die("Couldn't find expected output file: $bin2Name", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name); 224 &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats); 225 226 # Get the statistics on the stacked image 227 my $statsFile; # File handle 228 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 229 my @contents = <$statsFile>; # Contents of file 230 close $statsFile; 231 my $metadata = $mdcParser->parse(join "", @contents) or 232 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 233 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 241 &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats) or !$do_stats; 242 243 if ($do_stats) { 244 # Get the statistics on the stacked image 245 my $statsFile; # File handle 246 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 247 my @contents = <$statsFile>; # Contents of file 248 close $statsFile; 249 my $metadata = $mdcParser->parse(join "", @contents) or 250 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 251 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 252 } 234 253 } 235 254 … … 238 257 # Add the stack result 239 258 { 240 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot"; 241 $command .= $stats->cmdflags(); 242 $command .= " -hostname $host" if defined $host; 259 my $command = "$stacktool"; 260 my $mode; 261 if ($run_state eq 'new') { 262 $mode = "-addsumskyfile"; 263 $command .= " -uri $outputName -path_base $outroot"; 264 $command .= " -hostname $host" if defined $host; 265 } else { 266 $mode = "-updaterun -state full"; 267 } 268 $command .= " $mode -stack_id $stack_id"; 269 $command .= $stats->cmdflags() if $do_stats; 243 270 $command .= " -dbname $dbname" if defined $dbname; 244 271 … … 247 274 unless ($success) { 248 275 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 249 &my_die("Unable to perform stacktool -addsumskyfile:$error_code", $stack_id, $error_code);276 &my_die("Unable to perform stacktool $mode $error_code", $stack_id, $error_code); 250 277 } 251 278 } 252 279 253 # Register the run as completed254 # XXX why is this needed? the stackRun is set to 'full' by the stacktool -addsumskyfile command...255 if (0) {256 my $command = "$stacktool -updaterun -stack_id $stack_id -state full"; # Command to run stacktool257 $command .= " -dbname $dbname" if defined $dbname;258 259 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =260 run(command => $command, verbose => $verbose);261 unless ($success) {262 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);263 warn("Unable to perform stacktool -updaterun: $error_code\n");264 exit($error_code);265 }266 }267 280 } 268 281 … … 276 289 carp($msg); 277 290 if (defined $stack_id and not $no_update) { 278 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code"; 279 $command .= " -hostname $host" if defined $host; 291 my $command = "$stacktool -stack_id $stack_id -code $exit_code"; 292 if ($run_state eq 'new') { 293 $command .= " -addsumskyfile"; 294 $command .= " -hostname $host" if defined $host; 295 } else { 296 $command .= " -updatesumskyfile"; 297 } 280 298 $command .= " -dbname $dbname" if defined $dbname; 281 299 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
