- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (2 props)
-
ippTools/src/chiptool.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippTools/src
- Property svn:ignore
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110710/ippTools/src (added) merged: 32337 /branches/eam_branches/ipp-20110906/ippTools/src (added) merged: 32630 /branches/eam_branches/ipp-20111110/ippTools/src (added) merged: 32694 /branches/haf_add201112/ippTools/src (added) merged: 32980,32986,33003,33023,33027
-
branches/meh_branches/ppstack_test/ippTools/src/chiptool.c
r31954 r33415 43 43 static bool revertprocessedimfileMode(pxConfig *config); 44 44 static bool updateprocessedimfileMode(pxConfig *config); 45 static bool dropprocessedimfileMode(pxConfig *config); 45 46 static bool advanceexpMode(pxConfig *config); 46 47 static bool blockMode(pxConfig *config); … … 88 89 MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 89 90 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 91 MODECASE(CHIPTOOL_MODE_DROPPROCESSEDIMFILE, dropprocessedimfileMode); 90 92 MODECASE(CHIPTOOL_MODE_ADVANCEEXP, advanceexpMode); 91 93 MODECASE(CHIPTOOL_MODE_BLOCK, blockMode); … … 196 198 GET_VALUE (psS64, S64, exp_id, "exp_id"); 197 199 GET_VALUE (psString, Str, raw_workdir, "workdir"); 200 #ifdef notyet 201 GET_VALUE (psString, Str, old_workdir, "old_workdir"); 202 GET_VALUE (psString, Str, old_data_group, "old_data_group"); 203 #else 204 const char *old_workdir = NULL; 205 const char *old_data_group = NULL; 206 #endif 198 207 GET_VALUE (psString, Str, raw_label, "label"); 199 208 GET_VALUE (psString, Str, raw_reduction, "reduction"); … … 211 220 if (!pxchipQueueByExpTag(config, 212 221 exp_id, 213 workdir ? workdir : raw_workdir,222 workdir ? workdir : (old_workdir ? old_workdir : raw_workdir), 214 223 label ? label : raw_label, 215 data_group ? data_group : ( label ? label : raw_label),224 data_group ? data_group : (old_data_group ? old_data_group : (label ? label : raw_label)), 216 225 dist_group, 217 226 reduction ? reduction : raw_reduction, … … 343 352 pxAddLabelSearchArgs (config, where, "-label", "chipOld.label", "LIKE"); 344 353 pxAddLabelSearchArgs (config, where, "-data_group", "chipOld.data_group", "LIKE"); 354 PXOPT_COPY_STR(config->args, where, "-state", "chipOld.state", "=="); 345 355 346 356 // psListLength(where->list) is at least 1 because exp_type defaults to "object" … … 352 362 } 353 363 354 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", true, false);364 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false); 355 365 PXOPT_LOOKUP_STR(label, config->args, "-set_label", true, false); 356 366 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); … … 466 476 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "=="); 467 477 pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "=="); 478 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "=="); 468 479 469 480 psString query = pxDataGet("chiptool_pendingimfile.sql"); … … 883 894 } 884 895 psFree(query); 896 int numDeleted = psDBAffectedRows(config->dbh); 897 psLogMsg("chiptool", PS_LOG_INFO, "Deleted %d chipProcessedImfiles", numDeleted); 885 898 886 899 if (!fault) { … … 896 909 } 897 910 psFree(query_update); 911 int numUpdated = psDBAffectedRows(config->dbh); 912 psLogMsg("chiptool", PS_LOG_INFO, "Updated %d chipProcessedImfiles", numUpdated); 913 898 914 899 915 return true; … … 962 978 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 963 979 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 964 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, NULL);980 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 965 981 if (psListLength(where->list) == 0) { 966 982 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); … … 986 1002 987 1003 1004 return true; 1005 } 1006 1007 // "drop" previously processed components as though the original processing 1008 // had poor quality. Sets quality, data_state, clears fault and magicked 1009 // Deletes corresponding magicDSFile (if one exists) 1010 static bool dropprocessedimfileMode(pxConfig *config) 1011 { 1012 PS_ASSERT_PTR_NON_NULL(config, false); 1013 1014 psMetadata *where = psMetadataAlloc(); 1015 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "=="); 1016 PXOPT_COPY_STR(config->args, where, "-class_id", "chipProcessedImfile.class_id", "=="); 1017 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 1018 PXOPT_LOOKUP_S64(class_id, config->args, "-class_id", true, false); 1019 PXOPT_LOOKUP_S16(quality, config->args, "-set_quality", true, false); 1020 1021 if (!quality) { 1022 psError(PXTOOLS_ERR_CONFIG, true, "non-zero quality value is required"); 1023 return false; 1024 } 1025 1026 if (psListLength(where->list) == 0) { 1027 // won't get here 1028 psError(PXTOOLS_ERR_CONFIG, true, "-chip_id and -class_id are required"); 1029 return false; 1030 } 1031 1032 psString query = pxDataGet("chiptool_dropprocessedimfile_update.sql"); 1033 if (!query) { 1034 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1035 return false; 1036 } 1037 psString delete_query = pxDataGet("chiptool_dropprocessedimfile_delete.sql"); 1038 if (!delete_query) { 1039 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1040 return false; 1041 } 1042 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1043 psStringAppend(&query, " WHERE %s", whereClause); 1044 psFree(where); 1045 1046 if (!psDBTransaction(config->dbh)) { 1047 psError(PS_ERR_UNKNOWN, false, "database error"); 1048 return false; 1049 } 1050 if (!p_psDBRunQueryF(config->dbh, query, quality)) { 1051 if (!psDBRollback(config->dbh)) { 1052 psError(PS_ERR_UNKNOWN, false, "database error on rollback"); 1053 } 1054 psError(PS_ERR_UNKNOWN, false, "database error"); 1055 psFree(query); 1056 return false; 1057 } 1058 psFree(query); 1059 1060 psStringAppend(&delete_query, " AND %s", whereClause); 1061 psFree(whereClause); 1062 if (!p_psDBRunQuery(config->dbh, delete_query)) { 1063 if (!psDBRollback(config->dbh)) { 1064 psError(PS_ERR_UNKNOWN, false, "database error on rollback"); 1065 } 1066 psError(PS_ERR_UNKNOWN, false, "database error"); 1067 psFree(delete_query); 1068 return false; 1069 } 1070 psFree(delete_query); 1071 1072 if (!psDBCommit(config->dbh)) { 1073 psError(PS_ERR_UNKNOWN, false, "database error"); 1074 return false; 1075 } 988 1076 return true; 989 1077 } … … 1418 1506 psMetadata *where = psMetadataAlloc(); 1419 1507 pxAddLabelSearchArgs (config, where, "-label", "label", "=="); 1420 1508 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 1421 1509 // look for completed chipPendingExp 1422 1510 // migrate them to chipProccessedExp & camPendingExp … … 1432 1520 psFree(whereClause); 1433 1521 } 1522 1523 psTrace("chiptool", 10, "%s\n", query); 1434 1524 psFree(where); 1435 1525 … … 1943 2033 return false; 1944 2034 } 1945 1946 2035 psFree(setHook); 1947 2036 psFree(query); 2037 2038 // if we are updating a whole chipRun set lingering chips with poor quality to full data_state 2039 if (!class_id) { 2040 query = "UPDATE chipProcessedImfile SET data_state ='full', fault = 0 WHERE chip_id = %" PRId64 " AND quality != 0 AND (data_state ='cleaned' OR data_state = 'update')"; 2041 2042 if (!p_psDBRunQueryF(config->dbh, query, chip_id)) { 2043 psError(PS_ERR_UNKNOWN, false, "database error"); 2044 return false; 2045 } 2046 } 1948 2047 1949 2048 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
