Changeset 27391
- Timestamp:
- Mar 22, 2010, 1:58:02 PM (16 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 1 added
- 15 edited
-
share/Makefile.am (modified) (1 diff)
-
share/chiptool_pendingimfile.sql (modified) (1 diff)
-
share/chiptool_setimfiletoupdate.sql (added)
-
share/difftool_todiffskyfile.sql (modified) (2 diffs)
-
share/warptool_towarped.sql (modified) (1 diff)
-
src/addtool.c (modified) (2 diffs)
-
src/camtool.c (modified) (1 diff)
-
src/chiptool.c (modified) (4 diffs)
-
src/chiptool.h (modified) (1 diff)
-
src/chiptoolConfig.c (modified) (2 diffs)
-
src/difftool.c (modified) (2 diffs)
-
src/faketool.c (modified) (1 diff)
-
src/pxtools.c (modified) (4 diffs)
-
src/pxtools.h (modified) (1 diff)
-
src/stacktool.c (modified) (1 diff)
-
src/warptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/Makefile.am
r27192 r27391 38 38 chiptool_run.sql \ 39 39 chiptool_runstate.sql \ 40 chiptool_setimfiletoupdate.sql \ 40 41 chiptool_export_imfile.sql \ 41 42 chiptool_export_processed_imfile.sql \ -
trunk/ippTools/share/chiptool_pendingimfile.sql
r26886 r27391 33 33 OR 34 34 (chipRun.state = 'update' 35 AND chipProcessedImfile.data_state = ' cleaned'))35 AND chipProcessedImfile.data_state = 'update')) 36 36 -- // Restriction to prevent the processing of bad chips. Not needed now. 37 37 -- AND -
trunk/ippTools/share/difftool_todiffskyfile.sql
r27020 r27391 67 67 OR (diffRun.state = 'update' 68 68 AND diffSkyfile.fault = 0 69 AND diffSkyfile.data_state = ' cleaned')69 AND diffSkyfile.data_state = 'update') 70 70 ) 71 71 -- Ensure input warps are available 72 72 AND (diffInputSkyfile.warp1 IS NULL 73 OR (warp Run.state = 'full'73 OR (warpSkyfile.data_state = 'full' 74 74 AND warpSkyfile.fault = 0 75 AND warpSkyfile.magicked >= 0 75 76 AND warpSkyfile.quality = 0)) 76 77 -- Ensure input stacks are available … … 81 82 -- Ensure template warps are available 82 83 AND (diffInputSkyfile.warp2 IS NULL 83 OR (warpTemplate Run.state = 'full'84 OR (warpTemplateSkyfile.data_state = 'full' 84 85 AND warpTemplateSkyfile.fault = 0 86 AND warpSkyfile.magicked >= 0 85 87 AND warpTemplateSkyfile.quality = 0)) 86 88 -- Ensure template stacks are available -
trunk/ippTools/share/warptool_towarped.sql
r26567 r27391 1 SELECT DISTINCT 2 warpSkyCellMap.warp_id, 3 warpImfile.warp_skyfile_id, 4 warpSkyCellMap.skycell_id, 5 warpSkyCellMap.tess_id, 6 warpRun.fake_id, 7 warpRun.state, 8 warpRun.reduction, 9 camRun.cam_id, 10 rawExp.camera, 11 rawExp.exp_tag, 12 warpRun.workdir, 13 chipRun.magicked 14 FROM warpRun 15 JOIN warpSkyCellMap 16 USING(warp_id) 17 JOIN warpImfile 18 ON warpSkyCellMap.warp_id = warpImfile.warp_id 19 AND warpSkyCellMap.skycell_id = warpImfile.skycell_id 20 JOIN fakeRun 21 USING(fake_id) 22 JOIN camRun 23 USING(cam_id) 24 JOIN chipRun 25 USING(chip_id) 26 JOIN chipProcessedImfile 27 USING(chip_id) 28 JOIN rawExp 29 ON chipRun.exp_id = rawExp.exp_id 30 LEFT JOIN warpSkyfile 31 ON warpRun.warp_id = warpSkyfile.warp_id 32 AND warpSkyCellMap.skycell_id = warpSkyfile.skycell_id 33 AND warpSkyCellMap.tess_id = warpSkyfile.tess_id 34 LEFT JOIN warpMask 35 ON warpRun.label = warpMask.label 36 WHERE 37 ((warpRun.state = 'new' 1 SELECT 2 warp_id, 3 warp_skyfile_id, 4 skycell_id, 5 tess_id, 6 fake_id, 7 state, 8 reduction, 9 cam_id, 10 camera, 11 exp_tag, 12 workdir, 13 magicked 14 FROM ( 15 SELECT 16 warpSkyCellMap.warp_id, 17 warpImfile.warp_skyfile_id, 18 warpSkyCellMap.skycell_id, 19 warpSkyCellMap.tess_id, 20 warpRun.fake_id, 21 warpRun.state, 22 warpRun.reduction, 23 camRun.cam_id, 24 rawExp.camera, 25 rawExp.exp_tag, 26 warpRun.workdir, 27 chipRun.magicked 28 FROM warpRun 29 JOIN warpSkyCellMap 30 USING(warp_id) 31 JOIN warpImfile 32 ON warpSkyCellMap.warp_id = warpImfile.warp_id 33 AND warpSkyCellMap.skycell_id = warpImfile.skycell_id 34 JOIN fakeRun 35 USING(fake_id) 36 JOIN camRun 37 USING(cam_id) 38 JOIN chipRun 39 USING(chip_id) 40 JOIN chipProcessedImfile 41 USING(chip_id) 42 JOIN rawExp 43 ON chipRun.exp_id = rawExp.exp_id 44 LEFT JOIN warpSkyfile 45 ON warpRun.warp_id = warpSkyfile.warp_id 46 AND warpSkyCellMap.skycell_id = warpSkyfile.skycell_id 47 AND warpSkyCellMap.tess_id = warpSkyfile.tess_id 48 LEFT JOIN warpMask 49 ON warpRun.label = warpMask.label 50 WHERE 51 warpRun.state = 'new' 38 52 AND warpSkyfile.warp_id IS NULL 39 53 AND warpSkyfile.skycell_id IS NULL 40 AND warpSkyfile.tess_id IS NULL) 41 OR (warpRun.state = 'update' 42 AND chipRun.magicked >= 0 43 AND warpSkyfile.fault = 0 44 AND warpSkyfile.data_state = 'cleaned') 45 ) 46 AND fakeRun.state = 'full' 47 AND camRun.state = 'full' 48 AND chipRun.state = 'full' 49 AND warpMask.label IS NULL 50 AND warpSkyCellMap.fault = 0 54 AND warpSkyfile.tess_id IS NULL 55 AND fakeRun.state = 'full' 56 AND camRun.state = 'full' 57 AND chipRun.state = 'full' 58 AND warpMask.label IS NULL 59 AND warpSkyCellMap.fault = 0 60 -- where hook 1 %s 61 GROUP BY warp_id, skycell_id 62 UNION 63 SELECT 64 warpSkyCellMap.warp_id, 65 warpImfile.warp_skyfile_id, 66 warpSkyCellMap.skycell_id, 67 warpSkyCellMap.tess_id, 68 warpRun.fake_id, 69 warpRun.state, 70 warpRun.reduction, 71 camRun.cam_id, 72 rawExp.camera, 73 rawExp.exp_tag, 74 warpRun.workdir, 75 MIN(chipProcessedImfile.magicked) AS magicked 76 FROM warpRun 77 JOIN warpSkyCellMap USING(warp_id) 78 JOIN warpImfile USING(warp_id, skycell_id) 79 JOIN warpSkyfile USING(warp_id, skycell_id) 80 JOIN fakeRun USING(fake_id) 81 JOIN camRun USING(cam_id) 82 JOIN chipRun USING(chip_id) 83 JOIN rawExp USING(exp_id) 84 LEFT JOIN chipProcessedImfile USING(chip_id, class_id) 85 WHERE warpRun.state = 'update' 86 AND warpSkyfile.data_state = 'update' 87 AND camRun.state = 'full' 88 AND chipProcessedImfile.data_state = 'full' 89 -- if warpSkyfile was magicked previously require inputs to be magicked 90 -- this blocks processing until all the chip inputs have been destreaked 91 AND (warpSkyfile.magicked = 0 OR chipProcessedImfile.magicked >= 0) 92 -- where hook 2 %s 93 GROUP BY warp_id, skycell_id 94 HAVING COUNT(warpSkyCellMap.class_id) = COUNT(chipProcessedImfile.class_id) 95 ) as towarped 96 -
trunk/ippTools/src/addtool.c
r26981 r27391 290 290 291 291 // pxUpdateRun gets parameters from config->args and runs the update query 292 bool result = pxUpdateRun(config, where, &query, "addRun", false); 292 bool result = pxUpdateRun(config, where, &query, "addRun", "add_id", 293 "addProcessedExp", false); 293 294 294 295 psFree(query); … … 296 297 297 298 return result; 298 299 300 #ifdef notdef301 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);302 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);303 304 if ((!state) && (!label)) {305 psError(PXTOOLS_ERR_CONFIG, false, "parameters are required");306 psFree(where);307 return false;308 }309 310 if (state) {311 // set addRun.state to state312 if (!pxaddRunSetStateByQuery(config, where, state)) {313 psFree(where);314 return false;315 }316 }317 318 if (label) {319 // set addRun.label to label320 if (!pxaddRunSetLabelByQuery(config, where, label)) {321 psFree(where);322 return false;323 }324 }325 326 psFree(where);327 328 return true;329 #endif330 299 } 331 300 -
trunk/ippTools/src/camtool.c
r27300 r27391 267 267 268 268 // pxUpdateRun gets parameters from config->args and updates 269 bool result = pxUpdateRun(config, where, &query, "camRun", true);269 bool result = pxUpdateRun(config, where, &query, "camRun", "cam_id", "camProcessedExp", true); 270 270 if (!result) { 271 271 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); -
trunk/ippTools/src/chiptool.c
r27195 r27391 59 59 static bool importrunMode(pxConfig *config); 60 60 static bool runstateMode(pxConfig *config); 61 static bool setimfiletoupdateMode(pxConfig *config); 61 62 62 63 # define MODECASE(caseName, func) \ … … 101 102 MODECASE(CHIPTOOL_MODE_IMPORTRUN, importrunMode); 102 103 MODECASE(CHIPTOOL_MODE_RUNSTATE, runstateMode); 104 MODECASE(CHIPTOOL_MODE_SETIMFILETOUPDATE, setimfiletoupdateMode); 103 105 default: 104 106 psAbort("invalid option (this should not happen)"); … … 428 430 return false; 429 431 } 430 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) ");432 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) -- join hook %s\n"); 431 433 432 434 // pxUpdateRun gets parameters from config->args and updates 433 bool result = pxUpdateRun(config, where, &query, "chipRun", true);435 bool result = pxUpdateRun(config, where, &query, "chipRun", "chip_id", "chipProcessedImfile", true); 434 436 if (!result) { 435 437 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); … … 1720 1722 return true; 1721 1723 } 1724 1725 // a very specfic function to queue a cleaned chipProcessedImfile to be updated 1726 static bool setimfiletoupdateMode(pxConfig *config) 1727 { 1728 PS_ASSERT_PTR_NON_NULL(config, NULL); 1729 1730 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 1731 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", false, false); 1732 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 1733 1734 psString query = pxDataGet("chiptool_setimfiletoupdate.sql"); 1735 if (!query) { 1736 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1737 return false; 1738 } 1739 1740 psString setHook = psStringCopy(""); 1741 if (label) { 1742 psStringAppend(&setHook, "\n , chipRun.label = '%s'", label); 1743 } 1744 1745 if (class_id) { 1746 psStringAppend(&query, " AND (chipProcessedImfile.class_id = '%s')", class_id); 1747 } 1748 1749 if (!p_psDBRunQueryF(config->dbh, query, setHook, chip_id)) { 1750 psError(PS_ERR_UNKNOWN, false, "database error"); 1751 return false; 1752 } 1753 1754 psFree(setHook); 1755 psFree(query); 1756 1757 return true; 1758 } -
trunk/ippTools/src/chiptool.h
r27192 r27391 33 33 CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, 34 34 CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, 35 CHIPTOOL_MODE_SETIMFILETOUPDATE, 35 36 CHIPTOOL_MODE_ADVANCEEXP, 36 37 CHIPTOOL_MODE_BLOCK, -
trunk/ippTools/src/chiptoolConfig.c
r27195 r27391 97 97 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0, "set dist group", NULL); 98 98 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0, "set note", NULL); 99 100 // -setimfiletoupdate 101 psMetadata *setimfiletoupdateArgs = psMetadataAlloc(); 102 psMetadataAddS64(setimfiletoupdateArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID (required)", 0); 103 psMetadataAddStr(setimfiletoupdateArgs, PS_LIST_TAIL, "-class_id", 0, "search by class_id (required)", NULL); 104 psMetadataAddStr(setimfiletoupdateArgs, PS_LIST_TAIL, "-set_label", 0,"new value for label", NULL); 99 105 100 106 // -pendingimfile … … 315 321 PXOPT_ADD_MODE("-definecopy", "create copy runs", CHIPTOOL_MODE_DEFINECOPY, definecopyArgs); 316 322 PXOPT_ADD_MODE("-updaterun", "change chip run properties", CHIPTOOL_MODE_UPDATERUN, updaterunArgs); 323 PXOPT_ADD_MODE("-setimfiletoupdate", "set imfile state to update", CHIPTOOL_MODE_SETIMFILETOUPDATE, setimfiletoupdateArgs); 317 324 PXOPT_ADD_MODE("-pendingimfile", "show pending imfiles", CHIPTOOL_MODE_PENDINGIMFILE, pendingimfileArgs); 318 325 PXOPT_ADD_MODE("-addprocessedimfile", "add a processed imfile", CHIPTOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileArgs); -
trunk/ippTools/src/difftool.c
r27210 r27391 204 204 205 205 // pxUpdateRun gets parameters from config->args and updates 206 bool result = pxUpdateRun(config, where, &query, "diffRun", true);206 bool result = pxUpdateRun(config, where, &query, "diffRun", "diff_id", "diffSkyfile", true); 207 207 208 208 psFree(query); … … 210 210 211 211 return result; 212 213 #ifdef notdef214 // required options215 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", false, false);216 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);217 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);218 219 // Copy of my hacky work around from stacktool.c220 if ((state)&&(diff_id)) {221 // set detRun.state to state222 return setdiffRunState(config, diff_id, state, false);223 }224 225 if ((state)&&(label)) {226 return setdiffRunStateByLabel(config, label, state);227 }228 229 psError(PS_ERR_UNKNOWN, false, "Required options not found.");230 231 return false;232 #endif233 212 } 234 213 -
trunk/ippTools/src/faketool.c
r27210 r27391 348 348 349 349 // pxUpdateRun gets parameters from config->args and updates 350 bool result = pxUpdateRun(config, where, &query, "fakeRun", true);350 bool result = pxUpdateRun(config, where, &query, "fakeRun", "fake_id", "fakeProcessedImfile", true); 351 351 if (!result) { 352 352 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); -
trunk/ippTools/src/pxtools.c
r27258 r27391 110 110 111 111 // shared code for updating the various strings for a Run 112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString table, bool has_dist_group)112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group) 113 113 { 114 114 PS_ASSERT_PTR_NON_NULL(config, false); … … 116 116 PS_ASSERT_PTR_NON_NULL(pQuery, false); 117 117 PS_ASSERT_PTR_NON_NULL(*pQuery, false); 118 PS_ASSERT_PTR_NON_NULL(runTable, false); 119 PS_ASSERT_PTR_NON_NULL(idColumn, false); 120 PS_ASSERT_PTR_NON_NULL(fileTable, false); 118 121 119 122 // make sure that -state is not the only selection parameter … … 158 161 } while (0) 159 162 160 addColumn( table, state);161 addColumn( table, data_group);163 addColumn(runTable, state); 164 addColumn(runTable, data_group); 162 165 if (has_dist_group) { 163 addColumn(table, dist_group); 164 } 165 addColumn(table, note); 166 addColumn(table, label); 166 addColumn(runTable, dist_group); 167 } 168 addColumn(runTable, note); 169 addColumn(runTable, label); 170 171 psString joinHook = psStringCopy(""); 172 psString fileWhere = NULL; 173 if (state && !strcmp(state, "update")) { 174 psStringAppend(&joinHook, "\n JOIN %s USING(%s)", fileTable, idColumn); 175 psStringAppend(pQuery, ", %s.data_state = 'update'", fileTable); 176 psStringAppend(&fileWhere, "AND %s.data_state = 'cleaned'", fileTable); 177 } 167 178 168 179 psString whereClause = psDBGenerateWhereSQL(where, NULL); 169 180 psStringAppend(pQuery, " %s", whereClause); 170 181 psFree(whereClause); 182 if (fileWhere) { 183 psStringAppend(pQuery, fileWhere); 184 } 171 185 172 186 bool mdok; // Status of MD lookup … … 176 190 } 177 191 178 if (!p_psDBRunQuery (config->dbh, *pQuery)) {192 if (!p_psDBRunQueryF(config->dbh, *pQuery, joinHook)) { 179 193 psError(PS_ERR_UNKNOWN, false, "database error"); 180 194 return false; -
trunk/ippTools/src/pxtools.h
r25851 r27391 65 65 bool pxGetOptions(FILE *stream, int argc, char **argv, pxConfig *config, psMetadata *modes, psMetadata *argSets); 66 66 67 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString table, bool has_dist_group);67 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group); 68 68 69 69 #define PXOPT_ADD_MODE(option, comment, modeval, argset) \ -
trunk/ippTools/src/stacktool.c
r27120 r27391 612 612 613 613 // pxUpdateRun gets parameters from config->args and updates 614 bool result = pxUpdateRun(config, where, &query, "stackRun", true);614 bool result = pxUpdateRun(config, where, &query, "stackRun", "stack_id", "stackSumSkyfile", true); 615 615 616 616 psFree(query); -
trunk/ippTools/src/warptool.c
r27389 r27391 402 402 } 403 403 404 psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)");404 psString query = psStringCopy("UPDATE warpRun JOIN warpSkyfile USING(warp_id) JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)"); 405 405 406 406 // pxUpdateRun gets parameters from config->args and updates 407 bool result = pxUpdateRun(config, where, &query, "warpRun", true);407 bool result = pxUpdateRun(config, where, &query, "warpRun", "warp_id", "warpSkyfile", true); 408 408 409 409 psFree(query); … … 907 907 } 908 908 909 psString whereStr = psStringCopy(""); 909 910 if (psListLength(where->list)) { 910 911 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 911 psStringAppend(& query, "AND %s", whereClause);912 psStringAppend(&whereStr, "\n AND %s", whereClause); 912 913 psFree(whereClause); 913 914 } … … 921 922 } 922 923 923 if (!p_psDBRunQuery (config->dbh, query)) {924 if (!p_psDBRunQueryF(config->dbh, query, whereStr, whereStr)) { 924 925 psError(PS_ERR_UNKNOWN, false, "database error"); 925 926 psFree(query); 926 927 return false; 927 928 } 929 psFree(whereStr); 928 930 psFree(query); 929 931
Note:
See TracChangeset
for help on using the changeset viewer.
