Changeset 42449 for trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt
- Timestamp:
- Apr 13, 2023, 9:30:40 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt
r42447 r42449 9 9 if (not($?RAWFIX_FIXCHIP_INIT)) 10 10 book init fixchip.book 11 book init fixhost.book 11 12 $RAWFIX_FIXCHIP_INIT = 1 12 13 end … … 27 28 28 29 task.exec 29 # command check.rawfix.sh state ckchip.done30 30 command check.rawfix.sh state fixchip.new 31 31 end … … 53 53 end 54 54 55 task nights.fixchip.run 55 # output: fixhost.book 56 task nights.fixchip.loadhosts 56 57 periods -poll $RPOLL 57 58 periods -exec $REXEC 58 periods -timeout 180059 host -required $HOST_FIXCHIP59 periods -timeout 60 60 host local 60 61 npending 1 62 # note: the tasks which return their results via stdout 63 # seem to fail if run remotely. 64 65 stdout $LOGDIR/fixchip.loadhosts.stdout.log 66 stderr $LOGDIR/fixchip.loadhosts.stderr.log 61 67 62 68 task.exec … … 76 82 book getword fixchip.book $pageName iter -var ITER 77 83 option $pageName 78 79 stdout $pageName/log.fixchip.v$ITER 80 stderr $pageName/log.fixchip.v$ITER 84 # save the page so we can use it below 85 86 # write an entry point in the log for this night 87 sprintf tmpline "%s/%s/log.fixchip.runhosts.v%d" $mypath $DATEOBS $ITER 88 date -var mydate 89 exec echo "# start runhosts $mydate" >> $tmpline 90 91 # the command returns these fields: dateobs stage fixhost chipID 92 # NOTE: stage == ITER 93 command $mypath/get_hosts_fixchip.sh $mypath $DATEOBS $ITER 94 end 95 96 task.exit 0 97 # convert the stdout 'queue' to entries in a book 98 # fields in the table will become words in the page 99 queueprint stdout 100 queuesize stdout -var Nhosts 101 queue2book -raw-columns -key dateobs:chipID -uniq -setword pantaskState INIT stdout fixhost.book 102 book setword fixchip.book $options:0 NHOST {$Nhosts - 1} 103 book setword fixchip.book $options:0 NDONE 0 104 book list 105 book listbook fixchip.book 106 # use the queuesize (Nhosts) to track how many jobs are done / to be done 107 end 108 109 # exit values other than 0: 110 task.exit default 111 showcommand failure 112 book setword fixchip.book $options:0 pantasksQuality FAIL 113 end 114 115 task.exit crash 116 showcommand crash 117 book setword fixchip.book $options:0 pantasksQuality CRASH 118 end 119 120 # operation times out? 121 task.exit timeout 122 showcommand timeout 123 book setword fixchip.book $options:0 pantasksQuality TIMEOUT 124 end 125 end 126 127 task nights.fixchip.run 128 periods -poll $RPOLL 129 periods -exec $REXEC 130 periods -timeout 1800 131 132 task.exec 133 # if we are unable to run the 'exec', use a long retry time 134 periods -exec $REXEC 135 136 book npages fixhost.book -var N 137 if ($N == 0) break 138 if ($NETWORK == 0) break 139 140 # look for new nights in fixhost.book (pantaskState == INIT) 141 book getpage fixhost.book 0 -var pageName -key pantaskState INIT 142 if ("$pageName" == "NULL") break 143 144 book setword fixhost.book $pageName pantaskState RUN 145 book getword fixhost.book $pageName dateobs -var DATEOBS 146 book getword fixhost.book $pageName iter -var ITER 147 book getword fixhost.book $pageName fixhost -var FIXHOST 148 book getword fixhost.book $pageName chipID -var CHIP_ID 149 option $pageName $DATEOBS 150 151 stdout $pageName/log.fixchip.run.v$ITER 152 stderr $pageName/log.fixchip.run.v$ITER 81 153 82 154 substr $DATEOBS 0 4 YEAR … … 85 157 sprintf FULLDATE "%s/%s/%s" $YEAR $MONTH $DAY 86 158 87 command $mypath/fix_chip_locations.pl --topdir $mypath --dateobs $FULLDATE --chiplist gpc1.chips.txt --stage $ITER 88 end 89 90 ## XX delete the page from the book if done? 91 task.exit 0 159 host -required $FIXHOST 160 ## check if this host needs to be launched 161 if (not($?host:$FIXHOST)) 162 echo "host not defined, creating : $FIXHOST" 163 $host:$FIXHOST = 0 164 end 165 if (not($host:$FIXHOST)) 166 control host add $FIXHOST 167 $host:$FIXHOST = 1 168 end 169 170 # if we are able to run the 'exec', use a short retry time to launch all outstanding jobs 171 periods -exec 0.05 172 command $mypath/fix_chip_locations.pl --topdir $mypath --dateobs $FULLDATE --chiplist gpc1.chips.txt --chipID $CHIP_ID --stage $ITER 173 end 174 175 task.exit 0 176 nights.fixchip.exit OK 177 end 178 179 # exit values other than 0: 180 task.exit default 181 nights.fixchip.exit FAIL 182 showcommand failure 183 end 184 185 task.exit crash 186 nights.fixchip.exit CRASH 187 showcommand crash 188 end 189 190 # operation times out? 191 task.exit timeout 192 nights.fixchip.exit TIMEOUT 193 showcommand timeout 194 end 195 end 196 197 # output: fixhost.book 198 task nights.fixchip.clean 199 200 periods -poll $RPOLL 201 periods -exec $REXEC 202 periods -timeout 60 203 npending 1 204 205 stdout $LOGDIR/fixchip.clean.stdout.log 206 stderr $LOGDIR/fixchip.clean.stderr.log 207 208 task.exec 209 # if we are unable to run the 'exec', use a long retry time 210 periods -exec $REXEC 211 212 book npages fixchip.book -var N 213 if ($N == 0) break 214 if ($NETWORK == 0) break 215 216 # look for completed nights in fixchip.book (pantaskState == STOP) 217 book getpage fixchip.book 0 -var pageName -key pantaskState STOP 218 if ("$pageName" == "NULL") break 219 220 # book listpage fixchip.book $pageName 221 222 # book setword fixchip.book $pageName pantaskState RUN 223 book getword fixchip.book $pageName dateobs -var DATEOBS 224 book getword fixchip.book $pageName pantasksQuality -var QUALITY 225 226 option $pageName 227 # save the page so we can use it below 228 229 if ("$QUALITY" == "OK") 230 command update.rawfix.sh $DATEOBS fixchip.done 231 else 232 command update.rawfix.sh $DATEOBS fixchip.fail 233 end 234 end 235 236 task.exit 0 237 # now that the entry is set to done in the db, remove the pantasks book entry 238 echo "cleaning this page: $options:0" 92 239 book setword fixchip.book $options:0 pantaskState DONE 93 exec update.rawfix.sh $options:0 fixchip.done94 240 end 95 241 … … 98 244 showcommand failure 99 245 book setword fixchip.book $options:0 pantasksQuality FAIL 100 exec update.rawfix.sh $options:0 fixchip.fail101 246 end 102 247 … … 104 249 showcommand crash 105 250 book setword fixchip.book $options:0 pantasksQuality CRASH 106 exec update.rawfix.sh $options:0 fixchip.fail107 251 end 108 252 … … 111 255 showcommand timeout 112 256 book setword fixchip.book $options:0 pantasksQuality TIMEOUT 113 exec update.rawfix.sh $options:0 fixchip.fail 114 end 115 end 116 257 end 258 end 259 260 ######################### UTILITIES ################################# 261 262 macro nights.fixchip.exit 263 if ($0 != 2) 264 echo "USAGE: nights.fixchip.exit (quality)" 265 break 266 end 267 268 book setword fixhost.book $options:0 pantaskState DONE 269 book getword fixchip.book $options:1 NHOST -var Nhosts 270 book getword fixchip.book $options:1 NDONE -var Ndone 271 book getword fixchip.book $options:1 stage -var ITER 272 $Ndone ++ 273 book setword fixchip.book $options:1 NDONE $Ndone 274 if ("$1" != "OK") 275 book setword fixchip.book $options:1 pantasksQuality $1 276 sprintf tmpline "%s/%s/log.fixchip.runhosts.v%d" $mypath $options:1 $ITER 277 exec echo "failure $1 $options:0" >> $tmpline 278 else 279 exec echo "success $1 $options:0" >> $tmpline 280 end 281 if ($Ndone == $Nhosts) 282 book setword fixchip.book $options:1 pantaskState STOP 283 end 284 book delpage fixhost.book $options:0 285 end 286
Note:
See TracChangeset
for help on using the changeset viewer.
