Changeset 27315
- Timestamp:
- Mar 17, 2010, 4:15:53 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
ippTasks/lossy_compress.pro (modified) (12 diffs)
-
ippTools/share/regtool_pendingcompressimfile.sql (modified) (1 diff)
-
ippTools/src/regtool.c (modified) (1 diff)
-
ippTools/src/regtoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/lossy_compress.pro
r27193 r27315 1 1 ## lossy_compress.pro : tasks to lossy compress old raw images that have negligible science value : -*- sh -*- 2 ## use the books compPending Imfileand compPendingExp2 ## use the books compPendingCompress, compPendingClean and compPendingExp 3 3 4 4 # test for required global variables 5 5 check.globals 6 6 7 book init compPendingImfile 7 book init compPendingCompress 8 book init compPendingClean 8 9 book init compPendingExp 9 10 10 11 macro lossycomp.reset 11 book init compPendingImfile 12 book init compPendingCompress 13 book init compPendingClean 12 14 book init compPendingExp 13 15 end … … 15 17 macro lossycomp.status 16 18 book list 17 book listbook compPendingImfile 19 book listbook compPendingCompress 20 book listbook compPendingClean 18 21 book listbook compPendingExp 19 22 end 20 23 21 24 macro lossycomp.on 22 task lossycomp.imfile.load 23 active true 24 end 25 task lossycomp.imfile.run 25 task lossycomp.compress.load 26 active true 27 end 28 task lossycomp.compress.run 29 active true 30 end 31 task lossycomp.clean.load 32 active true 33 end 34 task lossycomp.clean.run 26 35 active true 27 36 end … … 32 41 33 42 macro lossycomp.off 34 task lossycomp.imfile.load 35 active false 36 end 37 task lossycomp.imfile.run 43 task lossycomp.compress.load 44 active false 45 end 46 task lossycomp.compress.run 47 active false 48 end 49 task lossycomp.clean.load 50 active false 51 end 52 task lossycomp.clean.run 38 53 active false 39 54 end … … 44 59 45 60 # these variables will cycle through the known database names 46 $compPendingImfile_DB = 0 61 $compPendingCompress_DB = 0 62 $compPendingClean_DB = 0 47 63 $comp_finish_DB = 0 48 64 49 65 # select images ready to be compressed 50 task lossycomp. imfile.load66 task lossycomp.compress.load 51 67 host local 52 68 … … 57 73 58 74 stdout NULL 59 stderr $LOGDIR/lossycomp. imfile.load.log75 stderr $LOGDIR/lossycomp.compress.load.log 60 76 61 77 #select entries from the current DB, cycle to the next DB if possible 62 78 task.exec 63 $run = regtool -pendingcompressimfile 79 $run = regtool -pendingcompressimfile -compress 64 80 if ($DB:n == 0) 65 81 option DEFAULT 66 82 else 67 83 # save the DB name for the exit tasks 68 option $DB:$compPending Imfile_DB69 $run = $run -dbname $DB:$compPending Imfile_DB70 $compPending Imfile_DB ++71 if ($compPending Imfile_DB >= $DB:n) set compPendingImfile_DB = 084 option $DB:$compPendingCompress_DB 85 $run = $run -dbname $DB:$compPendingCompress_DB 86 $compPendingCompress_DB ++ 87 if ($compPendingCompress_DB >= $DB:n) set compPendingCompress_DB = 0 72 88 end 73 89 add_poll_args run … … 78 94 task.exit $EXIT_SUCCESS 79 95 # convert 'stdout' to book format 80 ipptool2book stdout compPending Imfile-key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT81 book shuffle compPending Imfile96 ipptool2book stdout compPendingCompress -key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT 97 book shuffle compPendingCompress 82 98 if ($VERBOSE > 2) 83 book listbook compPending Imfile99 book listbook compPendingCompress 84 100 end 85 101 86 102 # delete existing entries in the appropriate pantaskStates 87 process_cleanup compPending Imfile103 process_cleanup compPendingCompress 88 104 end 89 105 … … 100 116 101 117 # run the lossy_compress_imfile.pl script on the pending images 102 task lossycomp. imfile.run118 task lossycomp.compress.run 103 119 periods -poll $RUNPOLL 104 120 periods -exec $RUNEXEC … … 107 123 task.exec 108 124 if ($NETWORK == 0) break 109 book npages compPending Imfile-var N125 book npages compPendingCompress -var N 110 126 if ($N == 0) 111 127 periods -exec $RUNEXEC … … 115 131 116 132 # look for new images 117 book getpage compPending Imfile0 -var pageName -key pantaskState INIT133 book getpage compPendingCompress 0 -var pageName -key pantaskState INIT 118 134 if ("$pageName" == "NULL") break 119 135 120 book setword compPending Imfile$pageName pantaskState RUN121 book getword compPending Imfile$pageName exp_id -var EXP_ID122 book getword compPending Imfile$pageName exp_name -var EXP_NAME123 book getword compPending Imfile$pageName exp_tag -var EXP_TAG124 book getword compPending Imfile$pageName tmp_class_id -var TMP_CLASS_ID125 book getword compPending Imfile$pageName class_id -var CLASS_ID126 book getword compPending Imfile$pageName camera -var CAMERA127 book getword compPending Imfile$pageName uri -var URI128 book getword compPending Imfile$pageName bytes -var BYTES129 book getword compPending Imfile$pageName md5sum -var MD5SUM130 book getword compPending Imfile$pageName workdir -var WORKDIR131 book getword compPending Imfile$pageName data_state -var STATE132 book getword compPending Imfile$pageName dbname -var DBNAME136 book setword compPendingCompress $pageName pantaskState RUN 137 book getword compPendingCompress $pageName exp_id -var EXP_ID 138 book getword compPendingCompress $pageName exp_name -var EXP_NAME 139 book getword compPendingCompress $pageName exp_tag -var EXP_TAG 140 book getword compPendingCompress $pageName tmp_class_id -var TMP_CLASS_ID 141 book getword compPendingCompress $pageName class_id -var CLASS_ID 142 book getword compPendingCompress $pageName camera -var CAMERA 143 book getword compPendingCompress $pageName uri -var URI 144 book getword compPendingCompress $pageName bytes -var BYTES 145 book getword compPendingCompress $pageName md5sum -var MD5SUM 146 book getword compPendingCompress $pageName workdir -var WORKDIR 147 book getword compPendingCompress $pageName data_state -var STATE 148 book getword compPendingCompress $pageName dbname -var DBNAME 133 149 134 150 # specify choice of remote host … … 142 158 end 143 159 144 stderr $LOGDIR/lossycomp. imfile.run.log145 stdout $LOGDIR/lossycomp. imfile.run.log160 stderr $LOGDIR/lossycomp.compress.run.log 161 stdout $LOGDIR/lossycomp.compress.run.log 146 162 147 163 $run = lossy_compress_imfile.pl --exp_id $EXP_ID --class_id $CLASS_ID --exp_name $EXP_NAME --uri $URI --camera $CAMERA --state $STATE --logfile $logfile --bytes $BYTES --md5sum $MD5SUM … … 160 176 # default exit status 161 177 task.exit default 162 process_exit compPending Imfile$options:0 $JOB_STATUS178 process_exit compPendingCompress $options:0 $JOB_STATUS 163 179 end 164 180 … … 166 182 showcommand crash 167 183 echo "hostname: $JOB_HOSTNAME" 168 book setword compPending Imfile$options:0 pantaskState CRASH184 book setword compPendingCompress $options:0 pantaskState CRASH 169 185 end 170 186 task.exit timeout 171 187 showcommand timeout 172 book setword compPendingImfile $options:0 pantaskState TIMEOUT 188 book setword compPendingCompress $options:0 pantaskState TIMEOUT 189 end 190 end 191 # select images ready to be compressed 192 task lossycomp.clean.load 193 host local 194 195 periods -poll $LOADPOLL 196 periods -exec $LOADEXEC 197 periods -timeout 30 198 npending 1 199 200 stdout NULL 201 stderr $LOGDIR/lossycomp.clean.load.log 202 203 #select entries from the current DB, cycle to the next DB if possible 204 task.exec 205 $run = regtool -pendingcompressimfile -clean 206 if ($DB:n == 0) 207 option DEFAULT 208 else 209 # save the DB name for the exit tasks 210 option $DB:$compPendingClean_DB 211 $run = $run -dbname $DB:$compPendingClean_DB 212 $compPendingClean_DB ++ 213 if ($compPendingClean_DB >= $DB:n) set compPendingClean_DB = 0 214 end 215 add_poll_args run 216 command $run 217 end 218 219 # success 220 task.exit $EXIT_SUCCESS 221 # convert 'stdout' to book format 222 ipptool2book stdout compPendingClean -key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT 223 book shuffle compPendingClean 224 if ($VERBOSE > 2) 225 book listbook compPendingClean 226 end 227 228 # delete existing entries in the appropriate pantaskStates 229 process_cleanup compPendingClean 230 end 231 232 task.exit default 233 showcommand failure 234 end 235 task.exit crash 236 showcommand crash 237 end 238 task.exit timeout 239 showcommand timeout 240 end 241 end 242 243 # run the lossy_compress_imfile.pl script on the pending images 244 task lossycomp.clean.run 245 periods -poll $RUNPOLL 246 periods -exec $RUNEXEC 247 periods -timeout 30 248 249 task.exec 250 if ($NETWORK == 0) break 251 book npages compPendingClean -var N 252 if ($N == 0) 253 periods -exec $RUNEXEC 254 break 255 end 256 periods -exec 0.05 257 258 # look for new images 259 book getpage compPendingClean 0 -var pageName -key pantaskState INIT 260 if ("$pageName" == "NULL") break 261 262 book setword compPendingClean $pageName pantaskState RUN 263 book getword compPendingClean $pageName exp_id -var EXP_ID 264 book getword compPendingClean $pageName exp_name -var EXP_NAME 265 book getword compPendingClean $pageName exp_tag -var EXP_TAG 266 book getword compPendingClean $pageName tmp_class_id -var TMP_CLASS_ID 267 book getword compPendingClean $pageName class_id -var CLASS_ID 268 book getword compPendingClean $pageName camera -var CAMERA 269 book getword compPendingClean $pageName uri -var URI 270 book getword compPendingClean $pageName bytes -var BYTES 271 book getword compPendingClean $pageName md5sum -var MD5SUM 272 book getword compPendingClean $pageName workdir -var WORKDIR 273 book getword compPendingClean $pageName data_state -var STATE 274 book getword compPendingClean $pageName dbname -var DBNAME 275 276 # specify choice of remote host 277 set.host.for.camera $CAMERA $TMP_CLASS_ID 278 279 # set logfile name 280 if ("$WORKDIR" == "NULL") 281 sprintf logfile "compress_log/%s.%d.lossycomp.%s.log" $EXP_NAME $EXP_ID $CLASS_ID 282 else 283 sprintf logfile "%s/%s/%s.lossycomp.%s.log" $WORKDIR $EXP_TAG $EXP_TAG $TMP_CLASS_ID 284 end 285 286 stderr $LOGDIR/lossycomp.clean.run.log 287 stdout $LOGDIR/lossycomp.clean.run.log 288 289 $run = lossy_compress_imfile.pl --exp_id $EXP_ID --class_id $CLASS_ID --exp_name $EXP_NAME --uri $URI --camera $CAMERA --state $STATE --logfile $logfile --bytes $BYTES --md5sum $MD5SUM 290 add_standard_args run 291 292 # save the pageName for future reference below 293 options $pageName 294 295 # create the command line 296 if ($VERBOSE > 1) 297 echo command $run 298 end 299 command $run 300 end 301 302 # default exit status 303 task.exit default 304 process_exit compPendingClean $options:0 $JOB_STATUS 305 end 306 307 task.exit crash 308 showcommand crash 309 echo "hostname: $JOB_HOSTNAME" 310 book setword compPendingClean $options:0 pantaskState CRASH 311 end 312 task.exit timeout 313 showcommand timeout 314 book setword compPendingClean $options:0 pantaskState TIMEOUT 173 315 end 174 316 end -
trunk/ippTools/share/regtool_pendingcompressimfile.sql
r27168 r27315 1 1 SELECT rawImfile.*,rawExp.workdir,rawExp.exp_tag from rawImfile 2 2 JOIN rawExp USING(exp_id) 3 WHERE ((data_state = 'goto_compressed' AND state = 'goto_compressed') 4 OR (data_state = 'goto_lossy' AND state = 'goto_lossy')) 3 WHERE 1 4 -- ((data_state = 'goto_compressed' AND state = 'goto_compressed') 5 -- OR (data_state = 'goto_lossy' AND state = 'goto_lossy')) 5 6 -- where hook %s 6 7 -- limit hook %s -
trunk/ippTools/src/regtool.c
r27210 r27315 584 584 psStringPrepend(&whereClause, "\n AND "); 585 585 } 586 PXOPT_LOOKUP_BOOL(compress, config->args, "-compress", false); 587 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 588 589 if ((compress && clean)||(!compress & !clean)) { 590 psStringAppend(&whereClause, "\n AND ((data_state = 'goto_compressed' AND state = 'goto_compressed')\n OR (data_state = 'goto_lossy' AND state = 'goto_lossy')) "); 591 } 592 else if (compress) { 593 psStringAppend(&whereClause, "\n AND ((data_state = 'goto_compressed' AND state = 'goto_compressed')) "); 594 } 595 else if (clean) { 596 psStringAppend(&whereClause, "\n AND ((data_state = 'goto_lossy' AND state = 'goto_lossy')) "); 597 } 598 else { 599 psStringAppend(&whereClause, "\n AND ((data_state = 'goto_compressed' AND state = 'goto_compressed')\n OR (data_state = 'goto_lossy' AND state = 'goto_lossy')) "); 600 } 586 601 587 602 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 588 603 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 589 604 590 605 psString query = pxDataGet("regtool_pendingcompressimfile.sql"); 591 606 if (!query) { 592 607 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 593 608 return(false); 594 } 609 } 595 610 psString limitString = NULL; 596 611 if (limit) { -
trunk/ippTools/src/regtoolConfig.c
r27176 r27315 381 381 psMetadataAddBool(pendingcompressimfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 382 382 psMetadataAddU64(pendingcompressimfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 383 383 psMetadataAddBool(pendingcompressimfileArgs, PS_LIST_TAIL, "-compress", 0, "search only for files to compress", 0); 384 psMetadataAddBool(pendingcompressimfileArgs, PS_LIST_TAIL, "-clean", 0, "search only for files to clean originals", 0); 384 385 385 386 // -finishcompressexp
Note:
See TracChangeset
for help on using the changeset viewer.
