Changeset 18783 for trunk/ippTasks/magic.pro
- Timestamp:
- Jul 30, 2008, 10:42:33 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTasks/magic.pro (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/magic.pro
r17653 r18783 8 8 9 9 ### Initialise the books containing the tasks to do 10 book init magicToTree 10 11 book init magicToProcess 11 12 book init magicToMask 12 book init magicToSkyfileMask13 13 14 14 ### Database lists 15 $magic_DB = 0 16 17 ### Check status of warping tasks 18 #macro warp.status 19 # book listbook warpInputExp 20 # book listbook warpPendingSkyCell 21 #end 22 23 ### Reset warping tasks 24 #macro warp.reset 25 # book init warpInputExp 26 # book init warpPendingSkyCell 27 #end 28 29 ### Turn warping tasks on 30 # macro warp.on 31 # task warp.exp.load 32 # active true 33 # end 34 # task warp.exp.run 35 # active true 36 # end 37 # task warp.skycell.load 38 # active true 39 # end 40 # task warp.skycell.run 41 # active true 42 # end 43 # end 44 # 45 # ### Turn warping tasks off 46 # macro warp.off 47 # task warp.exp.load 48 # active false 49 # end 50 # task warp.exp.run 51 # active false 52 # end 53 # task warp.skycell.load 54 # active false 55 # end 56 # task warp.skycell.run 57 # active false 58 # end 59 # end 60 61 # populate magicToProcess 62 task magic.toprocess 15 $magicTree_DB = 0 16 $magicProcess_DB = 0 17 $magicMask_DB = 0 18 19 ### Check status of tasks 20 macro warp.status 21 book listbook magicToTree 22 book listbook magicToProcess 23 book listbook magicToMask 24 end 25 26 ### Reset tasks 27 macro warp.reset 28 book init magicTree 29 book init magicProcess 30 book init magicMask 31 end 32 33 ### Turn tasks on 34 macro warp.on 35 task magic.tree.load 36 active true 37 end 38 task magic.tree.run 39 active true 40 end 41 task magic.process.load 42 active true 43 end 44 task magic.process.run 45 active true 46 end 47 task magic.mask.load 48 active true 49 end 50 task magic.mask.run 51 active true 52 end 53 end 54 55 ### Turn tasks off 56 macro warp.on 57 task magic.tree.load 58 active false 59 end 60 task magic.tree.run 61 active false 62 end 63 task magic.process.load 64 active false 65 end 66 task magic.process.run 67 active false 68 end 69 task magic.mask.load 70 active false 71 end 72 task magic.mask.run 73 active false 74 end 75 end 76 77 task magic.tree.load 63 78 host local 64 79 … … 69 84 70 85 stdout NULL 71 stderr $LOG SUBDIR/magic.toprocess.log86 stderr $LOGDIR/magic.tree.log 72 87 73 88 task.exec 74 89 if ($DB:n == 0) 75 90 option DEFAULT 76 run = command magictool -toprocess -limit 20 77 if ($VERBOSE > 1) 78 echo command $run 79 end 80 command $run 91 command magictool -totree -limit 20 81 92 else 82 93 # save the DB name for the exit tasks 83 option $DB:$magic _DB84 command magictool -to process -limit 20 -dbname $DB:$magic_DB85 $magic _DB ++86 if ($magic _DB >= $DB:n) set magic_DB = 094 option $DB:$magicTree_DB 95 command magictool -totree -limit 20 -dbname $DB:$magicTree_DB 96 $magicTree_DB ++ 97 if ($magicTree_DB >= $DB:n) set magicTree_DB = 0 87 98 end 88 99 end … … 91 102 task.exit 0 92 103 # convert 'stdout' to book format 93 ipptool2book stdout magicT oProcess -key magic_id:node-uniq -setword dbname $options:0 -setword pantaskState INIT104 ipptool2book stdout magicTree -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT 94 105 if ($VERBOSE > 2) 95 book listbook magicT oProcess106 book listbook magicTree 96 107 end 97 108 98 109 # delete existing entries in the appropriate pantaskStates 99 process_cleanup magicT oProcess110 process_cleanup magicTree 100 111 end 101 112 … … 111 122 end 112 123 113 # task magic.process 114 # periods -poll $loadpoll 115 # periods -exec $loadexec 116 # periods -timeout 30 117 # 118 # task.exec 119 # end 120 # 121 # # default exit status 122 # task.exit default 123 # process_exit magicToProcess $options:0 $JOB_STATUS 124 # end 125 # 126 # # operation timed out? 127 # task.exit timeout 128 # showcommand timeout 129 # book setword magicToProcess $options:0 pantaskState TIMEOUT 130 # end 131 # end 132 133 # populate magicToMask 134 task magic.tomask 124 task magic.tree.run 125 periods -poll $RUNPOLL 126 periods -exec $RUNEXEC 127 periods -timeout 60 128 129 task.exec 130 book npages magicTree -var N 131 if ($N == 0) break 132 if ($NETWORK == 0) break 133 134 # look for new images (pantaskState == INIT) 135 book getpage magicTree 0 -var pageName -key pantaskState INIT 136 if ("$pageName" == "NULL") break 137 138 book setword magicTree $pageName pantaskState RUN 139 book getword magicTree $pageName magic_id -var MAGIC_ID 140 book getword magicTree $pageName exp_id -var EXP_ID 141 book getword magicTree $pageName camera -var CAMERA 142 book getword magicTree $pageName workdir -var WORKDIR_TEMPLATE 143 book getword magicTree $pageName dbname -var DBNAME 144 book getword magicTree $pageName tess_id -var TESS_DIR 145 book getword magicTree $pageName ra -var RA 146 book getword magicTree $pageName decl -var DEC 147 148 # set.host.for.camera $CAMERA $MAGIC_ID 149 # set.workdir.by.camera $CAMERA $MAGIC_ID $WORKDIR_TEMPLATE $default_host WORKDIR 150 host anyhost 151 $WORKDIR = $WORKDIR_TEMPLATE 152 153 basename $TESS_DIR -var TESS_ID 154 sprintf outroot "%s/%s/%s.mgc.%s" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID 155 156 ## generate output log based on filerule (convert the URI to a PATH) 157 $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot` 158 if ("$logfile" == "") 159 echo "WARNING: logfile not defined in magic.tree.run" 160 break 161 end 162 163 stdout $logfile 164 stderr $logfile 165 dirname $logfile -var outpath 166 mkdir $outpath 167 168 $run = magic_tree.pl --magic_id $MAGIC_ID --camera $CAMERA --tess_id $TESS_DIR --ra $RA --dec $DEC --outroot $outroot --logfile $logfile 169 add_standard_args run 170 171 # save the pageName for future reference below 172 options $pageName 173 174 # create the command line 175 if ($VERBOSE > 1) 176 echo command $run 177 end 178 command $run 179 end 180 181 # default exit status 182 task.exit default 183 process_exit magicTree $options:0 $JOB_STATUS 184 end 185 186 # operation timed out? 187 task.exit timeout 188 showcommand timeout 189 book setword magicTree $options:0 pantaskState TIMEOUT 190 end 191 end 192 193 task magic.process.load 135 194 host local 136 195 … … 141 200 142 201 stdout NULL 143 stderr $LOG SUBDIR/magic.tomask.log202 stderr $LOGDIR/magic.process.log 144 203 145 204 task.exec 146 205 if ($DB:n == 0) 147 206 option DEFAULT 148 run = command magictool -tomask -limit 20 149 if ($VERBOSE > 1) 150 echo command $run 151 end 152 command $run 207 command magictool -toprocess -limit 20 153 208 else 154 209 # save the DB name for the exit tasks 155 option $DB:$magic _DB156 command magictool -to mask -limit 20 -dbname $DB:$magic_DB157 $magic _DB ++158 if ($magic _DB >= $DB:n) set magic_DB = 0210 option $DB:$magicTree_DB 211 command magictool -toprocess -limit 20 -dbname $DB:$magicProcess_DB 212 $magicProcess_DB ++ 213 if ($magicProcess_DB >= $DB:n) set magicProcess_DB = 0 159 214 end 160 215 end … … 163 218 task.exit 0 164 219 # convert 'stdout' to book format 165 ipptool2book stdout magic ToMask -key magic_id-uniq -setword dbname $options:0 -setword pantaskState INIT220 ipptool2book stdout magicProcess -key magic_id:node -uniq -setword dbname $options:0 -setword pantaskState INIT 166 221 if ($VERBOSE > 2) 167 book listbook magic ToProcess222 book listbook magicProcess 168 223 end 169 224 170 225 # delete existing entries in the appropriate pantaskStates 171 process_cleanup magic ToMask226 process_cleanup magicProcess 172 227 end 173 228 … … 183 238 end 184 239 185 186 # populate magicToMask 187 task magic.toskyfilemask 240 task magic.process.run 241 periods -poll $RUNPOLL 242 periods -exec $RUNEXEC 243 periods -timeout 60 244 245 task.exec 246 book npages magicProcess -var N 247 if ($N == 0) break 248 if ($NETWORK == 0) break 249 250 # look for new images (pantaskState == INIT) 251 book getpage magicProcess 0 -var pageName -key pantaskState INIT 252 if ("$pageName" == "NULL") break 253 254 book setword magicTree $pageName pantaskState RUN 255 book getword magicTree $pageName magic_id -var MAGIC_ID 256 book getword magicTree $pageName exp_id -var EXP_ID 257 book getword magicTree $pageName node -var NODE 258 book getword magicTree $pageName camera -var CAMERA 259 book getword magicTree $pageName workdir -var WORKDIR_TEMPLATE 260 book getword magicTree $pageName dbname -var DBNAME 261 262 # set.host.for.camera $CAMERA $MAGIC_ID 263 # set.workdir.by.camera $CAMERA $MAGIC_ID $WORKDIR_TEMPLATE $default_host WORKDIR 264 host anyhost 265 $WORKDIR = $WORKDIR_TEMPLATE 266 267 basename $TESS_DIR -var TESS_ID 268 sprintf outroot "%s/%s/%s.mgc.%s.%s" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID $NODE 269 270 ## generate output log based on filerule (convert the URI to a PATH) 271 $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot` 272 if ("$logfile" == "") 273 echo "WARNING: logfile not defined in magic.process.run" 274 break 275 end 276 277 stdout $logfile 278 stderr $logfile 279 dirname $logfile -var outpath 280 mkdir $outpath 281 282 $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --outroot $outroot --logfile $logfile 283 add_standard_args run 284 285 # save the pageName for future reference below 286 options $pageName 287 288 # create the command line 289 if ($VERBOSE > 1) 290 echo command $run 291 end 292 command $run 293 end 294 295 # default exit status 296 task.exit default 297 process_exit magicProcess $options:0 $JOB_STATUS 298 end 299 300 # operation timed out? 301 task.exit timeout 302 showcommand timeout 303 book setword magicProcess $options:0 pantaskState TIMEOUT 304 end 305 end 306 307 task magic.mask.load 188 308 host local 189 309 … … 194 314 195 315 stdout NULL 196 stderr $LOG SUBDIR/magic.toskyfilemask.log316 stderr $LOGDIR/magic.mask.log 197 317 198 318 task.exec 199 319 if ($DB:n == 0) 200 320 option DEFAULT 201 run = command magictool -toskyfilemask -limit 20 202 if ($VERBOSE > 1) 203 echo command $run 204 end 205 command $run 321 command magictool -tomask -limit 20 206 322 else 207 323 # save the DB name for the exit tasks 208 option $DB:$magic _DB209 command magictool -to skyfilemask-limit 20 -dbname $DB:$magic_DB210 $magic _DB ++211 if ($magic _DB >= $DB:n) set magic_DB = 0324 option $DB:$magicMask_DB 325 command magictool -tomask -limit 20 -dbname $DB:$magicMask_DB 326 $magicMask_DB ++ 327 if ($magicMask_DB >= $DB:n) set magicMask_DB = 0 212 328 end 213 329 end … … 216 332 task.exit 0 217 333 # convert 'stdout' to book format 218 ipptool2book stdout magic ToSkyfileMask -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT334 ipptool2book stdout magicMask -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT 219 335 if ($VERBOSE > 2) 220 book listbook magic ToProcess336 book listbook magicMask 221 337 end 222 338 223 339 # delete existing entries in the appropriate pantaskStates 224 process_cleanup magic ToSkyfileMask340 process_cleanup magicMask 225 341 end 226 342 … … 235 351 end 236 352 end 353 354 task magic.mask.run 355 periods -poll $RUNPOLL 356 periods -exec $RUNEXEC 357 periods -timeout 60 358 359 task.exec 360 book npages magicMask -var N 361 if ($N == 0) break 362 if ($NETWORK == 0) break 363 364 # look for new images (pantaskState == INIT) 365 book getpage magicMask 0 -var pageName -key pantaskState INIT 366 if ("$pageName" == "NULL") break 367 368 book setword magicMask $pageName pantaskState RUN 369 book getword magicMask $pageName magic_id -var MAGIC_ID 370 book getword magicMask $pageName exp_id -var EXP_ID 371 book getword magicMask $pageName camera -var CAMERA 372 book getword magicMask $pageName workdir -var WORKDIR_TEMPLATE 373 book getword magicMask $pageName dbname -var DBNAME 374 375 # set.host.for.camera $CAMERA $MAGIC_ID 376 # set.workdir.by.camera $CAMERA $MAGIC_ID $WORKDIR_TEMPLATE $default_host WORKDIR 377 host anyhost 378 $WORKDIR = $WORKDIR_TEMPLATE 379 380 basename $TESS_DIR -var TESS_ID 381 sprintf outroot "%s/%s/%s.mgc.%s.mask" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID 382 383 ## generate output log based on filerule (convert the URI to a PATH) 384 $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot` 385 if ("$logfile" == "") 386 echo "WARNING: logfile not defined in magic.tree.run" 387 break 388 end 389 390 stdout $logfile 391 stderr $logfile 392 dirname $logfile -var outpath 393 mkdir $outpath 394 395 $run = magic_mask.pl --magic_id $MAGIC_ID --camera $CAMERA --outroot $outroot --logfile $logfile 396 add_standard_args run 397 398 # save the pageName for future reference below 399 options $pageName 400 401 # create the command line 402 if ($VERBOSE > 1) 403 echo command $run 404 end 405 command $run 406 end 407 408 # default exit status 409 task.exit default 410 process_exit magicMask $options:0 $JOB_STATUS 411 end 412 413 # operation timed out? 414 task.exit timeout 415 showcommand timeout 416 book setword magicMask $options:0 pantaskState TIMEOUT 417 end 418 end 419
Note:
See TracChangeset
for help on using the changeset viewer.
