Changeset 17863
- Timestamp:
- May 30, 2008, 11:03:23 AM (18 years ago)
- Location:
- branches/cleanup/ippTools
- Files:
-
- 2 added
- 17 edited
-
scripts/regtest.sh (modified) (2 diffs)
-
share/Makefile.am (modified) (1 diff)
-
share/camtool_find_chip_id.sql (modified) (1 diff)
-
share/camtool_find_pendingexp.sql (modified) (1 diff)
-
share/camtool_queue_chip_id.sql (modified) (1 diff)
-
share/chiptool_pendingcleanup.sql (modified) (1 diff)
-
share/chiptool_pendingimfile.sql (modified) (1 diff)
-
share/chiptool_run.sql (added)
-
share/flatcorr_completely_processed_chiprun.sql (modified) (1 diff)
-
share/flatcorr_find_processedimfiles.sql (modified) (1 diff)
-
share/flatcorr_pending.sql (modified) (1 diff)
-
src/Makefile.am (modified) (1 diff)
-
src/chiptool.c (modified) (4 diffs)
-
src/chiptool.h (modified) (1 diff)
-
src/chiptoolConfig.c (modified) (2 diffs)
-
src/pxchip.c (modified) (4 diffs)
-
src/pxchip.h (modified) (1 diff)
-
src/pxtools.c (added)
-
src/pxtools.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/cleanup/ippTools/scripts/regtest.sh
r15776 r17863 33 33 $regtool -pendingexp|| exit 1 34 34 35 $regtool -addprocessedexp -exp_id $exp_id1 -exp_name t10 -inst gpc -telescope ps1 -exp_tag batman.t10 -filelevel OTA -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias-exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 -object dog -dateobs "2006-10-20T10:10:10Z" -label foobar $* || exit 135 $regtool -addprocessedexp -exp_id $exp_id1 -exp_name t10 -inst gpc -telescope ps1 -exp_tag batman.t10 -filelevel OTA -filter r -airmass 10 -ra 1 -decl 2 -exp_type object -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 -object dog -dateobs "2006-10-20T10:10:10Z" -label foobar $* || exit 1 36 36 37 37 $regtool -pendingimfile || exit 1 … … 43 43 $regtool -pendingexp|| exit 1 44 44 45 $regtool -addprocessedexp -exp_id $exp_id2 -exp_name t11 -inst gpc -telescope ps1 -exp_tag batman.t11 -filelevel OTA -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias-exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 -object dog -dateobs 2006-10-20T10:10:10Z -label foobar $* || exit 145 $regtool -addprocessedexp -exp_id $exp_id2 -exp_name t11 -inst gpc -telescope ps1 -exp_tag batman.t11 -filelevel OTA -filter r -airmass 11 -ra 1 -decl 2 -exp_type object -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 -object dog -dateobs 2006-10-20T10:10:10Z -label foobar $* || exit 1 -
branches/cleanup/ippTools/share/Makefile.am
r17859 r17863 14 14 chiptool_pendingimfile.sql \ 15 15 chiptool_processedimfile.sql \ 16 chiptool_run.sql \ 16 17 chiptool_revertprocessedimfile.sql \ 17 18 chiptool_unmasked.sql \ -
branches/cleanup/ippTools/share/camtool_find_chip_id.sql
r14227 r17863 29 29 using(exp_id) 30 30 WHERE 31 chipRun.state = ' stop') as Foo31 chipRun.state = 'full') as Foo -
branches/cleanup/ippTools/share/camtool_find_pendingexp.sql
r15956 r17863 24 24 ON camRun.label = camMask.label 25 25 WHERE 26 chipRun.state = ' stop'26 chipRun.state = 'full' 27 27 AND camRun.state = 'run' 28 28 AND camMask.label IS NULL -
branches/cleanup/ippTools/share/camtool_queue_chip_id.sql
r16170 r17863 16 16 FROM chipRun 17 17 WHERE 18 chipRun.state = ' stop'18 chipRun.state = 'full' 19 19 AND chipRun.chip_id = %lld -
branches/cleanup/ippTools/share/chiptool_pendingcleanup.sql
r17859 r17863 3 3 FROM chipRun 4 4 WHERE 5 chipRun.state = 'goto_clean '5 chipRun.state = 'goto_cleaned' -
branches/cleanup/ippTools/share/chiptool_pendingimfile.sql
r14065 r17863 20 20 ON chipRun.label = chipMask.label 21 21 WHERE 22 chipRun.state = ' run'22 chipRun.state = 'new' 23 23 AND chipProcessedImfile.chip_id IS NULL 24 24 AND chipProcessedImfile.exp_id IS NULL -
branches/cleanup/ippTools/share/flatcorr_completely_processed_chiprun.sql
r15769 r17863 26 26 AND rawImfile.class_id = chipProcessedImfile.class_id 27 27 WHERE 28 chipRun.state = ' stop'28 chipRun.state = 'full' 29 29 GROUP BY 30 30 chipRun.chip_id, -
branches/cleanup/ippTools/share/flatcorr_find_processedimfiles.sql
r15755 r17863 11 11 WHERE 12 12 flatcorrRun.state = 'run' 13 AND chipRun.state = ' stop'13 AND chipRun.state = 'new' 14 14 -
branches/cleanup/ippTools/share/flatcorr_pending.sql
r15769 r17863 15 15 WHERE 16 16 flatcorrRun.state = 'run' 17 AND chipRun.state = ' stop'17 AND chipRun.state = 'full' 18 18 GROUP BY 19 19 chipRun.chip_id, -
branches/cleanup/ippTools/src/Makefile.am
r17856 r17863 69 69 pxregister.c \ 70 70 pxtag.c \ 71 pxtools.c \ 71 72 pxtoolsErrorCodes.c \ 72 73 pxtree.c \ -
branches/cleanup/ippTools/src/chiptool.c
r17859 r17863 47 47 static bool pendingcleanupMode(pxConfig *config); 48 48 static bool donecleanupMode(pxConfig *config); 49 static bool runMode(pxConfig *config); 49 50 50 51 static bool chipProcessedCompleteExp(pxConfig *config); … … 80 81 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUP, pendingcleanupMode); 81 82 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 83 MODECASE(CHIPTOOL_MODE_RUN, runMode); 82 84 default: 83 85 psAbort("invalid option (this should not happen)"); … … 1074 1076 1075 1077 1078 static bool runMode(pxConfig *config) 1079 { 1080 PS_ASSERT_PTR_NON_NULL(config, NULL); 1081 1082 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 1083 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1084 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1085 1086 // make sure that the state string is valid 1087 if (!pxIsValidState(state)) { 1088 psError(PXTOOLS_ERR_DATA, false, "%s is not a valid state", state); 1089 return false; 1090 } 1091 1092 psMetadata *where = psMetadataAlloc(); 1093 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1094 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 1095 1096 psString query = pxDataGet("chiptool_run.sql"); 1097 if (!query) { 1098 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1099 return false; 1100 } 1101 1102 if (where && psListLength(where->list)) { 1103 psString whereClause = psDBGenerateWhereSQL(where, NULL); 1104 psStringAppend(&query, " %s", whereClause); 1105 psFree(whereClause); 1106 } 1107 psFree(where); 1108 1109 // treat limit == 0 as "no limit" 1110 if (limit) { 1111 psString limitString = psDBGenerateLimitSQL(limit); 1112 psStringAppend(&query, " %s", limitString); 1113 psFree(limitString); 1114 } 1115 1116 if (!p_psDBRunQuery(config->dbh, query)) { 1117 psError(PS_ERR_UNKNOWN, false, "database error"); 1118 psFree(query); 1119 return false; 1120 } 1121 psFree(query); 1122 1123 psArray *output = p_psDBFetchResult(config->dbh); 1124 if (!output) { 1125 psError(PS_ERR_UNKNOWN, false, "database error"); 1126 return false; 1127 } 1128 if (!psArrayLength(output)) { 1129 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 1130 psFree(output); 1131 return true; 1132 } 1133 1134 if (!convertIdToStr(output)) { 1135 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 1136 psFree(output); 1137 return false; 1138 } 1139 1140 // negative simple so the default is true 1141 if (!ippdbPrintMetadatas(stdout, output, "chipDoneCleanup", !simple)) { 1142 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1143 psFree(output); 1144 return false; 1145 } 1146 1147 psFree(output); 1148 1149 return true; 1150 } 1151 1152 1076 1153 static bool chipProcessedCompleteExp(pxConfig *config) 1077 1154 { … … 1109 1186 chipRunRow *chipRun = chipRunObjectFromMetadata(row); 1110 1187 // set chipRun.state to 'stop' 1111 if (!pxchipRunSetState(config, chipRun->chip_id, " stop")) {1188 if (!pxchipRunSetState(config, chipRun->chip_id, "full")) { 1112 1189 psError(PS_ERR_UNKNOWN, false, "failed to change chipRun.state for chip_id: %" PRId64, chipRun->chip_id); 1113 1190 psFree(chipRun); -
branches/cleanup/ippTools/src/chiptool.h
r17859 r17863 39 39 CHIPTOOL_MODE_PENDINGCLEANUP, 40 40 CHIPTOOL_MODE_DONECLEANUP, 41 CHIPTOOL_MODE_RUN 41 42 } chiptoolMode; 42 43 -
branches/cleanup/ippTools/src/chiptoolConfig.c
r17859 r17863 283 283 psMetadataAddU64(donecleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 284 284 285 // -run 286 psMetadata *runArgs = psMetadataAlloc(); 287 psMetadataAddStr(runArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL); 288 psMetadataAddBool(runArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 289 psMetadataAddU64(runArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 290 psMetadataAddStr(runArgs, PS_LIST_TAIL, "-state", 0, "search by state (required)", NULL); 291 285 292 psMetadata *argSets = psMetadataAlloc(); 286 293 psMetadata *modes = psMetadataAlloc(); … … 312 319 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", 313 320 CHIPTOOL_MODE_DONECLEANUP, donecleanupArgs); 321 PXOPT_ADD_MODE("-run", "show runs", 322 CHIPTOOL_MODE_RUN, runArgs); 314 323 315 324 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
branches/cleanup/ippTools/src/pxchip.c
r17161 r17863 35 35 36 36 // check that state is a valid string value 37 if (!( 38 (strncmp(state, "run", 4) == 0) 39 || (strncmp(state, "stop", 5) == 0) 40 || (strncmp(state, "reg", 4) == 0) 41 ) 42 ) { 43 psError(PS_ERR_UNKNOWN, false, 44 "invalid chipRun state: %s", state); 37 if (!pxIsValidState(state)) { 38 psError(PS_ERR_UNKNOWN, false, "invalid chipRun state: %s", state); 45 39 return false; 46 40 } … … 63 57 64 58 // check that state is a valid string value 65 if (!( 66 (strncmp(state, "run", 4) == 0) 67 || (strncmp(state, "stop", 5) == 0) 68 || (strncmp(state, "reg", 4) == 0) 69 ) 70 ) { 71 psError(PS_ERR_UNKNOWN, false, 72 "invalid chipRun state: %s", state); 59 if (!pxIsValidState(state)) { 60 psError(PS_ERR_UNKNOWN, false, "invalid chipRun state: %s", state); 73 61 return false; 74 62 } 63 75 64 76 65 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) SET state = '%s'"); … … 151 140 0x0, // chip_id 152 141 exp_id, 153 " run", // state142 "new", // state 154 143 workdir, 155 144 "dirty", // workdir_state … … 167 156 return psDBLastInsertID(config->dbh); 168 157 } 158 -
branches/cleanup/ippTools/src/pxchip.h
r17161 r17863 40 40 const char *end_stage); 41 41 42 42 43 #endif // PXCHIP_H -
branches/cleanup/ippTools/src/pxtools.h
r16170 r17863 41 41 # define PXTOOL_MODE_NONE 0x0 42 42 43 bool pxCreateTables (pxConfig *config); 44 bool pxDeleteTables (pxConfig *config); 43 bool pxIsValidState(const char *state); 45 44 46 45 bool pxSetFaultCode(psDB *dbh, const char *tableName, psMetadata *where, psS16 code);
Note:
See TracChangeset
for help on using the changeset viewer.
