Changeset 27838 for branches/tap_branches/ippTools/src/magictool.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/magictool.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/ippTools/src
- Property svn:ignore
-
old new 16 16 difftool 17 17 disttool 18 dqstatstool 18 19 faketool 19 20 flatcorr
-
- Property svn:ignore
-
branches/tap_branches/ippTools/src/magictool.c
r25844 r27838 114 114 // Required 115 115 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", false, false); 116 PXOPT_LOOKUP_STR(label, config->args, "-label", true, false); 116 117 117 118 // Optional 118 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);119 119 PXOPT_LOOKUP_STR(data_group, config->args, "-data_group", false, false); 120 120 PXOPT_LOOKUP_STR(note, config->args, "-note", false, false); … … 135 135 psString query = pxDataGet("magictool_definebyquery_select.sql"); 136 136 if (!query) { 137 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");137 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 138 138 return false; 139 139 } … … 151 151 // what if no skycells for the diff run completed? 152 152 153 if (!rerun) { 154 psStringAppend(&queryWhereStr, "\n%s magic_id IS NULL", queryWhereStr ? "AND" : "WHERE"); 153 psStringAppend(&queryWhereStr, "\n%s magic_id IS NULL", queryWhereStr ? "AND" : "WHERE"); 154 psString rerunWhereStr = NULL; 155 if (rerun) { 156 psStringAppend(&rerunWhereStr, "\n WHERE magicRun.label = '%s'", label); 155 157 } 156 158 … … 176 178 queryWhereStr = psStringCopy(""); 177 179 } 178 179 if (!p_psDBRunQueryF(config->dbh, query, diffWhereStr, diffWhereStr, queryWhereStr)) { 180 if (!rerunWhereStr) { 181 rerunWhereStr = psStringCopy(""); 182 } 183 184 if (!p_psDBRunQueryF(config->dbh, query, diffWhereStr, diffWhereStr, rerunWhereStr, queryWhereStr)) { 180 185 psError(PS_ERR_UNKNOWN, false, "database error"); 181 186 psFree(diffWhereStr); 182 187 psFree(queryWhereStr); 188 psFree(rerunWhereStr); 183 189 psFree(query); 184 190 return false; … … 186 192 psFree(diffWhereStr); 187 193 psFree(queryWhereStr); 194 psFree(rerunWhereStr); 188 195 psFree(query); 189 196 } … … 427 434 psString query = pxDataGet("magictool_inputskyfile.sql"); 428 435 if (!query) { 429 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");436 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 430 437 return false; 431 438 } … … 500 507 psString query = pxDataGet("magictool_totree.sql"); 501 508 if (!query) { 502 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");509 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 503 510 return false; 504 511 } … … 573 580 574 581 if (fault > 0) { 575 char *query = "UPDATE magicRun SET fault = %d , state = 'full'WHERE magic_id = %" PRId64;582 char *query = "UPDATE magicRun SET fault = %d WHERE magic_id = %" PRId64; 576 583 if (!p_psDBRunQueryF(config->dbh, query, fault, magic_id)) { 577 584 psError(PS_ERR_UNKNOWN, false, … … 612 619 return false; 613 620 } 621 psS32 numUpdated = psDBAffectedRows(config->dbh); 622 psLogMsg("magictool", PS_LOG_INFO, "Reverted %d magic runs", numUpdated); 623 614 624 return true; 615 625 } … … 635 645 psString query = pxDataGet("magictool_inputs.sql"); 636 646 if (!query) { 637 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");647 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 638 648 return false; 639 649 } … … 805 815 psString query = pxDataGet("magictool_toprocess_inputs.sql"); 806 816 if (!query) { 807 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");817 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 808 818 return false; 809 819 } … … 867 877 868 878 // look for tree nodes that need to be processed 879 880 // first find incomplete magicRuns 869 881 query = pxDataGet("magictool_toprocess_runs.sql"); 870 882 if (!query) { 871 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 872 return false; 873 } 874 883 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 884 return false; 885 } 886 887 // we limit the query even though it is cheap (only magic_id is selected) 888 889 // XXX: if the first 1000 unfinished magicRuns have no ready nodes 890 // that haven't faulted, later runs won't get returned even though 891 // they have work to do. When we used a limit of 100 we actually ran 892 // into this problem. Since we're using labels a limit of 1000 will 893 // probably be ok. 875 894 { 876 psString limitString = psDBGenerateLimitSQL( 100 );895 psString limitString = psDBGenerateLimitSQL( 1000 ); 877 896 psStringAppend(&query, " %s", limitString); 878 897 psFree(limitString); … … 910 929 query = pxDataGet("magictool_toprocess_tree.sql"); 911 930 if (!query) { 912 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");931 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 913 932 return false; 914 933 } … … 923 942 psAbort("failed to lookup value for magic_id column"); 924 943 } 925 944 926 945 whereString = NULL; 927 946 psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id); … … 1041 1060 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 1042 1061 PXOPT_COPY_STR(config->args, where, "-node", "node", "=="); 1043 PXOPT_COPY_STR(config->args, where, "-label", "label", "==");1044 1062 PXOPT_COPY_S16(config->args, where, "-fault", "magicNodeResult.fault", "=="); 1063 pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "=="); 1045 1064 1046 1065 psString query = pxDataGet("magictool_revertnode.sql"); 1047 1066 if (!query) { 1048 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1067 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1049 1068 return false; 1050 1069 } … … 1067 1086 1068 1087 psS32 numUpdated = psDBAffectedRows(config->dbh); 1069 psLogMsg("magictool", PS_LOG_INFO, " Updated %d magic nodes", numUpdated);1088 psLogMsg("magictool", PS_LOG_INFO, "Reverted %d magic nodes", numUpdated); 1070 1089 1071 1090 return true; … … 1083 1102 psString query = pxDataGet("magictool_tomask.sql"); 1084 1103 if (!query) { 1085 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1104 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1086 1105 return false; 1087 1106 } … … 1171 1190 psString query = pxDataGet("magictool_addmask.sql"); 1172 1191 if (!query) { 1173 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1192 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1174 1193 if (!psDBRollback(config->dbh)) { 1175 1194 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1278 1297 psString query = pxDataGet("magictool_mask.sql"); 1279 1298 if (!query) { 1280 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1299 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1281 1300 return false; 1282 1301 }
Note:
See TracChangeset
for help on using the changeset viewer.
