IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30182


Ignore:
Timestamp:
Dec 26, 2010, 7:00:18 AM (15 years ago)
Author:
eugene
Message:

remove line that set burntoolStateCurrent to burntoolStateTarget (also rename burntoolState vars for clarity)

File:
1 edited

Legend:

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

    r30144 r30182  
    8484
    8585my $cmdflags;
    86 my $burntoolStateGood;
    87 my $burntoolState;
     86my $burntoolStateTarget;
     87my $burntoolStateCurrent;
    8888# Run ppStats on the input file
    8989{
     
    116116
    117117    # Manually parse the burntool_state entry.
    118     $burntoolState = 0;
     118    $burntoolStateCurrent = 0;
    119119    my $isGPC1 = 0;
    120     $burntoolStateGood = 0;
     120    $burntoolStateTarget = 0;
    121121    foreach my $line (split /\n/, $out1) {
    122122        if ($line =~ /FPA.BURNTOOL.APPLIED/) {
    123123            $line =~ s/^\s+//;
    124             $burntoolState = (split /\s+/, $line)[2];
     124            $burntoolStateCurrent = (split /\s+/, $line)[2];
    125125        }
    126126        if ($line =~ /FPA.CAMERA/) {
     
    132132    }
    133133    if ($isGPC1 != 1) {
    134         $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
    135     }
    136     elsif (($isGPC1 == 1) && ($burntoolState == 1)) {
    137 #       print STDERR "In the good region: >>$burntoolState<<\n";
     134        $burntoolStateCurrent = 0; # If it's not GPC1, you shouldn't have run burntool.
     135    }
     136    elsif (($isGPC1 == 1) && ($burntoolStateCurrent == 1)) {
     137#       print STDERR "In the good region: >>$burntoolStateCurrent<<\n";
    138138        my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
    139139        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    149149            if ($line =~ /BURNTOOL.STATE.GOOD/) {
    150150                $line =~ s/^\s+//;
    151                 $burntoolStateGood = (split /\s+/, $line)[2];
     151                $burntoolStateTarget = (split /\s+/, $line)[2];
    152152                last;
    153153            }
    154154        }
    155         $burntoolState = $burntoolStateGood; # Positive because this has the header table.
    156 
    157     }
    158     $cmdflags .= " -burntool_state $burntoolState ";
     155        # XXX why was this being equated??
     156        # $burntoolState = $burntoolStateGood; # Positive because this has the header table.
     157
     158    }
     159    $cmdflags .= " -burntool_state $burntoolStateTarget ";
    159160}
    160161
    161162$now_time = localtime();
    162163printf STDERR "\ndone with ppStats: %s\n", $now_time if $verbose;
     164printf STDERR "\nburntool state current: %d target: %d\n", $burntoolStateCurrent, $burntoolStateTarget;
    163165
    164166# we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type
     
    178180$command .= " -hostname $host" if defined $host;
    179181$command .= " -dbname $dbname" if defined $dbname;
    180 if (abs($burntoolState) == $burntoolStateGood) {
     182if (abs($burntoolStateCurrent) == $burntoolStateTarget) {
    181183    $command .= " -data_state full";
    182184}
     
    222224# lock file?
    223225# if exp_type = DARK and date > MIDNIGHT HST { wait }
    224 # system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log"); 
     226# system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log");
    225227
    226228$now_time = localtime();
     
    242244# We now have an imfile in the database, check if we can burntool it.  If not, continue on.
    243245
    244 if (abs($burntoolState) != $burntoolStateGood) {
     246if (abs($burntoolStateCurrent) != $burntoolStateTarget) {
    245247    my $mdcParser  = PS::IPP::Metadata::Config->new;
    246248
     
    249251    $check_date =~ s/T.*$//;
    250252    my $exp_name   = $tmp_exp_name;
    251    
     253
    252254
    253255    my $bt_check_command = "$regtool -checkburntoolimfile ";
    254256    $bt_check_command .= " -class_id $class_id ";
    255257    $bt_check_command .= " -date $check_date ";
    256     $bt_check_command .= " -valid_burntool $burntoolStateGood ";
     258    $bt_check_command .= " -valid_burntool $burntoolStateTarget ";
    257259    $bt_check_command .= " -exp_name $exp_name ";
    258260    $bt_check_command .= " -dbname $dbname" if defined $dbname;
    259261
    260262    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    261         run ( command => $bt_check_command, verbose => $verbose);
     263        run ( command => $bt_check_command, verbose => $verbose);
    262264    unless ($success) {
    263         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    264         &my_die_for_update("Unable to perform regtool: $error_code",
    265                            $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR);
     265        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     266        &my_die_for_update("Unable to perform regtool: $error_code",
     267                           $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR);
    266268    }
    267269
     
    270272    my $exposures;
    271273    while ( scalar @whole > 0 ) {
    272         my $value = shift @whole;
    273         push @single, $value;
    274         if ($value =~ /^\s*END\s*$/) {
    275             push @single, "\n";
    276            
    277             my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) );
    278             &my_die_for_update("Unable to parse output from regtool",
    279                                $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR) unless
    280                                    defined $list;
    281             push @{ $exposures }, @$list;
    282             @single = ();
    283         }
    284     }
    285    
     274        my $value = shift @whole;
     275        push @single, $value;
     276        if ($value =~ /^\s*END\s*$/) {
     277            push @single, "\n";
     278
     279            my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) );
     280            &my_die_for_update("Unable to parse output from regtool",
     281                               $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR) unless
     282                                   defined $list;
     283            push @{ $exposures }, @$list;
     284            @single = ();
     285        }
     286    }
     287
    286288    # We only care about the final entry, as that contains the exposure we are.
    287    
     289
    288290    my $regtool_update = "$regtool -updateprocessedimfile ";
    289291    $regtool_update .= "-dbname $dbname " if defined $dbname;
     
    292294    my $burntool_data = pop(@{ $exposures });
    293295    if ($burntool_data->{burnable} == 0) {
    294         $regtool_update .= " -burntool_state 0 -set_state pending_burntool ";
    295         unless ($no_update) {
    296             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    297                 IPC::Cmd::run(command => $regtool_update, verbose => $verbose);
    298             unless ($success) {
    299                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    300                 warn ("Unable to perform regtool -addprocessedimfile: $error_code");
    301                 exit($error_code);
    302             }
    303         } else {
    304             print "skipping command: $command\n";
    305         }
     296        $regtool_update .= " -burntool_state 0 -set_state pending_burntool ";
     297        unless ($no_update) {
     298            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     299                IPC::Cmd::run(command => $regtool_update, verbose => $verbose);
     300            unless ($success) {
     301                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     302                warn ("Unable to perform regtool -addprocessedimfile: $error_code");
     303                exit($error_code);
     304            }
     305        } else {
     306            print "skipping command: $command\n";
     307        }
    306308    }
    307309    else {
    308         my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname ";
    309         $apply_command .= " --class_id $class_id --exp_id $exp_id ";
    310         $apply_command .= " --this_uri $burntool_data->{uri} ";
    311         $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri};
    312         $apply_command .= " --imfile_state $burntool_data->{imfile_state} ";
    313         $apply_command .= " --verbose " if $verbose;
    314         print "$apply_command\n";
    315         unless ($no_update) {
    316             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    317                 IPC::Cmd::run(command => $apply_command, verbose => $verbose);
    318             unless ($success) {
    319                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    320                 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code");
    321                 exit($error_code);
    322             }
    323         }
    324     }   
     310        my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname ";
     311        $apply_command .= " --class_id $class_id --exp_id $exp_id ";
     312        $apply_command .= " --this_uri $burntool_data->{uri} ";
     313        $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri};
     314        $apply_command .= " --imfile_state $burntool_data->{imfile_state} ";
     315        $apply_command .= " --verbose " if $verbose;
     316        print "$apply_command\n";
     317        unless ($no_update) {
     318            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     319                IPC::Cmd::run(command => $apply_command, verbose => $verbose);
     320            unless ($success) {
     321                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     322                warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code");
     323                exit($error_code);
     324            }
     325        }
     326    }
    325327
    326328
Note: See TracChangeset for help on using the changeset viewer.