Changeset 37026
- Timestamp:
- Jul 16, 2014, 3:29:41 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140610/ippTools
- Files:
-
- 9 edited
- 1 copied
-
share/Makefile.am (modified) (1 diff)
-
share/remotetool_definebyquery_cam.sql (modified) (1 diff)
-
share/remotetool_definebyquery_chip.sql (modified) (1 diff)
-
share/remotetool_definebyquery_stack.sql (modified) (1 diff)
-
share/remotetool_definebyquery_warp.sql (modified) (1 diff)
-
share/remotetool_dropcomponent.sql (copied) (copied from trunk/ippTools/share/remotetool_dropcomponent.sql )
-
src/camtoolConfig.c (modified) (1 diff)
-
src/remotetool.c (modified) (9 diffs)
-
src/remotetool.h (modified) (1 diff)
-
src/remotetoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140610/ippTools/share/Makefile.am
r36555 r37026 508 508 remotetool_definebyquery_warp.sql \ 509 509 remotetool_definebyquery_stack.sql \ 510 remotetool_dropcomponent.sql \ 510 511 remotetool_updatepoll.sql -
branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_cam.sql
r36884 r37026 1 SELECT 2 cam_id AS stage_id 3 FROM camRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = camRun.cam_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = camRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT cam_id AS stage_id 4 FROM camRun 9 5 WHERE 10 camRun.state = 'new' AND 11 (remoteRun.stage = 'camera' OR remoteRun.state IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 camRun.state = 'new' 7 -- where hook %s 8 GROUP BY cam_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'camera' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL -
branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_chip.sql
r36512 r37026 1 SELECT 2 chip_id AS stage_id 3 FROM chipRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = chipRun.chip_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = chipRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT chip_id AS stage_id 4 FROM chipRun 9 5 WHERE 10 chipRun.state = 'new' AND 11 (remoteRun.stage = 'chip' OR remoteRun.stage IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 chipRun.state = 'new' 7 -- where hook %s 8 GROUP BY chip_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'chip' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL 22 13 23 14 24 -
branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_stack.sql
r36884 r37026 1 SELECT 2 stack_id AS stage_id 3 FROM stackRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = stackRun.stack_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = stackRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT stack_id AS stage_id 4 FROM stackRun 9 5 WHERE 10 stackRun.state = 'new' AND 11 (remoteRun.stage = 'stack' OR remoteRun.state IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 stackRun.state = 'new' 7 -- where hook %s 8 GROUP BY stack_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'stack' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL -
branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_warp.sql
r36928 r37026 1 SELECT warp_id AS stage_id FROM ( 2 SELECT warp_id, count(warpSkyCellMap.skycell_id) AS N 1 SELECT stage_id FROM 2 3 ( SELECT warp_id AS stage_id, count(warpSkyCellMap.skycell_id) AS N 3 4 FROM warpRun 4 5 LEFT JOIN warpSkyCellMap USING(warp_id) 5 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = warpRun.warp_id) 6 LEFT JOIN remoteRun ON (remoteComponent.remote_id = remoteRun.remote_id 7 AND remoteRun.label = warpRun.label ) 8 WHERE warpRun.state = 'new' 9 AND (remoteRun.stage = 'warp' OR remoteRun.state IS NULL) 10 AND remoteComponent.remote_id IS NULL 6 WHERE 7 warpRun.state = 'new' 11 8 -- where hook %s 12 9 GROUP BY warp_id 13 ) AS warpTry 14 WHERE N != 0 10 HAVING N != 0 11 ) AS W 15 12 13 LEFT JOIN 14 15 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 16 FROM remoteRun 17 JOIN remoteComponent USING (remote_id) 18 WHERE 19 remoteRun.stage = 'warp' 20 -- where hook %s 21 ) AS R 22 USING (stage_id) 23 WHERE R.remote_id IS NULL 24 -
branches/eam_branches/ipp-20140610/ippTools/src/camtoolConfig.c
r36928 r37026 205 205 psMetadataAddF32(addprocessedexpArgs, PS_LIST_TAIL, "-deteff_inst_uq", 0, "define deteff_uq", NAN); 206 206 psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-background_model", 0, "set background_model value", 0); 207 psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-astrom_chips", 0, "chips with successful astrom", -1);207 psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-astrom_chips", 0, "chips with successful astrom", 0); 208 208 209 209 // -processedexp -
branches/eam_branches/ipp-20140610/ippTools/src/remotetool.c
r36928 r37026 23 23 24 24 // Update 25 static bool dropcomponentMode(pxConfig *config); 25 26 static bool updaterunMode(pxConfig *config); 26 27 static bool updatepollMode(pxConfig *config); … … 49 50 MODECASE(REMOTETOOL_MODE_LISTRUN, listrunMode); 50 51 MODECASE(REMOTETOOL_MODE_LISTCOMPONENT, listcomponentMode); 52 MODECASE(REMOTETOOL_MODE_DROPCOMPONENT, dropcomponentMode); 51 53 MODECASE(REMOTETOOL_MODE_UPDATERUN, updaterunMode); 52 54 MODECASE(REMOTETOOL_MODE_UPDATEPOLL, updatepollMode); … … 94 96 95 97 // Get a list of the things we can insert into a new component 98 // CZW: these labels no longer need to be linked to the table, as I've split stageRun and remoteRun into sub-queries. 96 99 psString query = NULL; 97 100 psString whereOption = psStringCopy(""); … … 104 107 105 108 if (label) { 106 psStringAppend(& query, " AND (chipRun.label = '%s')", label);109 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 107 110 } 108 111 } … … 115 118 116 119 if (label) { 117 psStringAppend(& query, " AND (camRun.label = '%s')", label);120 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 118 121 } 119 122 } … … 128 131 // Because warp has to check to see if something other than the state is set correctly, I have to use this wonky way to pass the label in. 129 132 // psStringAppend(&query, " AND (warpRun.label = '%s')", label); 130 psStringAppend(&whereOption, "\n AND ( warpRun.label = '%s')", label);133 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 131 134 } 132 135 } … … 139 142 140 143 if (label) { 141 psStringAppend(& query, " AND (stackRun.label = '%s')", label);144 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 142 145 } 143 146 } … … 152 155 psFree(limitString); 153 156 } 154 if (!p_psDBRunQueryF(config->dbh, query,whereOption )) {157 if (!p_psDBRunQueryF(config->dbh, query,whereOption,whereOption)) { // This needs to be here twice because we need to restrict on label twice. 155 158 psError(PS_ERR_UNKNOWN, false, "database error"); 156 159 psFree(query); … … 313 316 // Update 314 317 318 static bool dropcomponentMode(pxConfig *config) 319 { 320 // Assert that we have a unique component to operate on. 321 PXOPT_LOOKUP_S64(remote_id,config->args, "-remote_id",true, false); 322 psAssert(remote_id,"This must exist for this mode to be safe."); 323 PXOPT_LOOKUP_S64(stage_id, config->args, "-stage_id", true, false); 324 psAssert(stage_id,"This must exist for this mode to be safe."); 325 326 psString query = pxDataGet("remotetool_dropcomponent.sql"); 327 if (!query) { 328 psError(PXTOOLS_ERR_SYS, false, "Failed to retreive SQL statement"); 329 return false; 330 } 331 332 if (!psDBTransaction(config->dbh)) { 333 psError(PS_ERR_UNKNOWN, false, "database error"); 334 return false; 335 } 336 337 if (!p_psDBRunQueryF(config->dbh, query, remote_id, stage_id)) { 338 psError(PS_ERR_UNKNOWN, false, "Database error"); 339 psFree(query); 340 return false; 341 } 342 psFree(query); 343 344 345 346 // point of no return 347 if (!psDBCommit(config->dbh)) { 348 psError(PS_ERR_UNKNOWN, false, "database error"); 349 return false; 350 } 351 352 return true; 353 } 354 315 355 static bool updaterunMode(pxConfig *config) 316 356 { -
branches/eam_branches/ipp-20140610/ippTools/src/remotetool.h
r36511 r37026 13 13 REMOTETOOL_MODE_LISTRUN, 14 14 REMOTETOOL_MODE_LISTCOMPONENT, 15 REMOTETOOL_MODE_DROPCOMPONENT, 15 16 REMOTETOOL_MODE_UPDATERUN, 16 17 REMOTETOOL_MODE_UPDATEPOLL, -
branches/eam_branches/ipp-20140610/ippTools/src/remotetoolConfig.c
r36512 r37026 64 64 ADD_OPT(S16, listcomponentArgs, "-limit", "limit to number of runs to display", 0); 65 65 ADD_OPT(Bool, listcomponentArgs, "-simple", "simple print format", false); 66 67 // -dropcomponent 68 psMetadata *dropcomponentArgs = psMetadataAlloc(); 69 ADD_OPT(S64, dropcomponentArgs, "-remote_id", "run to update", 0); 70 ADD_OPT(S64, dropcomponentArgs, "-stage_id", "stage_id to remote", 0); 71 66 72 // -updaterun 67 73 psMetadata *updaterunArgs = psMetadataAlloc(); … … 95 101 PXOPT_ADD_MODE("-listrun", "", REMOTETOOL_MODE_LISTRUN, listrunArgs); 96 102 PXOPT_ADD_MODE("-listcomponent", "", REMOTETOOL_MODE_LISTCOMPONENT, listcomponentArgs); 103 PXOPT_ADD_MODE("-dropcomponent", "", REMOTETOOL_MODE_DROPCOMPONENT, dropcomponentArgs); 97 104 PXOPT_ADD_MODE("-updaterun", "", REMOTETOOL_MODE_UPDATERUN, updaterunArgs); 98 105 PXOPT_ADD_MODE("-updatepoll", "", REMOTETOOL_MODE_UPDATEPOLL, updatepollArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
