Changeset 23229 for trunk/ippTools
- Timestamp:
- Mar 8, 2009, 4:50:46 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
- 2 copied
-
. (modified) (1 prop)
-
ippTools/scripts/test_create_detrend.sql (copied) (copied from branches/eam_branches/eam_branch_20090303/ippTools/scripts/test_create_detrend.sql )
-
ippTools/scripts/test_insert_detrend.sql (copied) (copied from branches/eam_branches/eam_branch_20090303/ippTools/scripts/test_insert_detrend.sql )
-
ippTools/share/chiptool_change_imfile_data_state.sql (modified) (1 diff)
-
ippTools/share/dettool_processedimfile.sql (modified) (1 diff)
-
ippTools/share/dettool_residimfile.sql (modified) (1 diff)
-
ippTools/share/dettool_tonormalizedstat.sql (modified) (1 diff)
-
ippTools/share/dettool_toresidexp.sql (modified) (2 diffs)
-
ippTools/share/dettool_toresidimfile.sql (modified) (3 diffs)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/share/warptool_change_skyfile_data_state.sql (modified) (1 diff)
-
ippTools/src/chiptool.c (modified) (6 diffs)
-
ippTools/src/chiptoolConfig.c (modified) (3 diffs)
-
ippTools/src/dettoolConfig.c (modified) (1 diff)
-
ippTools/src/dettool_processedimfile.c (modified) (4 diffs)
-
ippTools/src/dettool_residimfile.c (modified) (2 diffs)
-
ippTools/src/warptool.c (modified) (4 diffs)
-
ippTools/src/warptoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/eam_branches/eam_branch_20090303 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/ippTools/share/chiptool_change_imfile_data_state.sql
r19527 r23229 7 7 chip_id = %lld 8 8 AND class_id = '%s' 9 -- only update if chipRun.state has the expected value 10 AND ( 11 SELECT state from chipRun where chipRun.chip_id = chipProcessedImfile.chip_id 12 ) = '%s' 13 14 9 -- -- only update if chipRun.state has the expected value 10 -- AND ( 11 -- SELECT state from chipRun where chipRun.chip_id = chipProcessedImfile.chip_id 12 -- ) = '%s' -
trunk/ippTools/share/dettool_processedimfile.sql
r18561 r23229 1 -- is this DISTINCT needed? 1 2 SELECT DISTINCT 2 3 detRun.det_type, -
trunk/ippTools/share/dettool_residimfile.sql
r19632 r23229 2 2 detRun.det_type, 3 3 detRun.mode, 4 detResidImfile.*, 5 rawExp.exp_time 6 FROM detResidImfile 7 JOIN detRun 8 USING(det_id, iteration) 9 JOIN rawExp 10 USING(exp_id) 4 rawExp.exp_time, 5 detResidImfile.* 6 FROM detResidImfile 7 JOIN detRun 8 USING(det_id, iteration) 9 JOIN detInputExp 10 ON detRun.det_id = detInputExp.det_id 11 AND detRun.iteration = detInputExp.iteration 12 AND detResidImfile.exp_id = detInputExp.exp_id 13 JOIN rawExp 14 ON rawExp.exp_id = detResidImfile.exp_id -
trunk/ippTools/share/dettool_tonormalizedstat.sql
r18118 r23229 1 -- select detRun.det_id (det_id) 2 -- select detRun.iteration 3 -- by: 4 -- find the current iteration bassed on det_id 5 -- find all exp_ids in the current det_id/iteration from detInputExp 6 -- sort to detInputExp.imfiles to find the largest value per det_id/iter 7 -- compare imfiles to the number of detStackedImfiles by class_id 8 -- and: 9 -- ??? 10 -- det_id is not in detStackedImfile; 11 -- iteration is not in detStackedImfile; 12 13 SELECT 14 det_id, 15 det_type, 16 iteration, 17 camera, 18 workdir, 19 class_id 20 FROM 21 (SELECT DISTINCT 22 detRun.det_id, 23 detRun.det_type, 24 detRun.iteration, 25 detRun.workdir, 26 rawExp.camera, 27 detStackedImfile.class_id, 28 rawImfile.class_id as rawimfile_class_id 29 FROM detRun 30 JOIN detInputExp 31 ON detRun.det_id = detInputExp.det_id 32 AND detRun.iteration = detInputExp.iteration 33 JOIN rawExp 34 ON detInputExp.exp_id = rawExp.exp_id 35 JOIN rawImfile 36 ON rawExp.exp_id = rawImfile.exp_id 37 LEFT JOIN detStackedImfile 38 ON detInputExp.det_id = detStackedImfile.det_id 39 AND detInputExp.iteration = detStackedImfile.iteration 40 AND rawImfile.class_id = detStackedImfile.class_id 41 LEFT JOIN detNormalizedStatImfile 42 ON detStackedImfile.det_id = detNormalizedStatImfile.det_id 43 AND detStackedImfile.iteration = detNormalizedStatImfile.iteration 44 AND detStackedImfile.class_id = detNormalizedStatImfile.class_id 45 WHERE 46 detRun.state = 'run' 47 AND detRun.mode = 'master' 48 AND detNormalizedStatImfile.det_id IS NULL 49 AND detNormalizedStatImfile.iteration IS NULL 50 AND detNormalizedStatImfile.class_id IS NULL 51 GROUP BY 52 -- rawExp.exp_id, 53 detRun.iteration, 54 detRun.det_id 55 HAVING 56 COUNT(rawImfile.class_id) = COUNT(detStackedImfile.class_id) 57 AND SUM(detStackedImfile.fault) = 0 58 ) as tonormalizedstat 1 -- a det_run + iteration is ready for normstat when: all detResidImfile entries for that iteration corresponding to all detProcessedImfile entries are available 2 SELECT 3 detRun.det_id, 4 detRun.det_type, 5 detRun.iteration, 6 detRun.camera, 7 detRun.workdir, 8 detProcessedImfile.class_id, 9 COUNT(detProcessedImfile.class_id), 10 COUNT(detResidImfile.class_id) 11 FROM detRun 12 JOIN detProcessedImfile 13 ON detProcessedImfile.det_id = detRun.det_id 14 LEFT JOIN detResidImfile 15 ON detResidImfile.det_id = detProcessedImfile.det_id 16 AND detResidImfile.class_id = detProcessedImfile.class_id 17 AND detResidImfile.iteration = detRun.iteration 18 LEFT JOIN detNormalizedStatImfile 19 ON detNormalizedStatImfile.det_id = detRun.det_id 20 AND detNormalizedStatImfile.iteration = detRun.iteration 21 AND detNormalizedStatImfile.class_id = detProcessedImfile.class_id 22 WHERE 23 detRun.state = 'run' 24 AND detRun.mode = 'master' 25 AND detNormalizedStatImfile.det_id IS NULL 26 AND detNormalizedStatImfile.iteration IS NULL 27 AND detNormalizedStatImfile.class_id IS NULL 28 GROUP BY 29 detRun.iteration, 30 detRun.det_id 31 HAVING 32 COUNT(detProcessedImfile.class_id) = COUNT(detResidImfile.class_id) 33 AND SUM(detResidImfile.fault) = 0 -
trunk/ippTools/share/dettool_toresidexp.sql
r19815 r23229 5 5 -- id, detrend type, and whether the exposure was included in the stack for 6 6 -- this iteration. 7 8 -- require the corresponding detNormalizedExp to complete before starting 7 9 8 10 -- select detRun.det_id … … 41 43 detResidImfile.class_id 42 44 FROM detRun 45 JOIN detNormalizedExp 46 USING(det_id, iteration) 43 47 JOIN detInputExp 44 48 USING(det_id, iteration) -
trunk/ippTools/share/dettool_toresidimfile.sql
r19816 r23229 13 13 detProcessedImfile.class_id, 14 14 detProcessedImfile.uri, 15 detNormalizedImfile.uri AS det_uri, 15 -- detNormalizedImfile.uri AS det_uri, 16 detStackedImfile.uri AS det_uri, 16 17 detRun.det_id AS ref_det_id, 17 18 detRun.iteration AS ref_iter, … … 26 27 ON detRun.det_id = detProcessedImfile.det_id 27 28 AND detInputExp.exp_id = detProcessedImfile.exp_id 28 JOIN detNormalizedImfile 29 ON detRun.det_id = detNormalizedImfile.det_id 30 AND detRun.iteration = detNormalizedImfile.iteration 31 AND detProcessedImfile.class_id = detNormalizedImfile.class_id 32 JOIN detNormalizedExp 33 ON detRun.det_id = detNormalizedExp.det_id 34 AND detRun.iteration = detNormalizedExp.iteration 29 JOIN detStackedImfile 30 ON detRun.det_id = detStackedImfile.det_id 31 AND detRun.iteration = detStackedImfile.iteration 32 AND detProcessedImfile.class_id = detStackedImfile.class_id 33 -- EAM : replacing detNormalizedImfile with detStackedImfile to change the sequencing 34 -- JOIN detNormalizedImfile 35 -- ON detRun.det_id = detNormalizedImfile.det_id 36 -- AND detRun.iteration = detNormalizedImfile.iteration 37 -- AND detProcessedImfile.class_id = detNormalizedImfile.class_id 38 -- EAM : we there is no reason to wait for all stacks to complete before continuing 39 -- JOIN detNormalizedExp 40 -- ON detRun.det_id = detNormalizedExp.det_id 41 -- AND detRun.iteration = detNormalizedExp.iteration 35 42 LEFT JOIN detResidImfile 36 43 ON detRun.det_id = detResidImfile.det_id … … 41 48 detRun.state = 'run' 42 49 AND detRun.mode = 'master' 43 AND detNormalizedImfile.fault = 0 44 AND detNormalizedExp.fault = 0 50 AND detStackedImfile.fault = 0 51 -- AND detNormalizedImfile.fault = 0 52 -- AND detNormalizedExp.fault = 0 45 53 AND detResidImfile.det_id IS NULL 46 54 AND detResidImfile.iteration IS NULL -
trunk/ippTools/share/pxadmin_create_tables.sql
r21308 r23229 737 737 REFERENCES detInputExp(det_id, iteration, exp_id), 738 738 FOREIGN KEY (det_id, exp_id, class_id) 739 REFERENCES detProcessedImfile(det_id, exp_id, class_id), 740 FOREIGN KEY (ref_det_id, ref_iter) 741 REFERENCES detNormalizedExp(det_id, iteration) 739 REFERENCES detProcessedImfile(det_id, exp_id, class_id) 742 740 ) ENGINE=innodb DEFAULT CHARSET=latin1; 743 741 -
trunk/ippTools/share/warptool_change_skyfile_data_state.sql
r19521 r23229 9 9 AND skycell_id = '%s' 10 10 -- only update if chipRun.state has the expected value 11 AND ( 12 SELECT state from warpRun where warpRun.warp_id = warpSkyfile.warp_id 13 ) = '%s' 14 15 11 -- AND ( 12 -- SELECT state from warpRun where warpRun.warp_id = warpSkyfile.warp_id 13 -- ) = '%s' -
trunk/ippTools/src/chiptool.c
r22751 r23229 52 52 static bool runMode(pxConfig *config); 53 53 static bool tocleanedimfileMode(pxConfig *config); 54 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config);54 // static bool tocleanedimfile_from_scrubbedMode(pxConfig *config); 55 55 static bool tofullimfileMode(pxConfig *config); 56 56 static bool topurgedimfileMode(pxConfig *config); 57 57 static bool exportrunMode(pxConfig *config); 58 58 static bool importrunMode(pxConfig *config); 59 static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state); 59 60 60 61 # define MODECASE(caseName, func) \ … … 92 93 MODECASE(CHIPTOOL_MODE_RUN, runMode); 93 94 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileMode); 94 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedMode);95 // MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedMode); 95 96 MODECASE(CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileMode); 96 97 MODECASE(CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileMode); … … 651 652 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 652 653 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 653 PXOPT_LOOKUP_S16(code, config->args, "-code", true, false); 654 655 if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, code)) { 654 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 655 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 656 657 if (state && code) { 658 psError(PS_ERR_UNKNOWN, true, "only one of -set_state and -code may be supplied"); 659 return false; 660 } 661 662 if (state) { 663 // make sure that the state string is valid 664 if (!pxIsValidState(state)) { 665 psError(PXTOOLS_ERR_DATA, false, "%s is not a valid state", state); 666 return false; 667 } 668 if (!change_imfile_data_state(config, state, "unknown")) { 656 669 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 657 670 return false; 658 } 659 psFree(where); 660 661 return true; 671 } 672 return true; 673 } 674 675 if (code) { 676 if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, code)) { 677 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 678 return false; 679 } 680 psFree(where); 681 return true; 682 } 683 684 psError(PS_ERR_UNKNOWN, true, "one of -set_state or -code must be supplied"); 685 return false; 662 686 } 663 687 … … 1195 1219 // shared code for the modes -tocleanedimfile -tofullimfile -topurgedimfile 1196 1220 1221 // XXX EAM : this function was enforcing only certain transitions with the SQL. However, 1222 // this is getting fairly messy now that we have added a few additional target and 1223 // destination states. I'm disabling these restrictions for now; is there are better way 1224 // to enforce the allowed state transitions? 1225 1197 1226 static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state) 1198 1227 { … … 1210 1239 } 1211 1240 1241 // XXX this feature is disabled (run_state is ignored) 1212 1242 // note only updates if chipRun.state = run_state 1213 if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_id, class_id, run_state)) { 1243 1244 if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_id, class_id)) { 1214 1245 psError(PS_ERR_UNKNOWN, false, "database error"); 1215 1246 // rollback … … 1246 1277 { 1247 1278 return change_imfile_data_state(config, "cleaned", "goto_cleaned"); 1248 }1249 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config)1250 {1251 return change_imfile_data_state(config, "cleaned", "goto_scrubbed");1252 1279 } 1253 1280 static bool tofullimfileMode(pxConfig *config) -
trunk/ippTools/src/chiptoolConfig.c
r22751 r23229 172 172 // -updateprocessedimfile 173 173 psMetadata *updateprocessedimfileArgs = psMetadataAlloc(); 174 psMetadataAddS64(updateprocessedimfileArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID", 0); 175 psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search by class ID", NULL); 176 psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code", 0, "set fault code (required)", 0); 174 psMetadataAddS64(updateprocessedimfileArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID", 0); 175 psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search by class ID", NULL); 176 psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0); 177 psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-set_state", 0, "set state", NULL); 177 178 178 179 // -promoteexp … … 234 235 psMetadataAddStr(tocleanedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 235 236 236 // -tocleanedimfile_from_scrubbed237 psMetadata *tocleanedimfile_from_scrubbedArgs = psMetadataAlloc();238 psMetadataAddS64(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0);239 psMetadataAddStr(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL);240 237 // // -tocleanedimfile_from_scrubbed 238 // psMetadata *tocleanedimfile_from_scrubbedArgs = psMetadataAlloc(); 239 // psMetadataAddS64(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0); 240 // psMetadataAddStr(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 241 // 241 242 // -tofullimfile 242 243 psMetadata *tofullimfileArgs = psMetadataAlloc(); … … 280 281 PXOPT_ADD_MODE("-run", "show runs", CHIPTOOL_MODE_RUN, runArgs); 281 282 PXOPT_ADD_MODE("-tocleanedimfile", "set imfile state to cleaned", CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileArgs); 282 PXOPT_ADD_MODE("-tocleanedimfile_from_scrubbed", "set imfile state to cleaned (for goto_scrubbed)", CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedArgs);283 // PXOPT_ADD_MODE("-tocleanedimfile_from_scrubbed", "set imfile state to cleaned (for goto_scrubbed)", CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedArgs); 283 284 PXOPT_ADD_MODE("-tofullimfile", "set imfile state to full", CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileArgs); 284 285 PXOPT_ADD_MODE("-topurgedimfile", "set imfile state to purged", CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileArgs); -
trunk/ippTools/src/dettoolConfig.c
r23154 r23229 640 640 // -residimfile 641 641 psMetadata *residimfileArgs = psMetadataAlloc(); 642 psMetadataAddS64(residimfileArgs, PS_LIST_TAIL, "-det_id", 0, "search for detrend ID", 0);643 psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration", 0, "search for iteration number", 0);644 psMetadataAddS64(residimfileArgs, PS_LIST_TAIL, "-exp_id", 0, "search by detrend ID", 0);645 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search for class ID", NULL);646 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-recip", 0, "search for recipe", NULL);647 psMetadataAddU64(residimfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0);642 psMetadataAddS64(residimfileArgs, PS_LIST_TAIL, "-det_id", 0, "search for detrend ID", 0); 643 psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration", 0, "search for iteration number", 0); 644 psMetadataAddS64(residimfileArgs, PS_LIST_TAIL, "-exp_id", 0, "search by detrend ID", 0); 645 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search for class ID", NULL); 646 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-recip", 0, "search for recipe", NULL); 647 psMetadataAddU64(residimfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 648 648 psMetadataAddBool(residimfileArgs, PS_LIST_TAIL, "-faulted", 0, "only return imfiles with a fault status set", false); 649 649 psMetadataAddBool(residimfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 650 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-select_state", 0, "search for state", NULL); 650 psMetadataAddBool(residimfileArgs, PS_LIST_TAIL, "-included", 0, "restrict results to exposures 'includeded' in the current iteration", false); 651 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-select_state", 0, "search for state", NULL); 651 652 652 653 // -revertresidimfile -
trunk/ippTools/src/dettool_processedimfile.c
r19621 r23229 165 165 PS_ASSERT_PTR_NON_NULL(config, false); 166 166 167 bool hasWhere = false;168 169 PXOPT_LOOKUP_BOOL(included, config->args, "-included", false);170 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false);171 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);172 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);173 174 167 psMetadata *where = psMetadataAlloc(); 175 168 PXOPT_COPY_S64(config->args, where, "-det_id", "detProcessedImfile.det_id", "=="); … … 179 172 PXOPT_COPY_STR(config->args, where, "-select_mode", "detRun.mode", "=="); 180 173 174 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 175 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 176 177 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false); 178 PXOPT_LOOKUP_BOOL(included, config->args, "-included", false); 179 181 180 psString query = pxDataGet("dettool_processedimfile.sql"); 182 181 if (!query) { … … 186 185 } 187 186 187 bool hasWhere = false; 188 188 if (psListLength(where->list)) { 189 189 psString whereClause = psDBGenerateWhereSQL(where, NULL); … … 211 211 212 212 if (faulted) { 213 // list only faulted rows 213 214 psStringAppend(&query, " %s", " detProcessedImfile.fault != 0"); 214 215 } else { -
trunk/ippTools/src/dettool_residimfile.c
r19632 r23229 159 159 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 160 160 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 161 161 162 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false); 163 PXOPT_LOOKUP_BOOL(included, config->args, "-included", false); 162 164 163 165 psString query = pxDataGet("dettool_residimfile.sql"); … … 175 177 } 176 178 psFree(where); 179 180 // restrict search to included imfiles 181 if (included) { 182 if (hasWhere) { 183 psStringAppend(&query, " AND detInputExp.include = 1"); 184 } else { 185 psStringAppend(&query, " WHERE detInputExp.include = 1"); 186 } 187 hasWhere = true; 188 } 177 189 178 190 if (hasWhere) { -
trunk/ippTools/src/warptool.c
r21402 r23229 55 55 static bool updateskyfileMode(pxConfig *config); 56 56 57 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state); 57 58 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); 58 59 static bool isValidMode(pxConfig *config, const char *mode); … … 1604 1605 // shared code for the modes -tocleanedskyfile -tofullskyfile -topurgedskyfile 1605 1606 1607 // XXX EAM : this function was enforcing only certain transitions with the SQL. However, 1608 // this is getting fairly messy now that we have added a few additional target and 1609 // destination states. I'm disabling these restrictions for now; is there are better way 1610 // to enforce the allowed state transitions? 1611 1606 1612 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state) 1607 1613 { … … 1619 1625 } 1620 1626 1627 // XXX this feature is disabled (run_state is ignored) 1621 1628 // note only updates if warpRun.state = run_state 1622 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, skycell_id, run_state)) { 1629 1630 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, skycell_id)) { 1623 1631 psError(PS_ERR_UNKNOWN, false, "database error"); 1624 1632 // rollback … … 1668 1676 PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false); 1669 1677 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 1678 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1670 1679 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 1671 1680 1672 psString query = pxDataGet("warptool_updateskyfile.sql"); 1673 1674 if (!p_psDBRunQueryF(config->dbh, query, code, warp_id, skycell_id)) { 1675 psError(PS_ERR_UNKNOWN, false, "database error"); 1676 return false; 1677 } 1678 psFree(query); 1679 1680 return true; 1681 } 1681 if (state && code) { 1682 psError(PS_ERR_UNKNOWN, true, "only one of -set_state and -code may be supplied"); 1683 return false; 1684 } 1685 1686 if (state) { 1687 // make sure that the state string is valid 1688 if (!pxIsValidState(state)) { 1689 psError(PXTOOLS_ERR_DATA, false, "%s is not a valid state", state); 1690 return false; 1691 } 1692 if (!change_skyfile_data_state(config, state, "unknown")) { 1693 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 1694 return false; 1695 } 1696 return true; 1697 } 1698 1699 if (code) { 1700 psString query = pxDataGet("warptool_updateskyfile.sql"); 1701 1702 if (!p_psDBRunQueryF(config->dbh, query, code, warp_id, skycell_id)) { 1703 psError(PS_ERR_UNKNOWN, false, "database error"); 1704 return false; 1705 } 1706 psFree(query); 1707 return true; 1708 } 1709 1710 psError(PS_ERR_UNKNOWN, true, "one of -set_state or -code must be supplied"); 1711 return false; 1712 } -
trunk/ippTools/src/warptoolConfig.c
r20973 r23229 348 348 psMetadataAddStr(tofullskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL); 349 349 350 // - toupdateskyfile350 // -updateskyfile 351 351 psMetadata *updateskyfileArgs = psMetadataAlloc(); 352 psMetadataAddS64(updateskyfileArgs, PS_LIST_TAIL, "-warp_id", 0,"warptool ID to update", 0);352 psMetadataAddS64(updateskyfileArgs, PS_LIST_TAIL, "-warp_id", 0, "warptool ID to update", 0); 353 353 psMetadataAddStr(updateskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL); 354 psMetadataAddS16(updateskyfileArgs, PS_LIST_TAIL, "-code", 0, "new fault code", 0); 354 psMetadataAddS16(updateskyfileArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0); 355 psMetadataAddStr(updateskyfileArgs, PS_LIST_TAIL, "-set_state", 0, "set state", NULL); 355 356 356 357 psFree(now);
Note:
See TracChangeset
for help on using the changeset viewer.
