Changeset 20790 for trunk/ippTasks/magic.pro
- Timestamp:
- Nov 17, 2008, 3:55:36 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTasks/magic.pro (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/magic.pro
r20760 r20790 8 8 9 9 ### Initialise the books containing the tasks to do 10 book init magicT ree11 book init magic Process12 book init magic Mask10 book init magicToTree 11 book init magicToProcess 12 book init magicToDS 13 13 14 14 ### Database lists 15 $magicT ree_DB = 016 $magic Process_DB = 017 $magic Mask_DB = 015 $magicToTree_DB = 0 16 $magicToProcess_DB = 0 17 $magicToDS_DB = 0 18 18 19 19 ### Check status of tasks 20 20 macro magic.status 21 book listbook magicT ree22 book listbook magic Process23 book listbook magic Mask21 book listbook magicToTree 22 book listbook magicToProcess 23 book listbook magicToDS 24 24 end 25 25 26 26 ### Reset tasks 27 27 macro magic.reset 28 book init magicT ree29 book init magic Process30 book init magic Mask28 book init magicToTree 29 book init magicToProcess 30 book init magicToDS 31 31 end 32 32 … … 45 45 active true 46 46 end 47 task magic. mask.load48 active true 49 end 50 task magic. mask.run47 task magic.destreak.load 48 active true 49 end 50 task magic.destreak.run 51 51 active true 52 52 end … … 54 54 55 55 ### Turn tasks off 56 macro magic.o n56 macro magic.off 57 57 task magic.tree.load 58 58 active false … … 67 67 active false 68 68 end 69 task magic. mask.load70 active false 71 end 72 task magic. mask.run69 task magic.destreak.load 70 active false 71 end 72 task magic.destreak.run 73 73 active false 74 74 end … … 92 92 else 93 93 # save the DB name for the exit tasks 94 option $DB:$magicT ree_DB95 command magictool -totree -limit 20 -dbname $DB:$magicT ree_DB96 $magicT ree_DB ++97 if ($magicT ree_DB >= $DB:n) set magicTree_DB = 094 option $DB:$magicToTree_DB 95 command magictool -totree -limit 20 -dbname $DB:$magicToTree_DB 96 $magicToTree_DB ++ 97 if ($magicToTree_DB >= $DB:n) set magicToTree_DB = 0 98 98 end 99 99 end … … 102 102 task.exit 0 103 103 # convert 'stdout' to book format 104 ipptool2book stdout magicT ree -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT104 ipptool2book stdout magicToTree -key magic_id -uniq -setword dbname $options:0 -setword pantaskState INIT 105 105 if ($VERBOSE > 2) 106 book listbook magicT ree106 book listbook magicToTree 107 107 end 108 108 109 109 # delete existing entries in the appropriate pantaskStates 110 process_cleanup magicT ree110 process_cleanup magicToTree 111 111 end 112 112 … … 128 128 129 129 task.exec 130 book npages magicT ree -var N130 book npages magicToTree -var N 131 131 if ($N == 0) break 132 132 if ($NETWORK == 0) break 133 133 134 134 # look for new images (pantaskState == INIT) 135 book getpage magicT ree 0 -var pageName -key pantaskState INIT135 book getpage magicToTree 0 -var pageName -key pantaskState INIT 136 136 if ("$pageName" == "NULL") break 137 137 138 book setword magicT ree $pageName pantaskState RUN139 book getword magicT ree $pageName magic_id -var MAGIC_ID140 book getword magicT ree $pageName exp_id -var EXP_ID141 book getword magicT ree $pageName camera -var CAMERA142 book getword magicT ree $pageName workdir -var WORKDIR_TEMPLATE143 book getword magicT ree $pageName dbname -var DBNAME144 book getword magicT ree $pageName tess_id -var TESS_DIR145 book getword magicT ree $pageName ra -var RA146 book getword magicT ree $pageName decl -var DEC138 book setword magicToTree $pageName pantaskState RUN 139 book getword magicToTree $pageName magic_id -var MAGIC_ID 140 book getword magicToTree $pageName exp_id -var EXP_ID 141 book getword magicToTree $pageName camera -var CAMERA 142 book getword magicToTree $pageName workdir -var WORKDIR_TEMPLATE 143 book getword magicToTree $pageName dbname -var DBNAME 144 book getword magicToTree $pageName tess_id -var TESS_DIR 145 book getword magicToTree $pageName ra -var RA 146 book getword magicToTree $pageName decl -var DEC 147 147 148 148 # set.host.for.camera $CAMERA $MAGIC_ID … … 184 184 # default exit status 185 185 task.exit default 186 process_exit magicT ree $options:0 $JOB_STATUS186 process_exit magicToTree $options:0 $JOB_STATUS 187 187 end 188 188 … … 190 190 task.exit timeout 191 191 showcommand timeout 192 book setword magicT ree $options:0 pantaskState TIMEOUT192 book setword magicToTree $options:0 pantaskState TIMEOUT 193 193 end 194 194 end … … 211 211 else 212 212 # save the DB name for the exit tasks 213 option $DB:$magicT ree_DB214 command magictool -toprocess -limit 20 -dbname $DB:$magic Process_DB215 $magic Process_DB ++216 if ($magic Process_DB >= $DB:n) set magicProcess_DB = 0213 option $DB:$magicToTree_DB 214 command magictool -toprocess -limit 20 -dbname $DB:$magicToProcess_DB 215 $magicToProcess_DB ++ 216 if ($magicToProcess_DB >= $DB:n) set magicToProcess_DB = 0 217 217 end 218 218 end … … 221 221 task.exit 0 222 222 # convert 'stdout' to book format 223 ipptool2book stdout magic Process -key magic_id:node -uniq -setword dbname $options:0 -setword pantaskState INIT223 ipptool2book stdout magicToProcess -key magic_id:node -uniq -setword dbname $options:0 -setword pantaskState INIT 224 224 if ($VERBOSE > 2) 225 book listbook magic Process225 book listbook magicToProcess 226 226 end 227 227 228 228 # delete existing entries in the appropriate pantaskStates 229 process_cleanup magic Process229 process_cleanup magicToProcess 230 230 end 231 231 … … 247 247 248 248 task.exec 249 book npages magic Process -var N249 book npages magicToProcess -var N 250 250 if ($N == 0) break 251 251 if ($NETWORK == 0) break 252 252 253 253 # look for new images (pantaskState == INIT) 254 book getpage magic Process 0 -var pageName -key pantaskState INIT254 book getpage magicToProcess 0 -var pageName -key pantaskState INIT 255 255 if ("$pageName" == "NULL") break 256 256 257 book setword magic Process $pageName pantaskState RUN258 book getword magic Process $pageName magic_id -var MAGIC_ID259 book getword magic Process $pageName exp_id -var EXP_ID260 book getword magic Process $pageName node -var NODE261 book getword magic Process $pageName camera -var CAMERA262 book getword magic Process $pageName workdir -var WORKDIR_TEMPLATE263 book getword magic Process $pageName dbname -var DBNAME257 book setword magicToProcess $pageName pantaskState RUN 258 book getword magicToProcess $pageName magic_id -var MAGIC_ID 259 book getword magicToProcess $pageName exp_id -var EXP_ID 260 book getword magicToProcess $pageName node -var NODE 261 book getword magicToProcess $pageName camera -var CAMERA 262 book getword magicToProcess $pageName workdir -var WORKDIR_TEMPLATE 263 book getword magicToProcess $pageName dbname -var DBNAME 264 264 265 265 # set.host.for.camera $CAMERA $MAGIC_ID … … 298 298 # default exit status 299 299 task.exit default 300 process_exit magic Process $options:0 $JOB_STATUS300 process_exit magicToProcess $options:0 $JOB_STATUS 301 301 end 302 302 … … 304 304 task.exit timeout 305 305 showcommand timeout 306 book setword magic Process $options:0 pantaskState TIMEOUT307 end 308 end 309 310 task magic. mask.load306 book setword magicToProcess $options:0 pantaskState TIMEOUT 307 end 308 end 309 310 task magic.destreak.load 311 311 host local 312 312 … … 316 316 npending 1 317 317 318 # this task is not ready to go yet319 active false320 321 318 stdout NULL 322 stderr $LOGDIR/magic. mask.log319 stderr $LOGDIR/magic.destreak.log 323 320 324 321 task.exec 325 322 if ($DB:n == 0) 326 323 option DEFAULT 327 command magic tool -tomask -limit 20324 command magicdstool -todestreak -limit 20 328 325 else 329 326 # save the DB name for the exit tasks 330 option $DB:$magic Mask_DB331 command magic tool -tomask -limit 20 -dbname $DB:$magicMask_DB332 $magic Mask_DB ++333 if ($magic Mask_DB >= $DB:n) set magicMask_DB = 0327 option $DB:$magicToDS_DB 328 command magicdstool -todestreak -limit 20 -dbname $DB:$magicToDS_DB 329 $magicToDS_DB ++ 330 if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0 334 331 end 335 332 end … … 338 335 task.exit 0 339 336 # convert 'stdout' to book format 340 ipptool2book stdout magic Mask -key magic_id-uniq -setword dbname $options:0 -setword pantaskState INIT337 ipptool2book stdout magicToDS -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT 341 338 if ($VERBOSE > 2) 342 book listbook magic Mask339 book listbook magicToDS 343 340 end 344 341 345 342 # delete existing entries in the appropriate pantaskStates 346 process_cleanup magic Mask343 process_cleanup magicToDS 347 344 end 348 345 … … 358 355 end 359 356 360 task magic. mask.run357 task magic.destreak.run 361 358 periods -poll $RUNPOLL 362 359 periods -exec $RUNEXEC 363 360 periods -timeout 60 364 361 365 #this task is not ready to go yet 366 active false 367 368 task.exec 369 book npages magicMask -var N 362 task.exec 363 book npages magicToDS -var N 370 364 if ($N == 0) break 371 365 if ($NETWORK == 0) break 372 366 373 367 # look for new images (pantaskState == INIT) 374 book getpage magic Mask0 -var pageName -key pantaskState INIT368 book getpage magicToDS 0 -var pageName -key pantaskState INIT 375 369 if ("$pageName" == "NULL") break 376 370 377 book setword magicMask $pageName pantaskState RUN 378 book getword magicMask $pageName magic_id -var MAGIC_ID 379 book getword magicMask $pageName exp_id -var EXP_ID 380 book getword magicMask $pageName camera -var CAMERA 381 book getword magicMask $pageName workdir -var WORKDIR_TEMPLATE 382 book getword magicMask $pageName dbname -var DBNAME 383 384 # set.host.for.camera $CAMERA $MAGIC_ID 385 # set.workdir.by.camera $CAMERA $MAGIC_ID $WORKDIR_TEMPLATE $default_host WORKDIR 371 book setword magicToDS $pageName pantaskState RUN 372 book getword magicToDS $pageName magic_ds_id -var MAGIC_DS_ID 373 book getword magicToDS $pageName camera -var CAMERA 374 book getword magicToDS $pageName streaks_uri -var STREAKS 375 book getword magicToDS $pageName stage -var STAGE 376 book getword magicToDS $pageName stage_id -var STAGE_ID 377 book getword magicToDS $pageName component -var COMPONENT 378 book getword magicToDS $pageName uri -var URI 379 book getword magicToDS $pageName path_base -var PATH_BASE 380 book getword magicToDS $pageName cam_path_base -var CAM_PATH_BASE 381 book getword magicToDS $pageName outroot -var OUTROOT 382 book getword magicToDS $pageName recoveryroot -var RECROOT 383 book getword magicToDS $pageName re_place -var REPLACE 384 book getword magicToDS $pageName remove -var REMOVE 385 book getword magicToDS $pageName dbname -var DBNAME 386 387 sprintf logfile "%s/mgcds.%s.%s.%s.log" $OUTROOT $MAGIC_DS_ID $STAGE_ID $COMPONENT 388 386 389 host anyhost 387 $WORKDIR = $WORKDIR_TEMPLATE 388 389 basename $TESS_DIR -var TESS_ID 390 sprintf outroot "%s/%s/%s.mgc.%s.mask" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID 391 392 ## generate output log based on filerule (convert the URI to a PATH) 393 $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $MAGIC_ID --basename $outroot` 394 if ("$logfile" == "") 395 echo "WARNING: logfile not defined in magic.tree.run" 396 break 397 end 398 399 stdout $logfile 400 stderr $logfile 401 dirname $logfile -var outpath 402 mkdir $outpath 403 404 $run = magic_mask.pl --magic_id $MAGIC_ID --camera $CAMERA --outroot $outroot --logfile $logfile 390 391 # TODO: do not add recoveryroot, replace, or remove if they are null or zero 392 393 $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --streaks $STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT 394 # --recoveryroot $RECROOT --replace $REPLACE --remove $REMOVE 395 # --logfile $logfile 405 396 add_standard_args run 406 397 … … 416 407 417 408 # default exit status 418 task.exit default419 process_exit magic Mask$options:0 $JOB_STATUS409 task.exit 0 410 process_exit magicToDS $options:0 $JOB_STATUS 420 411 end 421 412 413 # locked list 414 task.exit default 415 showcommand failure 416 process_exit magicToDS $options:0 $JOB_STATUS 417 end 418 422 419 # operation timed out? 423 420 task.exit timeout 424 421 showcommand timeout 425 book setword magic Mask$options:0 pantaskState TIMEOUT426 end 427 end 428 422 book setword magicToDS $options:0 pantaskState TIMEOUT 423 end 424 end 425
Note:
See TracChangeset
for help on using the changeset viewer.
