Changeset 16570 for trunk/ippTasks/automate.pro
- Timestamp:
- Feb 21, 2008, 2:13:38 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTasks/automate.pro (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/automate.pro
r16492 r16570 26 26 end 27 27 queueload tmp -x "cat $MODULES:0/$1" 28 ipptool2book tmp automate -key name -uniq -setword pantaskState INIT 28 ipptool2book tmp automate -key name -uniq -setword pantaskState INIT.BLOCK 29 29 queuedelete tmp 30 30 end 31 31 32 $automate_Ncheck = 0 33 34 task automate.check 32 $automate_Nblock = -1 33 task automate.block 35 34 host local 36 35 37 36 periods -poll 1 38 periods -exec 1037 periods -exec 5 39 38 periods -timeout 30 40 39 active true … … 42 41 43 42 task.exec 44 local N Npage pageName43 local Npage pageName 45 44 46 45 # how many pages are waiting to be started? 47 book npages automate -var N -key pantaskState INIT 48 if ($N == 0) break 49 50 # total number of pages in book 51 book npages automate -var Npage 52 53 $automate_Ncheck ++ 54 if ($automate_Ncheck >= $Npage) set automate_Ncheck = 0 55 56 # search the automate book for an entry which is unstarted (state INIT) 57 book getpage automate $automate_Ncheck -var pageName -key pantaskState INIT 58 if ("$pageName" == "NULL") break 46 book npages automate -var Npage -key pantaskState INIT.BLOCK 47 if ($Npage == 0) 48 echo "no entries in INIT.BLOCK state" 49 break 50 end 51 52 # cycle over the number of INIT.BLOCK pages: no point to loop over the others 53 $automate_Nblock ++ 54 if ($automate_Nblock >= $Npage) set automate_Nblock = 0 55 echo "automate.block $automate_Nblock" 56 57 # search the automate book for an entry which is unstarted (state INIT.BLOCK) 58 book getpage automate $automate_Nblock -var pageName -key pantaskState INIT.BLOCK 59 if ("$pageName" == "NULL") 60 echo "entry $automate_Nblock not in INIT.BLOCK state" 61 break 62 end 59 63 60 book getword automate $pageName check -var checkCommand 61 if (("$checkCommand" == "NULL") || ("$checkCommand" == "NONE")) 62 # if there is no check needed, we can immediate progress to READY 63 book setword automate $pageName pantaskState READY 64 break 65 end 66 67 book setword automate $pageName pantaskState CHECK 64 book getword automate $pageName block -var blockCommand 65 if (("$blockCommand" == "NULL") || ("$blockCommand" == "NONE")) 66 # if there is no block needed, we can immediate progress to the next stage (INIT.CHECK) 67 book setword automate $pageName pantaskState INIT.CHECK 68 echo "$pageName is ready : INIT.CHECK" 69 break 70 end 71 72 book setword automate $pageName pantaskState RUN.BLOCK 68 73 69 74 if ($VERBOSE >= 1) 70 echo "starting automate check for $pageName"71 echo "command $ checkCommand"75 echo "starting automate block for $pageName" 76 echo "command $blockCommand" 72 77 end 73 78 74 79 options $pageName 75 command $ checkCommand80 command $blockCommand 76 81 end 77 82 … … 80 85 81 86 $pageName = $options:0 87 88 echo "complete $pageName test, checking results" 82 89 83 90 # convert 'stdout' to book format … … 88 95 end 89 96 97 # if the block test returns any valid pages (valid results), the block is set, don't move to check 90 98 book npages detExp -var Npage 91 if ($Npage == 0) break 92 93 # we should have launched only a single detRun 94 book setword automate $pageName pantaskState READY 99 if ($Npage == 0) 100 echo "$pageName is not blocked, ready for CHECK" 101 book setword automate $pageName pantaskState INIT.CHECK 102 else 103 echo "$pageName is blocked, not ready for CHECK" 104 book setword automate $pageName pantaskState INIT.BLOCK 105 end 95 106 96 107 # drop the detExt book after we've grabbed the state 97 108 book delete detExp 98 109 end 99 end 100 101 $automate_Nlaunch = 0 102 103 task automate.launch 110 111 # all failures here (what state?) 112 task.exit default 113 showcommand failure 114 end 115 116 # operation times out? 117 task.exit timeout 118 showcommand timeout 119 end 120 end 121 122 $automate_Ncheck = -1 123 task automate.check 104 124 host local 105 125 106 126 periods -poll 1 107 periods -exec 10127 periods -exec 5 108 128 periods -timeout 30 109 129 active true … … 111 131 112 132 task.exec 113 local N Npage pageName133 local Npage pageName 114 134 115 135 # how many pages are waiting to be started? 116 book npages automate -var N -key pantaskState READY 117 if ($N == 0) break 118 119 # total number of pages in book 120 book npages automate -var Npage 121 136 book npages automate -var Npage -key pantaskState INIT.CHECK 137 if ($Npage == 0) 138 echo "no entries in INIT.CHECK state" 139 break 140 end 141 142 # cycle over the number of INIT.CHECK pages: no point to loop over the others 143 $automate_Ncheck ++ 144 if ($automate_Ncheck >= $Npage) set automate_Ncheck = 0 145 echo "automate.check $automate_Ncheck" 146 147 # search the automate book for an entry which is unstarted (state INIT.CHECK) 148 book getpage automate $automate_Ncheck -var pageName -key pantaskState INIT.CHECK 149 if ("$pageName" == "NULL") 150 echo "entry $automate_Ncheck not in INIT.CHECK state" 151 break 152 end 153 154 book getword automate $pageName check -var checkCommand 155 if (("$checkCommand" == "NULL") || ("$checkCommand" == "NONE")) 156 # if there is no check needed, we can immediate progress to the next stage (INIT.LAUNCH) 157 book setword automate $pageName pantaskState INIT.LAUNCH 158 echo "$pageName is ready : INIT.LAUNCH" 159 break 160 end 161 162 book setword automate $pageName pantaskState RUN.CHECK 163 164 if ($VERBOSE >= 1) 165 echo "starting automate check for $pageName" 166 echo "command $checkCommand" 167 end 168 169 options $pageName 170 command $checkCommand 171 end 172 173 task.exit $EXIT_SUCCESS 174 local pageName Npage 175 176 $pageName = $options:0 177 178 echo "complete $pageName test, checking results" 179 180 # convert 'stdout' to book format 181 # XXX to use other tests, we'll need to modify this 182 ipptool2book stdout detExp -key det_id -uniq 183 if ($VERBOSE > 2) 184 book listbook detExp 185 end 186 187 book npages detExp -var Npage 188 if ($Npage == 0) 189 echo "$pageName not ready for LAUNCH" 190 book setword automate $pageName pantaskState INIT.CHECK 191 else 192 echo "$pageName is ready for LAUNCH" 193 book setword automate $pageName pantaskState INIT.LAUNCH 194 end 195 196 # drop the detExt book after we've grabbed the state 197 book delete detExp 198 end 199 200 # all failures here (what state?) 201 task.exit default 202 showcommand failure 203 end 204 205 # operation times out? 206 task.exit timeout 207 showcommand timeout 208 end 209 end 210 211 $automate_Nlaunch = 0 212 task automate.launch 213 host local 214 215 periods -poll 1 216 periods -exec 5 217 periods -timeout 30 218 active true 219 npending 1 220 221 task.exec 222 local Npage pageName 223 224 # how many pages are waiting to be started? 225 book npages automate -var Npage -key pantaskState INIT.LAUNCH 226 if ($Npage == 0) 227 echo "no entries in INIT.LAUNCH state" 228 break 229 end 230 231 # cycle over the number of INIT.LAUNCH pages: no point to loop over the others 122 232 $automate_Nlaunch ++ 123 233 if ($automate_Nlaunch >= $Npage) set automate_Nlaunch = 0 124 125 # search the automate book for an entry which is ready (state READY) 126 book getpage automate $automate_Nlaunch -var pageName -key pantaskState READY 127 if ("$pageName" == "NULL") break 234 echo "automate.launch $automate_Nlaunch" 235 236 # search the automate book for an entry which is unstarted (state INIT.LAUNCH) 237 book getpage automate $automate_Nlaunch -var pageName -key pantaskState INIT.LAUNCH 238 if ("$pageName" == "NULL") 239 echo "entry $automate_Nlaunch not in INIT.LAUNCH state" 240 break 241 end 128 242 129 243 book getword automate $pageName launch -var launchCommand 130 244 if (("$launchCommand" == "NULL") || ("$launchCommand" == "NONE")) 131 # if there is no launch needed, we can immediate progress to READY 132 book setword automate $pageName pantaskState DONE 133 break 134 end 135 136 book setword automate $pageName pantaskState LAUNCH 245 # if there is no launch needed, we can immediate progress to the next stage (INIT.LAUNCH) 246 book setword automate $pageName pantaskState INIT.LAUNCH 247 echo "$pageName is ready : INIT.LAUNCH" 248 break 249 end 250 251 book setword automate $pageName pantaskState RUN.LAUNCH 137 252 138 253 if ($VERBOSE >= 1) … … 146 261 147 262 task.exit $EXIT_SUCCESS 148 local pageName 263 local pageName Npage 149 264 150 265 $pageName = $options:0 151 266 152 # we should have launched only a single detRun 153 book setword automate $pageName pantaskState DONE 154 end 155 end 267 echo "completed $pageName launch" 268 book setword automate $pageName pantaskState DONE.LAUNCH 269 end 270 271 # all failures here (what state?) 272 task.exit default 273 showcommand failure 274 end 275 276 # operation times out? 277 task.exit timeout 278 showcommand timeout 279 end 280 end 281
Note:
See TracChangeset
for help on using the changeset viewer.
