- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/warp_skycell.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippScripts/scripts/warp_skycell.pl
r31941 r33415 38 38 39 39 my ($warp_id, $skycell_id, $warp_skyfile_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $run_state, $magicked, $verbose, $no_update, $no_op, $redirect, $save_temps); 40 my $zaplog = 0;41 40 42 41 GetOptions( … … 55 54 'no-update' => \$no_update, # Don't update the database? 56 55 'no-op' => \$no_op, # Don't do any operations? 57 'zaplog' => \$zaplog, # delete previous logfile58 56 'redirect-output' => \$redirect, 59 57 'save-temps' => \$save_temps, # Save temporary files? … … 77 75 my $do_stats; 78 76 if ($run_state eq 'new') { 79 $logDest = prepare_output("LOG.EXP", $outroot, $skycell_id, $zaplog);77 $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id); 80 78 $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1); 81 79 $do_stats = 1; 82 80 } elsif ($run_state eq 'update') { 83 $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 1);81 $logDest = $ipprc->filename("LOG.EXP.UPDATE", $outroot, $skycell_id); 84 82 $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, $skycell_id, 1); 85 83 } else { … … 93 91 } 94 92 95 $ipprc->redirect_ output($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect;93 $ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect; 96 94 97 95 # Recipes to use based on reduction class … … 333 331 } 334 332 } 335 333 print "Quality: $quality\n"; 336 334 unless ($no_update) { 337 335 # XXX change -tess_id to -tess_dir when db is updated … … 358 356 } 359 357 } else { 358 359 my $quality = 0; 360 361 unless ($ipprc->file_exists($outputPSF)) { 362 $quality = 8006; # bad data. 363 } 364 # if (!$quality) { 365 # check_output($outputImage, 0); 366 # check_output($outputMask, 0); 367 # check_output($outputWeight, 0); 368 # check_output($outputSources, 1); 369 # check_output($outputPSF, 1) if metadataLookupBool($recipe, 'PSF') ; 370 # } 371 print "Quality: $quality\n"; 372 360 373 # $run_state eq 'update' 361 374 unless ($no_update) { 362 my $command = "$warptool -tofullskyfile"; 363 $command .= " -warp_id $warp_id"; 364 $command .= " -skycell_id $skycell_id"; 365 $command .= " -set_magicked $magicked" if $magicked; 366 $command .= " -dbname $dbname" if defined $dbname; 367 368 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 369 run(command => $command, verbose => $verbose); 370 unless ($success) { 371 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 372 warn("Unable to perform warptool -addwarped: $error_code\n"); 373 exit($error_code); 375 my $try = 0; 376 while (1) { 377 $try++; 378 my $command = "$warptool -tofullskyfile"; 379 $command .= " -warp_id $warp_id"; 380 $command .= " -skycell_id $skycell_id"; 381 $command .= " -set_magicked $magicked" if $magicked; 382 $command .= " -set_quality $quality" if $quality; 383 $command .= " -dbname $dbname" if defined $dbname; 384 385 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 386 run(command => $command, verbose => $verbose); 387 unless ($success) { 388 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 389 warn("Unable to perform warptool -addwarped: $error_code\n"); 390 exit($error_code) if $try >= 2; 391 sleep 10; 392 warn("Trying again\n"); 393 } else { 394 last; 395 } 374 396 } 375 397 } … … 407 429 408 430 &my_die("Couldn't find expected output file: $file", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file); 431 432 # Funpack to confirm we've really made things correctly 433 my $diskfile = $ipprc->file_resolve($file); 434 if ($diskfile =~ /fits/) { 435 my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 436 my $check_command = "$funpack -S $diskfile > /dev/null"; 437 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 438 run(command => $check_command, verbose => $verbose); 439 if (!$success) { 440 &my_die("Output file not a valid fits file: $file", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 441 } 442 } 443 ##### 409 444 410 445 if ($replicate and $neb) {
Note:
See TracChangeset
for help on using the changeset viewer.
