IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42400


Ignore:
Timestamp:
Mar 8, 2023, 9:44:22 AM (3 years ago)
Author:
eugene
Message:

updates to rawfix

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

Legend:

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

    r42399 r42400  
    1616set DBPASS = "dvo"
    1717
    18 set DBOPTS = "-B --skip-column-names -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
     18# set DBOPTS = "-B --skip-column-names -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
     19set DBOPTS = "-B -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME"
     20
     21if ($mode == "all") then
     22  if ($#argv != 1) then
     23    echo "USAGE: check.rawfix.sh all"
     24    exit 2
     25  endif
     26
     27  mysql $DBOPTS -e "select dateobs, state from nights"
     28  exit 0
     29endif
     30
     31if ($mode == "stats") then
     32  if ($#argv != 1) then
     33    echo "USAGE: check.rawfix.sh stats"
     34    exit 2
     35  endif
     36
     37  mysql $DBOPTS -e "select count(dateobs) Nnights, state from nights group by state"
     38  exit 0
     39endif
    1940
    2041if ($mode == "night") then
     
    2950endif
    3051
    31 if ($mode == "new") then
    32   mysql $DBOPTS -e "select dateobs from nights where (state = 'new')"
     52if ($mode == "state") then
     53  if ($#argv != 2) then
     54    echo "USAGE: check.rawfix.sh state (state)"
     55    exit 2
     56  endif
     57
     58  set mystate = $2
     59
     60  if ($mystate == "new") goto good_state
     61  if ($mystate == "rsync") goto good_state
     62  if ($mystate == "md5sum.new") goto good_state
     63
     64  echo "ERROR: unknown mode $mystate"
     65  exit 2
     66
     67  good_state:
     68  mysql $DBOPTS -e "select dateobs from nights where (state = '$mystate')"
    3369  exit 0
    3470endif
  • trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl

    r42399 r42400  
    4040
    4141    # get the list of chip neb paths for one chip
    42     my @neb_paths = &get_chip_paths ($fulldate, $chip_id);
     42    my ($neb_paths_r, $ds_array_r, $md_array_r) = &get_chip_paths ($fulldate, $chip_id);
     43
     44    # I think this makes a copy of the arrays, which is inefficient
     45    # my @neb_paths = @$neb_paths_r;
     46    # my @ds_array  = @$ds_array_r;
     47    # my @md_array  = @$md_array_r;
    4348
    4449    # reset the hostcount for this chip
     
    4651
    4752    # find the neb instances for each chip nebulous entry
    48     foreach my $nebname (@neb_paths) {
     53
     54    for (my $i = 0; $i < @$neb_paths_r; $i++) {
     55        my $nebname = $neb_paths_r->[$i]; # equivalent to ${$neb_paths_r}[$i]
     56        my $data_st = $ds_array_r->[$i];
     57        my $md5_sum = $md_array_r->[$i];
     58
     59        # print STDERR "nebname: $nebname, dstate: $data_st, md5: $md5_sum\n";
    4960
    5061        # get info for all instances of this chip
     
    5465
    5566        # determine the status of the instances
    56         my ($Nmain, $Nback, $Ndead) = &check_instance_xattr ($inforows, $ext_id);
     67        my ($Nmain, $Nback, $Ndead) = &check_instance_xattr ($inforows, $ext_id, $data_st, $md5_sum);
    5768
    5869        &check_instance_state ($outfh, $ext_id, $Nmain, $Nback, $Ndead);
     
    130141    my $chip_id = $_[1];
    131142
    132     my @nebarray;
    133 
    134     my $sql_chip_paths = "SELECT uri from rawImfile WHERE class_id = '$chip_id' and dateobs > '$fulldate,00:00:00' and dateobs < '$fulldate,23:59:59'";
     143    my (@nebarray, @ds_array, @md_array);
     144
     145    my $sql_chip_paths = "SELECT uri, data_state, md5sum from rawImfile WHERE class_id = '$chip_id' and dateobs > '$fulldate,00:00:00' and dateobs < '$fulldate,23:59:59'";
    135146    if ($DEBUG > 5) { print "sql: $sql_chip_paths\n"; }
    136147
     
    145156        # there should only be a single value (only uri selected above)
    146157        my $Nvalues = @values;
    147         if ($Nvalues == 0) { print "ERROR: missing uri\n"; next; }
    148         if ($Nvalues  > 1) { print "ERROR: too many uri entries?\n"; next; }
     158        if ($Nvalues != 3) { print "ERROR: invalid response?\n"; next; }
    149159       
    150160        push (@nebarray, $values[0]);
    151         if ($DEBUG > 4) { print "$values[0]\n"; }
    152     }
    153    
    154     return @nebarray;
     161        push (@ds_array, $values[1]);
     162        push (@md_array, $values[2]);
     163        if ($DEBUG > 4) { print "$values[0]\n $values[1]\n $values[2]\n"; }
     164    }
     165
     166    # return references so we can keep the three arrays distinct
     167    return (\@nebarray, \@ds_array, \@md_array);
    155168}
    156169
     
    177190sub check_instance_xattr {
    178191
    179     my $ext_id = $_[1];
    180 
    181     my $rowref = $_[0];
     192    my $rowref  = $_[0];
     193    my $ext_id  = $_[1];
     194    my $data_st = $_[2];
     195    my $md5_sum = $_[3];
     196
    182197    my @inforows = @$rowref;
    183198    my $Nrows    = @inforows;
     
    218233        }
    219234        my $fh = $hostfile{$hostname};
    220         print $fh "$instance\n";
     235        print $fh "$instance $data_st $md5_sum\n";
    221236
    222237        if ($xattr == 0) { $Nmain ++; }
  • trunk/tools/eam/rawfix.20230221/src/get_md5s_instances.pl

    r42399 r42400  
    2121
    2222# read the list of instances:
    23 my @ins_list = &load_instance_list ($input);
     23my ($ins_list_r, $dst_list_r, $md5_list_r) = &load_instance_list ($input);
    2424
    2525my $output = $input;
     
    2929open (OUTFILE, ">$output");
    3030
    31 foreach my $instance (@ins_list) {
     31# foreach my $instance (@$ins_list_r) {
     32for (my $i = 0; $i < @$ins_list_r; $i ++) {
     33
     34    my $instance   = $ins_list_r->[$i];
     35    my $data_state = $dst_list_r->[$i];
     36    my $md5sum_tru = $md5_list_r->[$i];
    3237
    3338    my $filename = $instance;
    3439    $filename =~ s|file://||;
    35     # print "filename: $filename\n";
    3640
    37     my $line = `md5sum $filename`;
     41    my $line;
     42    if (0) {
     43        $line = "fakevalue $filename"; # XXX TEST: disable calculation:
     44    } else {
     45        $line = `md5sum $filename`;
     46    }
    3847
    3948    my ($md5sum, $rawfile) = split (" ", $line);
    40     # print "md5sum: $md5sum\n";
    41 
    42     print OUTFILE "$instance $md5sum\n";
     49    print OUTFILE "$instance $data_state $md5sum_tru $md5sum\n";
    4350}
    4451close OUTFILE;
    45 
    46 die "all done";
     52exit 0;
    4753
    4854# read the list of chip_ids:
     
    5056    my $infile = $_[0];
    5157
    52     my @ins_list;
     58    my (@ins_list, @dst_list, @md5_list);
    5359
    5460    open(FILE,$infile) or die "cannot open file $infile\n";
     
    6167        my @words = split (/\s+/,$line);
    6268
    63         if (@words != 1) { die "error in input $infile : $line\n"; }
     69        if (@words != 3) { die "error in input $infile : $line\n"; }
    6470        push (@ins_list, $words[0]);
     71        push (@dst_list, $words[1]);
     72        push (@md5_list, $words[2]);
    6573    }
    6674    close (FILE);
    6775
    68     return @ins_list;
     76    return (\@ins_list, \@dst_list, \@md5_list);
    6977}
    7078
  • trunk/tools/eam/rawfix.20230221/src/update.rawfix.sh

    r42399 r42400  
    22
    33if ($#argv < 1) then
    4   echo "USAGE: update.rawfix.sh (night) (state)"
     4  echo "USAGE: update.rawfix.sh (night) (state) [quality]"
    55  echo "   EG: update.rawfix.sh 20100501 new"
    66  exit 2
Note: See TracChangeset for help on using the changeset viewer.