Changeset 19334
- Timestamp:
- Sep 2, 2008, 2:05:26 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/chip.md (modified) (1 diff)
-
ippTasks/chip.pro (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/chiptool_change_exp_state.sql (added)
-
ippTools/share/chiptool_change_imfile_data_state.sql (added)
-
ippTools/share/chiptool_pendingcleanupimfile.sql (modified) (1 diff)
-
ippTools/share/chiptool_pendingimfile.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (2 diffs)
-
ippTools/src/chiptool.c (modified) (7 diffs)
-
ippTools/src/chiptool.h (modified) (1 diff)
-
ippTools/src/chiptoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/changes.txt
r19323 r19334 423 423 424 424 -- ALTER TABLE flatcorrCamLink ADD COLUMN chip_id BIGINT AFTER corr_id; 425 426 ALTER TABLE chipProcessedImfile ADD COLUMN data_state VARCHAR(64) AFTER 427 class_id; 428 UPDATE chipProcessedImfile SET data_state = 'full'; -
trunk/dbconfig/chip.md
r16253 r19334 17 17 exp_id S64 64 # Primary Key fkey (exp_id, class_id) ref rawImfile(exp_id, class_id) 18 18 class_id STR 64 # Primary Key 19 data_state STR 64 # Key 19 20 uri STR 255 20 21 bg F32 0.0 -
trunk/ippTasks/chip.pro
r19179 r19334 130 130 book getword chipPendingImfile $pageName dbname -var DBNAME 131 131 book getword chipPendingImfile $pageName reduction -var REDUCTION 132 #book getword chipPendingImfile $pageName state -var RUN_STATE132 book getword chipPendingImfile $pageName state -var RUN_STATE 133 133 134 134 # specify choice of local or remote host based on camera and chip (class_id) … … 153 153 154 154 # XXX EAM : use this line for update processing 155 #$run = chip_imfile.pl --threads @MAX_THREADS@ --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --uri $URI --camera $CAMERA --run-state $RUN_STATE --outroot $outroot --redirect-output156 $run = chip_imfile.pl --threads @MAX_THREADS@ --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --uri $URI --camera $CAMERA --outroot $outroot --redirect-output155 $run = chip_imfile.pl --threads @MAX_THREADS@ --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --uri $URI --camera $CAMERA --run-state $RUN_STATE --outroot $outroot --redirect-output 156 # $run = chip_imfile.pl --threads @MAX_THREADS@ --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --uri $URI --camera $CAMERA --outroot $outroot --redirect-output 157 157 if ("$REDUCTION" != "NULL") 158 158 $run = $run --reduction $REDUCTION -
trunk/ippTools/share/Makefile.am
r19325 r19334 10 10 camtool_reset_faulted_runs.sql \ 11 11 camtool_revertprocessedexp.sql \ 12 chiptool_change_exp_state.sql \ 13 chiptool_change_imfile_data_state.sql \ 12 14 chiptool_completely_processed_exp.sql \ 13 15 chiptool_donecleanup.sql \ -
trunk/ippTools/share/chiptool_pendingcleanupimfile.sql
r18366 r19334 14 14 WHERE 15 15 chipRun.state = 'goto_cleaned' 16 AND chipProcessedImfile.data_state = 'full' -
trunk/ippTools/share/chiptool_pendingimfile.sql
r19181 r19334 20 20 ON chipRun.label = chipMask.label 21 21 WHERE 22 chipRun.state = 'new'22 (chipRun.state = 'new' 23 23 AND chipProcessedImfile.chip_id IS NULL 24 24 AND chipProcessedImfile.exp_id IS NULL 25 25 AND chipProcessedImfile.class_id IS NULL 26 AND chipMask.label IS NULL 27 28 -- new where logic for update. we probably need to add a 'data_state' 29 -- field to chipProcessedImfile and update it (full, cleaned, etc) as 30 -- we cleanup or update 31 -- (chipRun.state = 'new' 32 -- AND chipProcessedImfile.chip_id IS NULL 33 -- AND chipProcessedImfile.exp_id IS NULL 34 -- AND chipProcessedImfile.class_id IS NULL 35 -- AND chipMask.label IS NULL) 36 -- OR 37 -- (chipRun.state = 'update' 38 -- AND chipProcessedImfile.data_state = 'cleaned' 26 AND chipMask.label IS NULL) 27 OR 28 (chipRun.state = 'update' 29 AND chipProcessedImfile.data_state = 'cleaned') -
trunk/ippTools/share/pxadmin_create_tables.sql
r19325 r19334 261 261 exp_id BIGINT, 262 262 class_id VARCHAR(64), 263 data_state VARCHAR(64), 263 264 uri VARCHAR(255), 264 265 bg FLOAT, … … 289 290 fault SMALLINT NOT NULL, 290 291 PRIMARY KEY(chip_id, exp_id, class_id), 292 KEY(data_state), 291 293 KEY(fault), 292 294 FOREIGN KEY (chip_id, exp_id) -
trunk/ippTools/src/chiptool.c
r19324 r19334 50 50 static bool donecleanupMode(pxConfig *config); 51 51 static bool runMode(pxConfig *config); 52 static bool tocleanedimfileMode(pxConfig *config); 53 static bool tofullimfileMode(pxConfig *config); 54 static bool topurgedimfileMode(pxConfig *config); 52 55 53 56 static bool chipProcessedCompleteExp(pxConfig *config); … … 76 79 MODECASE(CHIPTOOL_MODE_PROCESSEDIMFILE, processedimfileMode); 77 80 MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 78 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode);81 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 79 82 MODECASE(CHIPTOOL_MODE_BLOCK, blockMode); 80 83 MODECASE(CHIPTOOL_MODE_MASKED, maskedMode); … … 85 88 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 86 89 MODECASE(CHIPTOOL_MODE_RUN, runMode); 90 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileMode); 91 MODECASE(CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileMode); 92 MODECASE(CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileMode); 87 93 default: 88 94 psAbort("invalid option (this should not happen)"); … … 334 340 PS_ASSERT_PTR_NON_NULL(config, false); 335 341 336 // chip_id, ex t_tag, class_id are required342 // chip_id, exp_tag, class_id are required 337 343 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 338 344 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); … … 379 385 exp_id, 380 386 class_id, 387 "full", 381 388 uri, 382 389 bg, … … 417 424 // XXX I've decided to make the transaction cover the Exp migration as 418 425 // well. Otherwise, if the last imfile in an exp is moved and the exp 419 // migration fails then the data base is left in a s atuation where the exp426 // migration fails then the data base is left in a situation where the exp 420 427 // migration can't happen. 421 428 … … 1069 1076 return true; 1070 1077 } 1078 1079 // update chipProcessedImfile.data_state to given value. 1080 // afterwards, if all imfiles in the exposure have the new state, update the state for the exposure as well 1081 // shared code for the modes -tocleanedimfile -tofullimfile -topurgedimfile 1082 1083 static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state) 1084 { 1085 PS_ASSERT_PTR_NON_NULL(config, false); 1086 1087 // chip_id, class_id are required 1088 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 1089 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1090 1091 psString query = pxDataGet("chiptool_change_imfile_data_state.sql"); 1092 1093 if (!psDBTransaction(config->dbh)) { 1094 psError(PS_ERR_UNKNOWN, false, "database error"); 1095 return false; 1096 } 1097 1098 // note only updates if chipRun.state = run_state 1099 if (!p_psDBRunQuery(config->dbh, query, data_state, chip_id, class_id, run_state)) { 1100 psError(PS_ERR_UNKNOWN, false, "database error"); 1101 // rollback 1102 if (!psDBRollback(config->dbh)) { 1103 psError(PS_ERR_UNKNOWN, false, "database error"); 1104 } 1105 psError(PS_ERR_UNKNOWN, false, "database error"); 1106 return false; 1107 } 1108 psFree(query); 1109 1110 // XXX Comment copied from addpendingimfile 1111 // I've decided to make the transaction cover the Exp migration as 1112 // well. Otherwise, if the last imfile in an exp is moved and the exp 1113 // migration fails then the data base is left in a situation where the exp 1114 // migration can't happen. 1115 1116 query = pxDataGet("chiptool_change_exp_state.sql"); 1117 if (!p_psDBRunQuery(config->dbh, query, data_state, chip_id, data_state)) { 1118 // rollback 1119 if (!psDBRollback(config->dbh)) { 1120 psError(PS_ERR_UNKNOWN, false, "database error"); 1121 } 1122 psError(PS_ERR_UNKNOWN, false, "database error"); 1123 return false; 1124 } 1125 1126 if (!psDBCommit(config->dbh)) { 1127 psError(PS_ERR_UNKNOWN, false, "database error"); 1128 return false; 1129 } 1130 1131 return true; 1132 } 1133 static bool tocleanedimfileMode(pxConfig *config) 1134 { 1135 return change_imfile_data_state(config, "cleaned", "goto_cleaned"); 1136 } 1137 static bool tofullimfileMode(pxConfig *config) 1138 { 1139 return change_imfile_data_state(config, "full", "update"); 1140 } 1141 static bool topurgedimfileMode(pxConfig *config) 1142 { 1143 return change_imfile_data_state(config, "purged", "goto_purged"); 1144 } -
trunk/ippTools/src/chiptool.h
r18366 r19334 40 40 CHIPTOOL_MODE_PENDINGCLEANUPIMFILE, 41 41 CHIPTOOL_MODE_DONECLEANUP, 42 CHIPTOOL_MODE_RUN 42 CHIPTOOL_MODE_RUN, 43 CHIPTOOL_MODE_TOCLEANEDIMFILE, 44 CHIPTOOL_MODE_TOFULLIMFILE, 45 CHIPTOOL_MODE_TOPURGEDIMFILE 43 46 } chiptoolMode; 44 47 -
trunk/ippTools/src/chiptoolConfig.c
r19324 r19334 177 177 psMetadataAddStr(runArgs, PS_LIST_TAIL, "-state", 0, "search by state (required)", NULL); 178 178 179 // -tocleanedimfile 180 psMetadata *tocleanedimfileArgs = psMetadataAlloc(); 181 psMetadataAddS64(tocleanedimfileArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0); 182 psMetadataAddStr(tocleanedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 183 184 // -tofullimfile 185 psMetadata *tofullimfileArgs = psMetadataAlloc(); 186 psMetadataAddS64(tofullimfileArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0); 187 psMetadataAddStr(tofullimfileArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 188 189 // -topurgedimfile 190 psMetadata *topurgedimfileArgs = psMetadataAlloc(); 191 psMetadataAddS64(topurgedimfileArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0); 192 psMetadataAddStr(topurgedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 193 179 194 psMetadata *argSets = psMetadataAlloc(); 180 195 psMetadata *modes = psMetadataAlloc(); … … 195 210 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", CHIPTOOL_MODE_DONECLEANUP, donecleanupArgs); 196 211 PXOPT_ADD_MODE("-run", "show runs", CHIPTOOL_MODE_RUN, runArgs); 212 PXOPT_ADD_MODE("-tocleanedimfile", "set imfile state to cleaned", CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileArgs); 213 PXOPT_ADD_MODE("-tofullimfile", "set imfile state to full", CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileArgs); 214 PXOPT_ADD_MODE("-topurgdimfile", "set imfile state to purged", CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileArgs); 197 215 198 216 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Note:
See TracChangeset
for help on using the changeset viewer.
