Changeset 42400
- Timestamp:
- Mar 8, 2023, 9:44:22 AM (3 years ago)
- Location:
- trunk/tools/eam/rawfix.20230221/src
- Files:
-
- 3 added
- 4 edited
-
check.rawfix.sh (modified) (2 diffs)
-
check_chip_locations.pl (modified) (7 diffs)
-
get_hosts_md5s.sh (added)
-
get_md5s_instances.pl (modified) (4 diffs)
-
rawfix.pt (added)
-
update.bnodes.sh (added)
-
update.rawfix.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/check.rawfix.sh
r42399 r42400 16 16 set DBPASS = "dvo" 17 17 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" 19 set DBOPTS = "-B -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME" 20 21 if ($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 29 endif 30 31 if ($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 39 endif 19 40 20 41 if ($mode == "night") then … … 29 50 endif 30 51 31 if ($mode == "new") then 32 mysql $DBOPTS -e "select dateobs from nights where (state = 'new')" 52 if ($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')" 33 69 exit 0 34 70 endif -
trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl
r42399 r42400 40 40 41 41 # 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; 43 48 44 49 # reset the hostcount for this chip … … 46 51 47 52 # 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"; 49 60 50 61 # get info for all instances of this chip … … 54 65 55 66 # 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); 57 68 58 69 &check_instance_state ($outfh, $ext_id, $Nmain, $Nback, $Ndead); … … 130 141 my $chip_id = $_[1]; 131 142 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'"; 135 146 if ($DEBUG > 5) { print "sql: $sql_chip_paths\n"; } 136 147 … … 145 156 # there should only be a single value (only uri selected above) 146 157 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; } 149 159 150 160 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); 155 168 } 156 169 … … 177 190 sub check_instance_xattr { 178 191 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 182 197 my @inforows = @$rowref; 183 198 my $Nrows = @inforows; … … 218 233 } 219 234 my $fh = $hostfile{$hostname}; 220 print $fh "$instance \n";235 print $fh "$instance $data_st $md5_sum\n"; 221 236 222 237 if ($xattr == 0) { $Nmain ++; } -
trunk/tools/eam/rawfix.20230221/src/get_md5s_instances.pl
r42399 r42400 21 21 22 22 # read the list of instances: 23 my @ins_list= &load_instance_list ($input);23 my ($ins_list_r, $dst_list_r, $md5_list_r) = &load_instance_list ($input); 24 24 25 25 my $output = $input; … … 29 29 open (OUTFILE, ">$output"); 30 30 31 foreach my $instance (@ins_list) { 31 # foreach my $instance (@$ins_list_r) { 32 for (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]; 32 37 33 38 my $filename = $instance; 34 39 $filename =~ s|file://||; 35 # print "filename: $filename\n";36 40 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 } 38 47 39 48 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"; 43 50 } 44 51 close OUTFILE; 45 46 die "all done"; 52 exit 0; 47 53 48 54 # read the list of chip_ids: … … 50 56 my $infile = $_[0]; 51 57 52 my @ins_list;58 my (@ins_list, @dst_list, @md5_list); 53 59 54 60 open(FILE,$infile) or die "cannot open file $infile\n"; … … 61 67 my @words = split (/\s+/,$line); 62 68 63 if (@words != 1) { die "error in input $infile : $line\n"; }69 if (@words != 3) { die "error in input $infile : $line\n"; } 64 70 push (@ins_list, $words[0]); 71 push (@dst_list, $words[1]); 72 push (@md5_list, $words[2]); 65 73 } 66 74 close (FILE); 67 75 68 return @ins_list;76 return (\@ins_list, \@dst_list, \@md5_list); 69 77 } 70 78 -
trunk/tools/eam/rawfix.20230221/src/update.rawfix.sh
r42399 r42400 2 2 3 3 if ($#argv < 1) then 4 echo "USAGE: update.rawfix.sh (night) (state) "4 echo "USAGE: update.rawfix.sh (night) (state) [quality]" 5 5 echo " EG: update.rawfix.sh 20100501 new" 6 6 exit 2
Note:
See TracChangeset
for help on using the changeset viewer.
