IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

updates to rawfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ++; }
Note: See TracChangeset for help on using the changeset viewer.