Changeset 24557 for branches/eam_branches/20090522/ippTools/src/warptool.c
- Timestamp:
- Jun 25, 2009, 2:00:56 PM (17 years ago)
- Location:
- branches/eam_branches/20090522
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/warptool.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090522
- Property svn:mergeinfo changed
-
branches/eam_branches/20090522/ippTools/src
- Property svn:ignore
-
old new 34 34 disttool 35 35 receivetool 36 37 pubtool
-
- Property svn:ignore
-
branches/eam_branches/20090522/ippTools/src/warptool.c
r24186 r24557 38 38 static bool tooverlapMode(pxConfig *config); 39 39 static bool addoverlapMode(pxConfig *config); 40 static bool revertoverlapMode(pxConfig *config); 40 41 static bool scmapMode(pxConfig *config); 41 42 static bool towarpedMode(pxConfig *config); … … 86 87 MODECASE(WARPTOOL_MODE_TOOVERLAP, tooverlapMode); 87 88 MODECASE(WARPTOOL_MODE_ADDOVERLAP, addoverlapMode); 89 MODECASE(WARPTOOL_MODE_REVERTOVERLAP, revertoverlapMode); 88 90 MODECASE(WARPTOOL_MODE_SCMAP, scmapMode); 89 91 MODECASE(WARPTOOL_MODE_TOWARPED, towarpedMode); … … 137 139 PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false); 138 140 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); // required (no default TESS) 141 PXOPT_LOOKUP_STR(reduction, config->args, "-reduction", false, false); // required (no default TESS) 139 142 PXOPT_LOOKUP_STR(end_stage, config->args, "-end_stage", false, false); 140 143 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); … … 157 160 dvodb, 158 161 tess_id, 162 reduction, 159 163 end_stage, 160 164 registered, 161 false// magicked165 0 // magicked 162 166 ); 163 167 if (!warpRun) { … … 247 251 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); 248 252 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false); 253 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 249 254 PXOPT_LOOKUP_STR(end_stage, config->args, "-set_end_stage", false, false); 250 255 … … 308 313 } 309 314 310 if (!tess_id && !row->tess_id) {311 psError(PS_ERR_UNKNOWN, false, "cannot queue warp run without a defined tess id: label: %s, fake_id %" PRId64, row->label, row->fake_id);315 if (!tess_id && !row->tess_id) { 316 psError(PS_ERR_UNKNOWN, false, "cannot queue warp run without a defined tess id: label: %s, fake_id %" PRId64, row->label, row->fake_id); 312 317 psFree(output); 313 318 return false; 314 }319 } 315 320 316 321 psFree(row); 317 322 } 318 psFree(output);319 323 320 324 // loop over our list of fakeRun rows … … 331 335 // queue the exp 332 336 if (!pxwarpQueueByFakeID(config, 333 row->fake_id, 334 workdir ? workdir : row->workdir, 335 label ? label : row->label, 336 dvodb ? dvodb : row->dvodb, 337 tess_id ? tess_id : row->tess_id, 338 end_stage ? end_stage : row->end_stage)) 337 row->fake_id, 338 workdir ? workdir : row->workdir, 339 label ? label : row->label, 340 dvodb ? dvodb : row->dvodb, 341 tess_id ? tess_id : row->tess_id, 342 reduction ? reduction : row->reduction, 343 end_stage ? end_stage : row->end_stage)) 339 344 { 340 345 psError(PS_ERR_UNKNOWN, false, "failed to trying to queue fake_id: %" PRId64, row->fake_id); … … 651 656 warpSkyCellMapInsert(config->dbh, 652 657 warp_id, 653 NULL, // skycell_id654 NULL, // tess_id655 NULL, // class_id658 "faulted", // skycell_id 659 "faulted", // tess_id 660 "faulted", // class_id 656 661 fault // fault 657 662 ); … … 666 671 return true; 667 672 } 673 674 static bool revertoverlapMode(pxConfig *config) 675 { 676 PS_ASSERT_PTR_NON_NULL(config, false); 677 678 psMetadata *where = psMetadataAlloc(); 679 PXOPT_COPY_S64(config->args, where, "-warp_id", "warpSkyCellMap.warp_id", "=="); 680 PXOPT_COPY_STR(config->args, where, "-skycell_id", "warpSkyCellMap.skycell_id", "=="); 681 PXOPT_COPY_STR(config->args, where, "-tess_id", "warpSkyCellMap.tess_id", "=="); 682 PXOPT_COPY_STR(config->args, where, "-label", "warpRun.label", "=="); 683 PXOPT_COPY_S16(config->args, where, "-fault", "warpSkyCellMap.fault", "=="); 684 685 if (!psListLength(where->list) 686 && !psMetadataLookupBool(NULL, config->args, "-all")) { 687 psFree(where); 688 psError(PXTOOLS_ERR_DATA, false, "search parameters are required"); 689 return false; 690 } 691 692 int numDeleted; // Number deleted 693 { 694 psString query = pxDataGet("warptool_revertoverlap.sql"); 695 if (!query) { 696 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 697 if (!psDBRollback(config->dbh)) { 698 psError(PS_ERR_UNKNOWN, false, "database error"); 699 } 700 return false; 701 } 702 703 if (psListLength(where->list)) { 704 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 705 psStringAppend(&query, " AND %s", whereClause); 706 psFree(whereClause); 707 } 708 709 if (!p_psDBRunQuery(config->dbh, query)) { 710 psError(PS_ERR_UNKNOWN, false, "database error"); 711 psFree(query); 712 if (!psDBRollback(config->dbh)) { 713 psError(PS_ERR_UNKNOWN, false, "database error"); 714 } 715 return false; 716 } 717 psFree(query); 718 719 numDeleted = psDBAffectedRows(config->dbh); 720 } 721 722 psLogMsg("warptool", PS_LOG_INFO, "Deleted %d warpSkycellMap", numDeleted); 723 724 psFree(where); 725 726 return true; 727 } 728 668 729 669 730 … … 919 980 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 920 981 PXOPT_LOOKUP_F32(good_frac, config->args, "-good_frac", false, false); 921 PXOPT_LOOKUP_ BOOL(magicked, config->args, "-magicked", false);982 PXOPT_LOOKUP_S64(magicked, config->args, "-magicked", false, false); 922 983 923 984 // default values … … 1023 1084 return false; 1024 1085 } 1025 psS 32magicked = psMetadataLookupS64(&status, row, "magicked");1086 psS64 magicked = psMetadataLookupS64(&status, row, "magicked"); 1026 1087 if (!status) { 1027 1088 psError(PS_ERR_UNKNOWN, false, "failed to look up value for magicked"); … … 1224 1285 } 1225 1286 1226 1227 // Update state to 'new'1228 int numUpdated; // Number updated1229 {1230 // This query is no longer necessary because we do not set warpRun's to full statte1231 // if they have faulted skyfiles.1232 // We do have runs in the DB that follow the old convention so we leave this in for1233 // now1234 psString query = pxDataGet("warptool_revertwarped_update.sql");1235 if (!query) {1236 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");1237 if (!psDBRollback(config->dbh)) {1238 psError(PS_ERR_UNKNOWN, false, "database error");1239 }1240 return false;1241 }1242 1243 if (psListLength(where->list)) {1244 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);1245 psStringAppend(&query, " AND %s", whereClause);1246 psFree(whereClause);1247 }1248 1249 if (!p_psDBRunQuery(config->dbh, query)) {1250 psError(PS_ERR_UNKNOWN, false, "database error");1251 psFree(query);1252 if (!psDBRollback(config->dbh)) {1253 psError(PS_ERR_UNKNOWN, false, "database error");1254 }1255 return false;1256 }1257 psFree(query);1258 1259 numUpdated = psDBAffectedRows(config->dbh);1260 1261 #ifdef notdef1262 // new warpRuns won't get changed (they're already new) so don't require an update1263 if (numUpdated < 1) {1264 psError(PS_ERR_UNKNOWN, false, "should have affected at least 1 row");1265 if (!psDBRollback(config->dbh)) {1266 psError(PS_ERR_UNKNOWN, false, "database error");1267 }1268 return false;1269 }1270 #endif1271 }1272 1273 psLogMsg("warptool", PS_LOG_INFO, "Updated %d warp runs", numUpdated);1274 1275 1287 // Delete product 1276 1288 int numDeleted; // Number deleted … … 1744 1756 1745 1757 if (clean) { 1746 bool success = true; 1758 bool success = true; 1747 1759 if (!strcmp(tables[i].tableName, "warpRun")) { 1748 1760 success = pxSetStateCleaned("warpRun", "state", output);
Note:
See TracChangeset
for help on using the changeset viewer.
