Changeset 21463 for trunk/ippTools
- Timestamp:
- Feb 13, 2009, 8:51:50 AM (17 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 6 edited
-
chiptool.c (modified) (11 diffs)
-
chiptool.h (modified) (1 diff)
-
chiptoolConfig.c (modified) (2 diffs)
-
faketool.c (modified) (9 diffs)
-
faketool.h (modified) (1 diff)
-
faketoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r21402 r21463 42 42 static bool revertprocessedimfileMode(pxConfig *config); 43 43 static bool updateprocessedimfileMode(pxConfig *config); 44 static bool promoteexpMode(pxConfig *config); 44 45 static bool blockMode(pxConfig *config); 45 46 static bool maskedMode(pxConfig *config); … … 54 55 static bool topurgedimfileMode(pxConfig *config); 55 56 56 static bool chipProcessedCompleteExp(pxConfig *config);57 58 57 # define MODECASE(caseName, func) \ 59 58 case caseName: \ … … 80 79 MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 81 80 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 81 MODECASE(CHIPTOOL_MODE_PROMOTEEXP, promoteexpMode); 82 82 MODECASE(CHIPTOOL_MODE_BLOCK, blockMode); 83 83 MODECASE(CHIPTOOL_MODE_MASKED, maskedMode); … … 495 495 } 496 496 497 #if 0 497 498 // XXX I've decided to make the transaction cover the Exp migration as 498 499 // well. Otherwise, if the last imfile in an exp is moved and the exp … … 508 509 return false; 509 510 } 511 #endif 510 512 511 513 if (!psDBCommit(config->dbh)) { … … 1074 1076 1075 1077 1076 static bool chipProcessedCompleteExp(pxConfig *config)1078 static bool promoteexpMode(pxConfig *config) 1077 1079 { 1078 1080 PS_ASSERT_PTR_NON_NULL(config, false); 1081 1082 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1083 1084 psMetadata *where = psMetadataAlloc(); 1085 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1079 1086 1080 1087 // look for completed chipPendingExp … … 1086 1093 } 1087 1094 1095 if (where && psListLength(where->list)) { 1096 psString whereClause = psDBGenerateWhereSQL(where, NULL); 1097 psStringAppend(&query, " %s", whereClause); 1098 psFree(whereClause); 1099 } 1100 psFree(where); 1101 1102 // treat limit == 0 as "no limit" 1103 if (limit) { 1104 psString limitString = psDBGenerateLimitSQL(limit); 1105 psStringAppend(&query, " %s", limitString); 1106 psFree(limitString); 1107 } 1108 1088 1109 if (!p_psDBRunQuery(config->dbh, query)) { 1089 1110 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1108 1129 1109 1130 chipRunRow *chipRun = chipRunObjectFromMetadata(row); 1131 if (!psDBTransaction(config->dbh)) { 1132 psError(PS_ERR_UNKNOWN, false, "database error"); 1133 return false; 1134 } 1135 1110 1136 // set chipRun.state to 'stop' 1111 1137 if (!pxchipRunSetState(config, chipRun->chip_id, "full")) { … … 1119 1145 // NULL for end_stage means go as far as possible 1120 1146 if (chipRun->end_stage && psStrcasestr(chipRun->end_stage, "chip")) { 1147 if (!psDBCommit(config->dbh)) { 1148 psError(PS_ERR_UNKNOWN, false, "database error"); 1149 return false; 1150 } 1151 1121 1152 psFree(chipRun); 1122 1153 continue; … … 1136 1167 chipRun->end_stage 1137 1168 )) { 1138 // rollback 1139 if (!psDBRollback(config->dbh)) { 1169 if (!psDBRollback(config->dbh)) { 1140 1170 psError(PS_ERR_UNKNOWN, false, "database error"); 1141 1171 } … … 1145 1175 return false; 1146 1176 } 1177 if (!psDBCommit(config->dbh)) { 1178 psError(PS_ERR_UNKNOWN, false, "database error"); 1179 return false; 1180 } 1147 1181 psFree(chipRun); 1148 1182 } -
trunk/ippTools/src/chiptool.h
r19334 r21463 32 32 CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, 33 33 CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, 34 CHIPTOOL_MODE_PROMOTEEXP, 34 35 CHIPTOOL_MODE_BLOCK, 35 36 CHIPTOOL_MODE_MASKED, -
trunk/ippTools/src/chiptoolConfig.c
r21308 r21463 176 176 psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code", 0, "set fault code (required)", 0); 177 177 178 // -promoteexp 179 psMetadata *promoteexpArgs = psMetadataAlloc(); 180 psMetadataAddS64(promoteexpArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID", 0); 181 psMetadataAddStr(promoteexpArgs, PS_LIST_TAIL, "-label", 0, "promote exposures for specified label", NULL); 182 psMetadataAddU64(promoteexpArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 183 178 184 // -block 179 185 psMetadata *blockArgs = psMetadataAlloc(); … … 248 254 PXOPT_ADD_MODE("-updateprocessedimfile","change procesed imfile properties", CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,updateprocessedimfileArgs); 249 255 PXOPT_ADD_MODE("-revertprocessedimfile","undo a processed imfile", CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,revertprocessedimfileArgs); 256 PXOPT_ADD_MODE("-promoteexp", "promote completed exposures", CHIPTOOL_MODE_PROMOTEEXP, promoteexpArgs); 250 257 PXOPT_ADD_MODE("-block", "set a label block", CHIPTOOL_MODE_BLOCK, blockArgs); 251 258 PXOPT_ADD_MODE("-masked", "show blocked labels", CHIPTOOL_MODE_MASKED, maskedArgs); -
trunk/ippTools/src/faketool.c
r21402 r21463 41 41 static bool revertprocessedimfileMode(pxConfig *config); 42 42 static bool updateprocessedimfileMode(pxConfig *config); 43 static bool promoteexpMode(pxConfig *config); 43 44 static bool blockMode(pxConfig *config); 44 45 static bool maskedMode(pxConfig *config); … … 52 53 static bool topurgedimfileMode(pxConfig *config); 53 54 54 static bool fakeProcessedCompleteExp(pxConfig *config);55 56 55 # define MODECASE(caseName, func) \ 57 56 case caseName: \ … … 79 78 MODECASE(FAKETOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 80 79 MODECASE(FAKETOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 80 MODECASE(FAKETOOL_MODE_PROMOTEEXP, promoteexpMode); 81 81 MODECASE(FAKETOOL_MODE_BLOCK, blockMode); 82 82 MODECASE(FAKETOOL_MODE_MASKED, maskedMode); … … 520 520 } 521 521 522 // XXX I've decided to make the transaction cover the Exp migration as523 // well. Otherwise, if the last imfile in an exp is moved and the exp524 // migration fails then the data base is left in a satuation where the exp525 // migration can't happen.526 527 if (!fakeProcessedCompleteExp(config)) {528 // rollback529 if (!psDBRollback(config->dbh)) {530 psError(PS_ERR_UNKNOWN, false, "database error");531 }532 psError(PS_ERR_UNKNOWN, false, "database error");533 return false;534 }535 536 522 if (!psDBCommit(config->dbh)) { 537 523 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1062 1048 } 1063 1049 1064 static bool fakeProcessedCompleteExp(pxConfig *config)1050 static bool promoteexpMode(pxConfig *config) 1065 1051 { 1066 1052 PS_ASSERT_PTR_NON_NULL(config, false); 1053 1054 psMetadata *where = psMetadataAlloc(); 1055 PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "=="); 1056 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1057 1058 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1067 1059 1068 1060 // look for completed fakePendingExp … … 1074 1066 } 1075 1067 1068 if (where && psListLength(where->list)) { 1069 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1070 psStringAppend(&query, " WHERE %s", whereClause); 1071 psFree(whereClause); 1072 } 1073 psFree(where); 1074 1075 // treat limit == 0 as "no limit" 1076 if (limit) { 1077 psString limitString = psDBGenerateLimitSQL(limit); 1078 psStringAppend(&query, " %s", limitString); 1079 psFree(limitString); 1080 } 1081 1076 1082 if (!p_psDBRunQuery(config->dbh, query)) { 1077 1083 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1096 1102 1097 1103 fakeRunRow *fakeRun = fakeRunObjectFromMetadata(row); 1104 if (!psDBTransaction(config->dbh)) { 1105 psError(PS_ERR_UNKNOWN, false, "database error"); 1106 return false; 1107 } 1108 1098 1109 // set fakeRun.state to 'full' 1099 1110 if (!pxfakeRunSetState(config, fakeRun->fake_id, "full")) { 1100 1111 psError(PS_ERR_UNKNOWN, false, "failed to change fakeRun.state for fake_id: %" PRId64, fakeRun->fake_id); 1112 if (!psDBRollback(config->dbh)) { 1113 psError(PS_ERR_UNKNOWN, false, "database error"); 1114 } 1101 1115 psFree(fakeRun); 1102 1116 psFree(output); … … 1104 1118 } 1105 1119 1106 // should we stop here or proceed on to the camstage?1120 // should we stop here or proceed on to the warp stage? 1107 1121 // NULL for end_stage means go as far as possible 1108 1122 if ((fakeRun->end_stage && psStrcasestr(fakeRun->end_stage, "fake")) || !fakeRun->tess_id) { 1109 1123 psFree(fakeRun); 1124 if (!psDBCommit(config->dbh)) { 1125 psError(PS_ERR_UNKNOWN, false, "database error"); 1126 return false; 1127 } 1110 1128 continue; 1111 1129 } 1112 1130 // else continue on... 1113 1131 1114 // camQueueFakeID() can only be run after fakeRun.state has been set to 1115 // stop 1132 // pxwarpQueueByFakeID() can only be run after fakeRun.state has been set to stop 1116 1133 if (!pxwarpQueueByFakeID(config, 1117 1134 fakeRun->fake_id, … … 1122 1139 fakeRun->end_stage 1123 1140 )) { 1124 psError(PS_ERR_UNKNOWN, false, "failed to queue camPendingExp"); 1141 psError(PS_ERR_UNKNOWN, false, "failed to queue warpRun"); 1142 if (!psDBRollback(config->dbh)) { 1143 psError(PS_ERR_UNKNOWN, false, "database error"); 1144 } 1125 1145 psFree(fakeRun); 1126 1146 psFree(output); 1147 return false; 1148 } 1149 if (!psDBCommit(config->dbh)) { 1150 psError(PS_ERR_UNKNOWN, false, "database error"); 1151 psFree(fakeRun); 1127 1152 return false; 1128 1153 } -
trunk/ippTools/src/faketool.h
r19702 r21463 33 33 FAKETOOL_MODE_REVERTPROCESSEDIMFILE, 34 34 FAKETOOL_MODE_UPDATEPROCESSEDIMFILE, 35 FAKETOOL_MODE_PROMOTEEXP, 35 36 FAKETOOL_MODE_BLOCK, 36 37 FAKETOOL_MODE_MASKED, -
trunk/ippTools/src/faketoolConfig.c
r19931 r21463 241 241 psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-code", 0, "search by fault code", 0); 242 242 243 244 // -promoteexp 245 psMetadata *promoteexpArgs = psMetadataAlloc(); 246 psMetadataAddS64(promoteexpArgs, PS_LIST_TAIL, "-fake_id", 0, "search by fake ID", 0); 247 psMetadataAddStr(promoteexpArgs, PS_LIST_TAIL, "-label", 0, "search by label ", NULL); 248 psMetadataAddU64(promoteexpArgs, PS_LIST_TAIL, "-limit", 0, "limit exposures to promote to N items", 0); 249 243 250 // -block 244 251 psMetadata *blockArgs = psMetadataAlloc(); … … 307 314 PXOPT_ADD_MODE("-updateprocessedimfile","change procesed imfile properties", FAKETOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileArgs); 308 315 PXOPT_ADD_MODE("-revertprocessedimfile", "undo a processed imfile", FAKETOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileArgs); 316 PXOPT_ADD_MODE("-promoteexp", "promote completed exposoures", FAKETOOL_MODE_PROMOTEEXP, promoteexpArgs); 309 317 PXOPT_ADD_MODE("-block", "set a label block", FAKETOOL_MODE_BLOCK, blockArgs); 310 318 PXOPT_ADD_MODE("-masked", "show blocked labels", FAKETOOL_MODE_MASKED, maskedArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
