IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23295


Ignore:
Timestamp:
Mar 12, 2009, 11:38:13 AM (17 years ago)
Author:
Paul Price
Message:

Set error code to PROG_ERROR if not already set --- avoids infinite pantasks loops.

Location:
trunk/ippScripts/scripts
Files:
26 edited

Legend:

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

    r23186 r23295  
    367367    my $exit_code = shift; # Exit code to add
    368368
     369    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     370
    369371    carp($msg);
    370372    if (defined $cam_id and not $no_update) {
  • trunk/ippScripts/scripts/chip_imfile.pl

    r23186 r23295  
    248248    # run_state, outputImage, and outroot are globals
    249249
     250    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     251
    250252    carp($msg);
    251253    if (defined $chip_id and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_correct_imfile.pl

    r23186 r23295  
    124124    my $exit_code = shift; # Exit code to add
    125125
     126    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     127
    126128    carp($msg);
    127129    if (defined $det_id and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_norm_apply.pl

    r23229 r23295  
    196196    my $exit_code = shift;      # Exit code to add
    197197
     198    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     199
    198200    carp($msg);
    199201    if (defined $det_id and defined $iter and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_norm_calc.pl

    r23229 r23295  
    230230    my $exit_code = shift;      # Exit code to add
    231231
     232    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     233
    232234    carp($msg);
    233235    if (defined $det_id and defined $iter and not $no_update) {
  • trunk/ippScripts/scripts/detrend_norm_exp.pl

    r23186 r23295  
    183183    my $exit_code = shift; # Exit code to add
    184184
     185    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     186
    185187    carp($msg);
    186188    if (defined $det_id and defined $iter and not $no_update) {
  • trunk/ippScripts/scripts/detrend_process_exp.pl

    r23186 r23295  
    198198    my $exit_code = shift; # Exit code to add
    199199
     200    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     201
    200202    carp($msg);
    201203    if (defined $det_id and defined $exp_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_process_imfile.pl

    r23186 r23295  
    185185    my $exit_code = shift; # Exit code to add
    186186
     187    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     188
    187189    carp($msg);
    188190    if (defined $det_id and defined $exp_id and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_reject_exp.pl

    r23186 r23295  
    336336    my $exit_code = shift; # Exit code to add
    337337
     338    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     339
    338340    carp($msg);
    339341    if (defined $det_id and defined $iter and not $no_update) {
  • trunk/ippScripts/scripts/detrend_resid_exp.pl

    r23229 r23295  
    107107    }
    108108    if (@$stdout_buf == 0) {
    109         &my_die("No normalizations were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);
     109        &my_die("No normalizations were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);
    110110    }
    111111
     
    126126    print "saving norms to $normsName\n";
    127127    foreach my $norm (@$normsMD) {
    128         my $class_id = $norm->{class_id};
    129         my $normalization = $norm->{norm};
    130 
    131         $norms{$class_id} = $normalization;
    132         printf $normsFile "$class_id F32 $normalization\n", 
     128        my $class_id = $norm->{class_id};
     129        my $normalization = $norm->{norm};
     130
     131        $norms{$class_id} = $normalization;
     132        printf $normsFile "$class_id F32 $normalization\n",
    133133    }
    134134    close $normsFile;
     
    153153    }
    154154    if (@$stdout_buf == 0) {
    155         &my_die("No imfiles were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);
     155        &my_die("No imfiles were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);
    156156    }
    157157
     
    168168    # also, write out the modified metadata set
    169169    foreach my $mdItem (@$metadata) {
    170         if ($mdItem->{class} ne "metadata") {
    171             carp "MD element ", $mdItem->{name}, " isn't of type METADATA --- ignored.\n";
    172             next;
    173         }
    174         my %hash;               # Hash element
    175         my $mdComponents = $mdItem->{value}; # Components of the metadata
    176 
    177         # determine the class_id for this block:
    178         my $class_id;
    179         foreach my $data (@$mdComponents) {
    180             unless ($data->{name} eq "class_id") { next; }
    181             $class_id = $data->{value};
    182             last;
    183         }
    184 
    185         # a new metadata block
    186         print $statFile "rawResidImfile  METADATA\n";
    187 
    188         # modify and save the data in this block:
    189         foreach my $data (@$mdComponents) {
    190             my $norm = $norms{$class_id};
    191 
    192             # fields to modify by the normalization:
    193             if ($data->{name} eq "bg")            { $data->{value} *= $norm; }
    194             if ($data->{name} eq "bg_stdev")      { $data->{value} *= $norm; }
    195             if ($data->{name} eq "bg_mean_stdev") { $data->{value} *= $norm; }
    196             if ($data->{name} eq "bg_skewness")   { $data->{value} *= $norm; }
    197             if ($data->{name} eq "bg_kurtosis")   { $data->{value} *= $norm; }
    198             if ($data->{name} eq "bin_stdev")     { $data->{value} *= $norm; }
    199 
    200             # write out the metadata, save on the array of hashes
    201             print $statFile "  $data->{name}  $data->{type}  $data->{value}\n";
    202             $hash{$data->{name}} = $data->{value};
    203         }
    204         print $statFile "END\n";
    205         push @files, \%hash;
     170        if ($mdItem->{class} ne "metadata") {
     171            carp "MD element ", $mdItem->{name}, " isn't of type METADATA --- ignored.\n";
     172            next;
     173        }
     174        my %hash;               # Hash element
     175        my $mdComponents = $mdItem->{value}; # Components of the metadata
     176
     177        # determine the class_id for this block:
     178        my $class_id;
     179        foreach my $data (@$mdComponents) {
     180            unless ($data->{name} eq "class_id") { next; }
     181            $class_id = $data->{value};
     182            last;
     183        }
     184
     185        # a new metadata block
     186        print $statFile "rawResidImfile  METADATA\n";
     187
     188        # modify and save the data in this block:
     189        foreach my $data (@$mdComponents) {
     190            my $norm = $norms{$class_id};
     191
     192            # fields to modify by the normalization:
     193            if ($data->{name} eq "bg")            { $data->{value} *= $norm; }
     194            if ($data->{name} eq "bg_stdev")      { $data->{value} *= $norm; }
     195            if ($data->{name} eq "bg_mean_stdev") { $data->{value} *= $norm; }
     196            if ($data->{name} eq "bg_skewness")   { $data->{value} *= $norm; }
     197            if ($data->{name} eq "bg_kurtosis")   { $data->{value} *= $norm; }
     198            if ($data->{name} eq "bin_stdev")     { $data->{value} *= $norm; }
     199
     200            # write out the metadata, save on the array of hashes
     201            print $statFile "  $data->{name}  $data->{type}  $data->{value}\n";
     202            $hash{$data->{name}} = $data->{value};
     203        }
     204        print $statFile "END\n";
     205        push @files, \%hash;
    206206    }
    207207    close $statFile;
     
    633633    my $exit_code = shift; # Exit code to add
    634634
     635    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     636
    635637    carp($msg);
    636638    if (defined $det_id and defined $iter and defined $exp_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_resid_imfile.pl

    r23186 r23295  
    251251    my $exit_code = shift; # Exit code to add
    252252
     253    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     254
    253255    carp($msg);
    254256    if (defined $det_id and defined $iter and defined $exp_id and not $no_update) {
  • trunk/ippScripts/scripts/detrend_stack.pl

    r23186 r23295  
    251251    my $exit_code = shift; # Exit code to add
    252252
     253    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     254
    253255    carp($msg);
    254256    if (defined $det_id and defined $iter and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/diff_skycell.pl

    r23186 r23295  
    276276    my $exit_code = shift;      # Exit code to add
    277277
     278    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     279
    278280    warn($msg);
    279281    if (defined $diff_id and defined $skycell_id and not $no_update) {
  • trunk/ippScripts/scripts/dist_advancerun.pl

    r23250 r23295  
    130130    my $exit_code = shift;      # Exit code to add
    131131
     132    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     133
    132134    my $command = "$disttool -updaterun";
    133135    $command   .= " -dist_id $dist_id";
  • trunk/ippScripts/scripts/dist_component.pl

    r23255 r23295  
    122122if (-e $tmpdir) {
    123123    if (-d $tmpdir) {
    124         my $rc = system "rm -r $tmpdir"; 
     124        my $rc = system "rm -r $tmpdir";
    125125        &my_die("cannot rm $tmpdir return code: $rc", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if $rc;
    126126    } else {
     
    272272        my $clean_mdc = join "", @data;
    273273
    274         my $mdlist = $mdcParser->parse($clean_mdc) or 
     274        my $mdlist = $mdcParser->parse($clean_mdc) or
    275275                &my_die("failed to parse clean.mdc", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR);
    276276
     
    293293            next if $rule eq "STAGE";
    294294            my $keep_on_clean = $product_list->{$rule};
    295             my $fn = $ipprc->filename($rule, $path_base, $component) or 
    296                 &my_die("Missing entry from camera config: $rule", $dist_id, $component, 
     295            my $fn = $ipprc->filename($rule, $path_base, $component) or
     296                &my_die("Missing entry from camera config: $rule", $dist_id, $component,
    297297                    $PS_EXIT_CONFIG_ERROR);
    298298    #        printf "%-16.16s\t%s\t%s\n",  $rule, $clean, $fn;
     
    323323    my $exit_code = shift;      # Exit code to add
    324324
     325    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     326
    325327    my $command = "$disttool -addprocessedcomponent";
    326328    $command   .= " -dist_id $dist_id";
  • trunk/ippScripts/scripts/fake_imfile.pl

    r23186 r23295  
    206206    my $exit_code = shift; # Exit code to add
    207207
     208    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     209
    208210    carp($msg);
    209211    if (defined $exp_id and defined $fake_id and defined $class_id and not $no_update) {
  • trunk/ippScripts/scripts/magic_destreak.pl

    r23186 r23295  
    267267    my $exit_code = shift;      # Exit code to add
    268268
     269    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     270
    269271    my $command = "$magicdstool -adddestreakedfile";
    270272    $command   .= " -magic_ds_id $magic_ds_id";
  • trunk/ippScripts/scripts/magic_mask.pl

    r23186 r23295  
    146146    my $exit_code = shift;      # Exit code to add
    147147
     148    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     149
    148150    carp($msg);
    149151    if (defined $magic_id and not $no_update) {
  • trunk/ippScripts/scripts/magic_process.pl

    r23186 r23295  
    332332    my $exit_code = shift;      # Exit code to add
    333333
     334    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     335
    334336    carp($msg);
    335337    if (defined $magic_id and defined $node and not $no_update) {
  • trunk/ippScripts/scripts/magic_tree.pl

    r23186 r23295  
    290290    my $exit_code = shift;      # Exit code to add
    291291
     292    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     293
    292294    carp($msg);
    293295    if (defined $magic_id and not $no_update) {
  • trunk/ippScripts/scripts/register_exp.pl

    r23186 r23295  
    187187    my $exit_code = shift;
    188188
     189    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     190
    189191    carp($msg);
    190192    if (defined $exp_id and not $no_update) {
  • trunk/ippScripts/scripts/register_imfile.pl

    r23294 r23295  
    9494    print "STDOUT:\n$out1";
    9595    print "STDERR:\n$err1";
    96     &my_die("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h1->result() ) unless $result1;
     96    &my_die("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h1->result() or $PS_EXIT_PROG_ERROR) ) unless $result1;
    9797
    9898    print "[Running " . join(' ', @command2) . "]\n";
     
    103103    print "STDOUT:\n$out2";
    104104    print "STDERR:\n$err2";
    105     &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h2->result() ) unless $result2;
     105    &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h2->result() or $PS_EXIT_PROG_ERROR) ) unless $result2;
    106106    chomp $out2;
    107107    $cmdflags = $out2;
     
    128128
    129129# determine solar-system parameters
    130 my $longitude = &value_for_flag ($cmdflags, "-longitude");
    131 my $latitude  = &value_for_flag ($cmdflags, "-latitude");
    132 my $elevation = &value_for_flag ($cmdflags, "-elevation");
    133 my $ra        = &value_for_flag ($cmdflags, "-ra");
    134 my $dec       = &value_for_flag ($cmdflags, "-decl");
    135 my $dateobs   = &value_for_flag ($cmdflags, "-dateobs");
     130my $longitude = &value_for_flag($cmdflags, "-longitude");
     131my $latitude  = &value_for_flag($cmdflags, "-latitude");
     132my $elevation = &value_for_flag($cmdflags, "-elevation");
     133my $ra        = &value_for_flag($cmdflags, "-ra");
     134my $dec       = &value_for_flag($cmdflags, "-decl");
     135my $dateobs   = &value_for_flag($cmdflags, "-dateobs");
    136136
    137137# if the needed data is available, pass it to sunmoon:
     
    212212
    213213    # for failed imfiles, we insert UNKNOWN for inst, telescope, class_id
     214
     215    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
    214216
    215217    carp($msg);
  • trunk/ippScripts/scripts/stack_skycell.pl

    r23186 r23295  
    296296    my $exit_code = shift;      # Exit code to add
    297297
     298    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     299
    298300    carp($msg);
    299301
  • trunk/ippScripts/scripts/summit_copy.pl

    r20310 r23295  
    136136    my $exit_code = shift; # Exit code to add
    137137
     138    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     139
    138140    warn $msg;
    139141    unless ($no_update) {
  • trunk/ippScripts/scripts/warp_overlap.pl

    r23186 r23295  
    186186    my $warp_id = shift;        # Warp identifier
    187187    my $exit_code = shift;      # Exit code to add
     188
     189    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
    188190
    189191    carp($msg);
  • trunk/ippScripts/scripts/warp_skycell.pl

    r23186 r23295  
    288288    my $exit_code = shift;      # Exit code to add
    289289
     290    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     291
    290292    warn($msg);
    291293    if (defined $warp_id and defined $skycell_id and defined $tess_dir and not $no_update) {
Note: See TracChangeset for help on using the changeset viewer.