IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 23, 2007, 3:12:46 PM (19 years ago)
Author:
Paul Price
Message:

More fixes following the name change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/stack_skycell.pl

    r12013 r12021  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($p6_id, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($stack_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3636GetOptions(
    37     'p6_id|d=s'         => \$p6_id, # Phase 6 identifier
     37    'stack_id|d=s'      => \$stack_id, # Stack identifier
    3838    'camera|c=s'        => \$camera, # Camera name
    3939    'dbname|d=s'        => \$dbname, # Database name
     
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4646pod2usage(
    47     -msg => "Required options: --p6_id --camera",
     47    -msg => "Required options: --stack_id --camera",
    4848    -exitval => 3,
    49 ) unless defined $p6_id
     49) unless defined $stack_id
    5050    and defined $camera;
    5151
     
    5454# Look for programs we need
    5555my $missing_tools;
    56 my $stacktool = can_run('p6tool') or (warn "Can't find p6tool" and $missing_tools = 1);
     56my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
    5757my $ppStac = can_run('ppStac') or (warn "Can't find ppStac" and $missing_tools = 1);
    5858if ($missing_tools) {
     
    6565my $files;
    6666{
    67     my $command = "$stacktool -inputscfile -p6_id $p6_id";
     67    my $command = "$stacktool -inputscfile -stack_id $stack_id";
    6868    $command .= " -dbname $dbname" if defined $dbname;
    6969    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    7171    unless ($success) {
    7272        $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);
    7474    }
    7575
    7676    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);
    7878    $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) unless
     79        &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
    8383    scalar @$files >= 2;
    8484
     
    9090    $inputList .= "$uri ";
    9191    if (defined $skycell_id) {
    92         &my_die("Skycell identifiers don't match", $p6_id, $PS_EXIT_SYS_ERROR) unless
     92        &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
    9393            $file->{skycell_id} eq $skycell_id;
    9494    } else {
     
    106106
    107107# Get the output filenames
    108 my $outputFile = "$skycell_id.sub.$p6_id"; # Root name
     108my $outputFile = "$skycell_id.sub.$stack_id"; # Root name
    109109my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
    110110
     
    123123    unless ($success) {
    124124        $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;
    131131
    132132    # Get the statistics on the residual image
    133133    if (0) { ### Disabled because ppStac doesn't output stats yet
    134134        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);
    136136        my @contents = <$statsFile>; # Contents of file
    137137        close $statsFile;
    138138        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);
    141141    }
    142142}
     
    152152    # Add the subtraction result
    153153    {
    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";
    155155        $command .= " -bg $bg -bg_stdev $bg_stdev";
    156156        $command .= " -dbname $dbname" if defined $dbname;
     
    160160        unless ($success) {
    161161            $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);
    163163        }
    164164       
     
    168168    # Register the run as completed
    169169    {
    170         my $command = "$stacktool -updaterun -p6_id $p6_id -state stop"; # Command to run p6tool
     170        my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
    171171        $command .= " -dbname $dbname" if defined $dbname;
    172172
     
    185185{
    186186    my $msg = shift;            # Warning message on die
    187     my $p6_id = shift;          # Phase 5 identifier
     187    my $stack_id = shift;       # Stack identifier
    188188    my $exit_code = shift;      # Exit code to add
    189189
    190190    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";
    193193        $command .= " -dbname $dbname" if defined $dbname;
    194194        system ($command);
Note: See TracChangeset for help on using the changeset viewer.