Changeset 42452
- Timestamp:
- Apr 21, 2023, 10:36:27 AM (3 years ago)
- Location:
- trunk/tools/eam/rawfix.20230221/src
- Files:
-
- 7 edited
-
advance.rawfix.pl (modified) (1 diff)
-
check_chip_locations.pl (modified) (1 diff)
-
check_md5s_dateobs.pl (modified) (5 diffs)
-
get_hosts_md5s.sh (modified) (1 diff)
-
rawfix.advance.pt (modified) (3 diffs)
-
rawfix.fixchip.pt (modified) (3 diffs)
-
rawfix.md5sum.pt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/advance.rawfix.pl
r42449 r42452 77 77 78 78 # select and advance nights not yet running 79 $sql_get_run = "SELECT dateobs from nights where state = 'new'"; 79 # $sql_get_run = "SELECT dateobs from nights where state = 'new'"; 80 81 $sql_get_run = "SELECT dateobs FROM (SELECT dateobs, rand() AS myrand FROM nights WHERE (state = 'new')) AS tmp ORDER BY myrand"; 82 80 83 $runref = $raw_dbh->selectall_arrayref( $sql_get_run ); 81 84 @runarray = @$runref; -
trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl
r42451 r42452 196 196 if ($Nvalues != 3) { print "ERROR: invalid response?\n"; next; } 197 197 198 # data_state and possibly md5sum can be NULL, need to handle specially 199 my $dstate = $values[1]; if (not defined $dstate) { $dstate = "NULL"; } 200 my $md5sum = $values[2]; if (not defined $md5sum) { $md5sum = "XXXX"; } 201 198 202 push (@nebarray, $values[0]); 199 push (@ds_array, $values[1]); 200 push (@md_array, $values[2]); 201 if ($DEBUG > 4) { print "$values[0]\n $values[1]\n $values[2]\n"; } 203 push (@md_array, $md5sum); 204 push (@ds_array, $dstate); 205 206 if ($DEBUG > 5) { print "V0: $values[0]\n"; print "V1: $values[1]\n"; print "V2: $values[2]\n"; } 207 if ($DEBUG > 4) { print "PRINT: $values[0]\n $dstate\n $md5sum\n"; } 202 208 } 203 209 -
trunk/tools/eam/rawfix.20230221/src/check_md5s_dateobs.pl
r42447 r42452 16 16 my ($dateword, $stage, $topdir) = &parse_cmdopts; 17 17 18 my @instlist = glob ("$topdir/$dateword/*.inst.$stage.txt");19 my @md5slist = glob ("$topdir/$dateword/*.md5s.txt");18 my $instlist_r = &load_instlist_filenames ($topdir, $dateword, $stage); 19 my $md5slist_r = &load_md5slist_filenames ($topdir, $dateword, $stage, $instlist_r); 20 20 21 21 my $Nfail = 0; … … 23 23 my %goodchips; 24 24 25 foreach my $instfile (@instlist) { 26 27 # find the matching md5sum file for this host 28 29 my ($host) = $instfile =~ m|$dateword/([0-9a-zA-Z]*).inst.$stage.txt|; 30 # print STDERR "host: $host\n"; 31 32 my $md5match = "NONE"; 33 foreach my $md5sfile (@md5slist) { 34 35 my ($md5shost) = $md5sfile =~ m|$dateword/([0-9a-zA-Z]*).md5s.txt|; 36 # print STDERR "md5host: $md5shost\n"; 37 38 if ($host ne $md5shost) { next; } 39 40 $md5match = $md5sfile; 41 last; 42 } 43 44 if ($md5match eq "NONE") { 45 print STDOUT "missing md5sum file for $instfile\n"; 46 $Nfail ++; 47 next; 48 } 25 # make a list of the master instance files: 26 27 foreach my $instfile (@$instlist_r) { 28 29 # print "inst: $instfile\n"; 30 31 my $md5sfile = $md5slist_r->{$instfile}; 49 32 50 33 ## read in the md5sums 51 open (FILE, $md5 match);34 open (FILE, $md5sfile); 52 35 my @md5data = <FILE>; 53 36 close (FILE); 54 37 55 ## read in the list of instances 56 open (FILE, $instfile); 57 my @instdata = <FILE>; 58 close (FILE); 38 my $instdata_r = &load_instance_list ($topdir, $dateword, $stage, $instfile); 59 39 60 40 # if these do not match, complain and move on … … 62 42 # may have been culled during this process (but the MD5s stay behind) 63 43 my $N1 = @md5data; 64 my $N2 = @ instdata;44 my $N2 = @$instdata_r; 65 45 if ($N1 < $N2) { 66 print STDOUT "not enough MD5s $md5 match: $N1 vs $N2\n";46 print STDOUT "not enough MD5s $md5sfile : $N1 vs $N2\n"; 67 47 $Nfail ++; 68 48 next; 49 } else { 50 # print STDOUT "checking MD5s $md5sfile : $N1 vs $N2\n"; 69 51 } 70 52 71 53 # set up an empty hash for the instance names: 72 54 my %instfound = (); 73 foreach my $line (@ instdata) {55 foreach my $line (@$instdata_r) { 74 56 chomp $line; 75 57 my @words = split (/\s+/,$line); … … 86 68 87 69 # we expect lines of the form: INST STATE MDtru MDobs 88 if (@words != 4) { die "error in MD5 list $md5 match, line: $line\n"; }70 if (@words != 4) { die "error in MD5 list $md5sfile, line: $line\n"; } 89 71 90 72 my $inst = $words[0]; … … 136 118 print STDOUT "SUCCESS: $Nfail errors\n"; 137 119 exit 0; 120 } 121 122 # use global $topdir, $dateword, $myhost, $stage 123 sub load_instance_list { 124 my $topdir = $_[0]; 125 my $dateword = $_[1]; 126 my $stage = $_[2]; 127 my $instfile = $_[3]; 128 129 my @instdata_list; 130 131 # load the master list 132 &load_instance_list_onefile ($instfile, \@instdata_list); 133 134 # there may be additional instances in files with names like HOSTNAME.XYnn.inst.STAGE 135 my ($myhost) = $instfile =~ m|$dateword/([0-9a-zA-Z]*).inst.$stage.txt|; 136 my @instlist = glob ("$topdir/$dateword/$myhost.XY??.inst.$stage.txt"); 137 foreach my $infile (@instlist) { 138 &load_instance_list_onefile ($infile, \@instdata_list); 139 } 140 return (\@instdata_list); 141 } 142 143 # read the instance info 144 sub load_instance_list_onefile { 145 my $infile = $_[0]; 146 my $instdata_list_r = $_[1]; # reference to the file data 147 148 open(FILE,$infile) or die "cannot open file $infile\n"; 149 my @lines = <FILE>; 150 close (FILE); 151 152 foreach my $line (@lines) { 153 chomp $line; 154 if ($line =~ /^\s*#/) { next; } # skip lines with leading # 155 push (@$instdata_list_r, $line); 156 } 157 } 158 159 # return only the master instlist filenames (ignore ones with the chipnames in the name) 160 sub load_instlist_filenames { 161 162 my $topdir = $_[0]; 163 my $dateword = $_[1]; 164 my $stage = $_[2]; 165 166 my @instlist_all = glob ("$topdir/$dateword/*.inst.$stage.txt"); 167 168 my @instlist = (); 169 170 foreach my $instfile (@instlist_all) { 171 172 # skip the per-chip inst files (these should probably be merged into the master) 173 if ($instfile =~ m|XY[0-9][0-9].inst|) { next; } 174 175 push (@instlist, $instfile); 176 } 177 return (\@instlist); 178 } 179 180 # return a hash of the matched md5 file for each inst file 181 sub load_md5slist_filenames { 182 183 my $topdir = $_[0]; 184 my $dateword = $_[1]; 185 my $stage = $_[2]; 186 my $instlist_r = $_[3]; 187 188 my @md5slist = glob ("$topdir/$dateword/*.md5s.txt"); 189 190 my %md5shash; 191 192 my $Nfail = 0; 193 194 foreach my $instfile (@$instlist_r) { 195 196 # find the matching md5sum file for this host 197 198 my ($host) = $instfile =~ m|$dateword/([0-9a-zA-Z]*).inst.$stage.txt|; 199 # print STDERR "host: $host\n"; 200 201 my $md5match = "NONE"; 202 foreach my $md5sfile (@md5slist) { 203 204 my ($md5shost) = $md5sfile =~ m|$dateword/([0-9a-zA-Z]*).md5s.txt|; 205 206 if ($host ne $md5shost) { next; } 207 208 # print STDERR "md5host: $md5shost : $md5sfile = $instfile\n"; 209 210 $md5match = $md5sfile; 211 last; 212 } 213 214 if ($md5match eq "NONE") { 215 print STDOUT "missing md5sum file for $instfile\n"; 216 $Nfail ++; 217 next; 218 } 219 $md5shash{$instfile} = $md5match; 220 221 # print "match: $instfile = $md5match\n"; 222 223 } 224 if ($Nfail > 0) { 225 print STDOUT "ERROR: $Nfail errors\n"; 226 exit 1; 227 } 228 return (\%md5shash); 138 229 } 139 230 -
trunk/tools/eam/rawfix.20230221/src/get_hosts_md5s.sh
r42445 r42452 21 21 22 22 # report both the dateobs and the hostnames 23 ls $topdir/$dateobs/*.inst.$stage.txt | awk -v dateobs=$dateobs -v stage=$stage -F/ '(NR == 1){print "dateobs stage md5host"}{print dateobs, stage, $NF}' | sed s/.inst.$stage.txt//23 ls $topdir/$dateobs/*.inst.$stage.txt | grep -v "XY...inst" | awk -v dateobs=$dateobs -v stage=$stage -F/ '(NR == 1){print "dateobs stage md5host"}{print dateobs, stage, $NF}' | sed s/.inst.$stage.txt// 24 24 exit 0 -
trunk/tools/eam/rawfix.20230221/src/rawfix.advance.pt
r42450 r42452 1 1 2 $MAX_ACTIVE_NIGHTS = 52 $MAX_ACTIVE_NIGHTS = 10 3 3 4 4 ## regularly run the command advance.rawfits.sh … … 8 8 periods -timeout 30 9 9 host local 10 active true 10 11 11 12 stdout $LOGDIR/advance.log … … 39 40 end 40 41 end 42 43 macro nights.advance.on 44 task nights.advance 45 active true 46 end 47 end 48 49 macro nights.advance.off 50 task nights.advance 51 active false 52 end 53 end 54 55 -
trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt
r42451 r42452 12 12 $RAWFIX_FIXCHIP_INIT = 1 13 13 end 14 15 $MAX_FIXHOST = 2 14 16 15 17 # select nights in state fixchip.new … … 97 99 # convert the stdout 'queue' to entries in a book 98 100 # fields in the table will become words in the page 99 queueprint stdout101 # queueprint stdout 100 102 queuesize stdout -var Nhosts 101 103 queue2book -raw-columns -key dateobs:chipID -uniq -setword pantaskState INIT stdout fixhost.book 102 104 book setword fixchip.book $options:0 NHOST {$Nhosts - 1} 103 105 book setword fixchip.book $options:0 NDONE 0 104 book list105 book listbook fixchip.book106 # book list 107 # book listbook fixchip.book 106 108 # use the queuesize (Nhosts) to track how many jobs are done / to be done 107 109 end … … 163 165 $host:$FIXHOST = 0 164 166 end 165 if ( not($host:$FIXHOST))167 if ($host:$FIXHOST < $MAX_FIXHOST) 166 168 control host add $FIXHOST 167 $host:$FIXHOST = 1169 $host:$FIXHOST ++ 168 170 end 169 171 -
trunk/tools/eam/rawfix.20230221/src/rawfix.md5sum.pt
r42451 r42452 12 12 $RAWFIX_MD5SUM_INIT = 1 13 13 end 14 15 $MAX_MD5HOST = 2 14 16 15 17 # select nights which are ready for md5sum calcs … … 97 99 # convert the stdout 'queue' to entries in a book 98 100 # fields in the table will become words in the page 99 queueprint stdout101 # queueprint stdout 100 102 queuesize stdout -var Nhosts 101 103 queue2book -raw-columns -key dateobs:md5host -uniq -setword pantaskState INIT stdout md5host.book 102 104 book setword md5sum.book $options:0 NHOST {$Nhosts - 1} 103 105 book setword md5sum.book $options:0 NDONE 0 104 book list105 book listbook md5sum.book106 # book list 107 # book listbook md5sum.book 106 108 # use the queuesize (Nhosts) to track how many jobs are done / to be done 107 109 end … … 166 168 $host:$USE_HOST = 0 167 169 end 168 if ( not($host:$USE_HOST))170 if ($host:$USE_HOST < $MAX_MD5HOST) 169 171 control host add $USE_HOST 170 $host:$USE_HOST = 1172 $host:$USE_HOST ++ 171 173 end 172 174
Note:
See TracChangeset
for help on using the changeset viewer.
