IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42848 for trunk/tools


Ignore:
Timestamp:
May 9, 2025, 2:04:40 PM (12 months ago)
Author:
eugene
Message:

rawfix / burntool updates

Location:
trunk/tools/eam/rawfix.20230221/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rawfix.20230221/src/check.rawfix.sh

    r42459 r42848  
    7575  if ($mystate == "burntool.new")    goto good_state
    7676  if ($mystate == "burntool.done")   goto good_state
     77  if ($mystate == "burntool.redo")   goto good_state
    7778  if ($mystate == "burntool.fail")   goto good_state
    7879
  • trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl

    r42648 r42848  
    44# for all exposures for a given time period.
    55# USAGE: ipp_apply_burntool.pl --dbname gpc1 --class_id XY00 --dateobs_begin YYYY/MM/DD --dateobs_end YYYY/MM/DD
     6# OPTION: --check-status : scan the exposures/chips and report if the desired burntool file exists
    67
    78use warnings;
     
    2223print "Starting script $0 on $host at $date\n\n";
    2324
    24 my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $dbname, $logfile, $verbose, $save_temps, $rerun, $psvidOutput);
     25my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $dbname, $logfile, $check_status, $verbose, $save_temps, $rerun, $psvidOutput);
    2526GetOptions(
    2627    'class_id=s'        => \$class_id, # chip identifier
     
    2829    'dateobs_end=s'     => \$dateobs_end, # exposure date/time range stop
    2930    'dbname|d=s'        => \$dbname, # Database name
    30     'psvidOutput|d=s'   => \$psvidOutput, # output base for psvideo data
     31    'psvidOutput=s'     => \$psvidOutput, # output base for psvideo data
    3132    'logfile=s'         => \$logfile,
    3233    'rerun'             => \$rerun,
     34    'check-status'      => \$check_status,
    3335    'verbose'           => \$verbose,   # Print to stdout
    3436    'save-temps'        => \$save_temps, # Save temporary files?
    35 
    3637    ) or pod2usage( 2 );
    3738
     
    7475my $burntoolStateGood = 15;
    7576if (0) {
     77    # XXX note: I am disabling this automatic check of the burntool value
     78    # and hard-wiring 15
    7679    # Determine the value of a "good" burntool run.
    7780    # XXX this program should always generate the latest version
     
    154157    my $state = $file->{burntool_state};
    155158
     159    my $exp_name = $file->{exp_name};
     160    if ($exp_name =~ /a$/) {
     161        print "STRK: skipping $exp_name, streak exposure\n";
     162        next;
     163    }
     164
    156165    my $rawImfile = $file->{uri};
    157166    my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0);
     
    161170    }
    162171
     172    if ($rawImfileReal =~ /fits.fz$/) {
     173        print "COMP: skipping $exp_name, lossy-compressed data\n";
     174        next;
     175    }
     176
    163177    my $outTable  = $file->{uri};
    164178   
    165179    my $data_state = $file->{data_state};
    166180    if ($data_state eq "lossy") {
    167         print "## skipping $rawImfile : data_state $data_state\n";
    168         next;
    169     }
    170 
    171     if($burntoolStateGood == 15) {
     181        print "SKIP: skipping $rawImfile : data_state $data_state\n";
     182        next;
     183    }
     184
     185    if ($burntoolStateGood == 15) {
    172186        $outTable =~ s/fits$/burn.v15.tbl/;         
    173187    } else {
    174         $outTable =~ s/fits$/burn.tbl/;             
    175     }
     188        # $outTable =~ s/fits$/burn.tbl/;           
     189        die "invalid burntoolStateGood $burntoolStateGood\n";
     190    }
     191
     192    if ($check_status) {
     193        my $outTableReal = $ipprc->file_resolve($outTable, 0);
     194        if (defined $outTableReal and ($state == $outState)) {
     195            print "GOOD: $outTableReal for $exp_id, $class_id, $state\n";
     196        } else {
     197            if (defined $outTableReal) {
     198                print "FAIL: $outTableReal for $exp_id, $class_id, $state\n";
     199            } else {
     200                print "MISS: $rawImfile for $exp_id, $class_id, $state\n";
     201            }
     202        }
     203        next;
     204    }
     205
    176206    my $outTableReal = $ipprc->file_resolve($outTable, 1);
    177207
     
    222252        $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN);
    223253        if ($status) {
    224             print "FAIL: funpack fails for $rawImfile\n";
    225             &my_die("failed on funpack",$exp_id,$class_id);
     254
     255            ## funpack can fail in two specific ways that might be recoverable:
     256            ## 1) the file is corrupt (bad MD5SUM)
     257            ## 2) the file is missing
     258
     259            ## in either case, IFF a file exists in the other location with the right MD5SUM, we can use it instead
     260
     261            my $nebInstances = $ipprc->find_instances($rawImfile) or my_die("error with find_instance");
     262            my $md5tru = $file->{md5sum};
     263            my $isBad = 1;
     264            my $goodInstance = "NONE";
     265
     266            foreach my $uri (@$nebInstances) {
     267                # strip the leading file://
     268                $uri =~ s|file://||;
     269               
     270                # get the md5sum
     271                if (-e $uri) {
     272                    my $fh;
     273                    open($fh,$uri);
     274                    my $md5sum = Digest::MD5->new->addfile($fh)->hexdigest;
     275                    close ($fh);
     276                    if ($md5sum eq $md5tru) {
     277                        print "uri: $uri $md5sum eq $md5tru\n";
     278                        $status = vsystem ("$funpack -S $uri > $tempPixels", $REALRUN);
     279                        if ($status) {
     280                            print "FALT: funpack failed for $rawImfile and $uri\n";
     281                            &my_die("failed on funpack",$exp_id,$class_id);
     282                        } else {
     283                            $isBad = 0;
     284                            $goodInstance = $uri;
     285                        }
     286                    } else {
     287                        print "MDBD: $uri $md5sum vs $md5tru\n";
     288                    }
     289                } else {
     290                    print "GONE: $uri NOTFOUND\n";
     291                }
     292            }
     293
     294            if ($isBad) {
     295                print "FAIL: funpack failed for $rawImfile, not recovered\n";
     296                &my_die("failed on funpack",$exp_id,$class_id);
     297            } else {
     298                print "FIXT: funpack failed for $rawImfile on $rawImfileReal but recovered $goodInstance\n";
     299            }
    226300        }
    227301
     
    261335
    262336        print "\n";
     337    } else {
     338        print "DONE: skipping $rawImfile : btState $state vs $burntoolStateGood : data_state $data_state\n";
    263339    }
    264340
     
    275351}
    276352
     353print STDERR "exit SUCCESS\n";
    277354exit 0;
    278355
  • trunk/tools/eam/rawfix.20230221/src/rawfix.burntool.pt

    r42720 r42848  
    8282    # save the page so we can use it below
    8383
     84    substr $DATEOBS 0 4 YEAR
     85
    8486    # write an entry point in the log for this night
    85     sprintf tmpline "%s/%s/log.burntool.runhosts.v%d" $mypath $DATEOBS $ITER
     87    sprintf tmpline "%s/%s/%s/log.burntool.runhosts.v%d" $mypath $YEAR $DATEOBS $ITER
    8688    date -var mydate
    87     exec echo "# start runhosts $mydate" >> $tmpline
     89    exec echo "\\# start runhosts $mydate" >> $tmpline
    8890
    8991    # get_hosts_fixchip.sh selects the most used machine at ITC
     
    180182    # if we are able to run the 'exec', use a short retry time to launch all outstanding jobs
    181183    periods -exec 0.05
    182     command ipp_apply_burntool_psvideo.pl --dateobs_begin $STARTDATE --dateobs_end $ENDDATE --class_id $CHIP_ID --dbname gpc1 --psvidOutput $psvidOutput
     184    command ipp_apply_burntool_psvideo.pl --rerun --dateobs_begin $STARTDATE --dateobs_end $ENDDATE --class_id $CHIP_ID --dbname gpc1 --psvidOutput $psvidOutput
     185    ## NOTE the rerun option is set here
    183186  end
    184187
     
    270273######################### UTILITIES #################################
    271274
     275macro burntool.loadhosts.state
     276  if ($0 != 2)
     277    echo "USAGE: burntool.loadhosts.state (state)"
     278    break
     279  end
     280
     281  task nights.burntool.loadhosts
     282    active $1
     283  end
     284end
     285
     286macro burntool.clean.state
     287  if ($0 != 2)
     288    echo "USAGE: burntool.clean.state (state)"
     289    break
     290  end
     291
     292  task nights.burntool.clean
     293    active $1
     294  end
     295end
     296
     297macro burntool.run.state
     298  if ($0 != 2)
     299    echo "USAGE: burntool.run.state (state)"
     300    break
     301  end
     302
     303  task nights.burntool.run
     304    active $1
     305  end
     306end
     307
    272308macro nights.burntool.exit
    273309  if ($0 != 2)
     
    279315  book getword burntool.book $options:1 NHOST -var Nhosts
    280316  book getword burntool.book $options:1 NDONE -var Ndone
    281   book getword burntool.book $options:1 stage -var ITER
     317  book getword burntool.book $options:1 iter -var ITER
    282318  $Ndone ++
    283319  book setword burntool.book $options:1 NDONE $Ndone
  • trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt

    r42464 r42848  
    9191    sprintf tmpline "%s/%s/%s/log.fixchip.runhosts.v%d" $mypath $YEAR $DATEOBS $ITER
    9292    date -var mydate
    93     exec echo "# start runhosts $mydate" >> $tmpline
     93    exec echo "\\# start runhosts $mydate" >> $tmpline
    9494
    9595    # the command returns these fields: dateobs stage fixhost chipID
Note: See TracChangeset for help on using the changeset viewer.