Changeset 11210 for trunk/ippTasks/phase2.pro
- Timestamp:
- Jan 19, 2007, 5:24:59 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTasks/phase2.pro (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/phase2.pro
r10758 r11210 1 1 ## this file contains the tasks for running the phase 0 stage 2 ## these tasks use the book p2PendingImfile 2 3 3 ## these tasks use the queue Phase2Imfiles4 ## the Phase2Imfiles queue contains:5 ## STATE EXP_TAG CLASS CLASS_ID URI-FITS6 ## queue keys are counted from 07 8 queueinit Phase2Imfiles9 4 if ($?network == 0) 10 5 $network = 1 … … 13 8 $parallel = 0 14 9 end 15 16 $Phase2ImfileFail = 017 18 10 if ($?VERBOSE == 0) 19 11 echo "VERBOSE not defined: load pantasks.pro first" … … 24 16 break 25 17 end 18 26 19 $LOGSUBDIR = $LOGDIR/phase2 27 20 exec mkdir -p $LOGSUBDIR 28 21 22 book init p2PendingImfile 23 29 24 macro phase2.status 30 queueprint Phase2Imfiles 31 echo "Phase2ImfileFail: $Phase2ImfileFail" 25 book listbook p2PendingImfile 32 26 end 33 27 34 28 # select images ready for phase2 analysis 35 # new entries are added to queue Phase2Imfiles36 # compare the new list with the ones already selected29 # new entries are added to p2PendingImfile 30 # skip already-present entries 37 31 task phase2.imfile.load 38 32 host local … … 42 36 periods -timeout 30 43 37 44 stdout $LOGSUBDIR/phase2.imfile.log38 stdout NULL 45 39 stderr $LOGSUBDIR/phase2.imfile.log 46 40 47 41 task.exec 48 # command p2tool -pendingimfile -simple -limit {$Phase2ImfileFail + 20} 49 command p2tool -pendingimfile -simple 42 command p2tool -pendingimfile -limit 20 50 43 end 51 44 52 45 # success 53 46 task.exit 0 54 local i Nqueue 55 56 # save stdout and stderr 57 58 # compare output with Phase2Imfiles queue 59 # only add entries which don't exist in queue 60 queuesize stdout -var Nqueue 61 for i 0 $Nqueue 62 queuepop stdout -var line 63 if ($VERBOSE > 2) 64 echo $line 65 end 66 list word -split $line 67 $EXP_TAG = $word:0 68 $CLASS_ID = $word:1 69 $URI = $word:2 70 queuepush Phase2Imfiles -uniq -key 1:2 "NEW $EXP_TAG $CLASS_ID $URI" 47 # convert 'stdout' to book format 48 ipptool2book stdout p2PendingImfile -key exp_tag:class_id -uniq 49 if ($VERBOSE > 2) 50 book listbook p2PendingImfile 71 51 end 72 52 73 53 # delete existing entries which are DONE 74 queuedrop Phase2Imfiles -key 0DONE54 book delpage p2PendingImfile -key state DONE 75 55 end 76 56 … … 86 66 end 87 67 88 # run the phase2 imfilescript on pending images68 # run the phase2.pl script on pending images 89 69 task phase2.imfile.run 90 70 periods -poll $runpoll … … 93 73 94 74 task.exec 95 queuesize Phase2Imfiles-var N75 book npages p2PendingImfile -var N 96 76 if ($N == 0) break 97 77 if ($network == 0) break 98 78 99 # look for new images on the internal DetrendImfilesToProcess queue 100 # caution with these 'if' statements: syntax errors 101 # will make the task fail without given a good status 102 queuepop Phase2Imfiles -var line -key 0 NEW 103 if ("$line" == "NULL") break 79 # look for new images in p2PendingImfile (state == NULL) 80 book getpage p2PendingImfile 0 -var pageName -key state NULL 81 if ($pageName == NULL) break 104 82 105 strpop line state 106 queuepush Phase2Imfiles -replace -key 1:2 "RUN $line" 83 book setword p2PendingImfile $pageName state RUN 84 book getword p2PendingImfile $pageName camera -var CAMERA 85 book getword p2PendingImfile $pageName exp_tag -var EXP_TAG 86 book getword p2PendingImfile $pageName outpath -var OUTPATH 87 book getword p2PendingImfile $pageName class_id -var CLASS_ID 88 book getword p2PendingImfile $pageName uri -var URI 107 89 108 ## the Phase2Imfiles queue contains (line has popped STATE) 109 ## STATE EXP_TAG CLASS CLASS_ID URI-FITS 110 list word -split $line 111 $EXP_TAG = $word:0 112 $CLASS_ID = $word:1 113 $URI = $word:2 114 115 # specify choice of remote host:(need to choose based on chips) 90 # specify choice of remote host 91 # XXX need to choose based on chips 116 92 if ($parallel) 117 93 host anyhost … … 120 96 end 121 97 122 ## add 'p2' to the log files? 123 # XXX this is still a lame rule 124 $word = `basename $EXP_TAG | tr '.' ' '` 125 list word -split $word 126 $base = $word:0 127 stdout $LOGSUBDIR/$base/$EXP_TAG.$CLASS_ID.log 128 stderr $LOGSUBDIR/$base/$EXP_TAG.$CLASS_ID.log 129 exec mkdir -p $LOGSUBDIR/$base 98 ## generate output log based on filerule 99 $outroot = $OUTPATH/$EXP_TAG 100 $logfile = `ipp_filename.pl PHASE2.LOG $outroot $CLASS_ID` 101 stdout $logfile 102 stderr $logfile 103 exec mkdir -p $OUTPATH 104 105 # save the pageName for future reference below 106 options $pageName 130 107 131 108 # create the command line 132 options "$line"133 109 if ($VERBOSE > 1) 134 echo command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI 110 echo command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera $CAMERA 135 111 end 136 ## XXX this is annoying: phase2.pl now requires camera :: it should not need this, it has the file. 137 command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera CTIO_MOSAIC2 138 end 139 140 # success 141 task.exit 0 142 # phase2imfile.pl updates DB tables, here we just update the queue 143 queuepush Phase2Imfiles -replace -key 1:2 "DONE $options:0" 112 command phase2.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --camera $CAMERA --outpath $OUTPATH 144 113 end 145 114 146 115 # default exit status 147 116 task.exit default 148 showcommand failure 149 queuepush Phase2Imfiles -replace -key 1:2 "FAIL $options:0" 150 $Phase2ImfileFail ++ 117 process_exit p2PendingImfile $options:0 $JOB_STATUS 151 118 end 152 119 153 # operation time sout?120 # operation timed out? 154 121 task.exit timeout 155 122 showcommand timeout 156 queuepush Phase2Imfiles -replace -key 1:2 "TIMEOUT $options:0" 157 $Phase2ImfileFail ++ 123 book setword p2PendingImfile $options:0 state TIMEOUT 158 124 end 159 125 end
Note:
See TracChangeset
for help on using the changeset viewer.
