Changeset 14023 for trunk/ippTools/src/regtool.c
- Timestamp:
- Jul 5, 2007, 3:16:08 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r14018 r14023 111 111 112 112 // select newImfiles that: 113 // exp_ tagis in newExp114 // don't have their exp_ tagin rawExp115 // XXX having the same exp_ tagin newExp and raw*Exp is probably an error113 // exp_id is in newExp 114 // don't have their exp_id in rawExp 115 // XXX having the same exp_id in newExp and raw*Exp is probably an error 116 116 // that should be checked for 117 117 … … 181 181 PS_ASSERT_PTR_NON_NULL(config, false); 182 182 183 psString query = pxDataGet("regtool_ find_unprocessed_imfile.sql");183 psString query = pxDataGet("regtool_pendingimfile.sql"); 184 184 if (!query) { 185 185 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); … … 188 188 189 189 { 190 // build a query to search by exp_ tag, class, class_id190 // build a query to search by exp_id, class, class_id 191 191 psMetadata *where = psMetadataAlloc(); 192 192 bool status = false; 193 psString exp_ tag = psMetadataLookupStr(&status, config->args, "-exp_tag");193 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 194 194 if (!status) { 195 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ tag");195 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 196 196 psFree(query); 197 197 return false; 198 198 } 199 if (exp_ tag) {200 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ tag", 0, "==", exp_tag)) {201 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ tag");199 if (exp_id) { 200 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) { 201 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 202 202 psFree(where); 203 203 psFree(query); … … 206 206 } 207 207 208 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");208 psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id"); 209 209 if (!status) { 210 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - class_id");210 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id"); 211 211 psFree(query); 212 212 return false; 213 213 } 214 if ( class_id) {215 if (!psMetadataAddStr(where, PS_LIST_TAIL, " class_id", 0, "==",class_id)) {216 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");214 if (tmp_class_id) { 215 if (!psMetadataAddStr(where, PS_LIST_TAIL, "tmp_class_id", 0, "==", tmp_class_id)) { 216 psError(PS_ERR_UNKNOWN, false, "failed to add item tmp_class_id"); 217 217 psFree(where); 218 218 psFree(query); … … 511 511 PS_ASSERT_PTR_NON_NULL(config, false); 512 512 513 // make sure that the exp_ tag(s) are ready to be updated based on:514 // exp_ tagis not in rawExp515 // exp_ tagis not in newImfile513 // make sure that the exp_id(s) are ready to be updated based on: 514 // exp_id is not in rawExp 515 // exp_id is not in newImfile 516 516 // that the correct count of imfiles is in rawImfile 517 517 518 518 bool status = false; 519 psString exp_ tag = psMetadataLookupStr(&status, config->args, "-exp_tag");520 if (!status) { 521 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ tag");522 return false; 523 } 524 if (!exp_ tag) {525 psError(PS_ERR_UNKNOWN, true, "-exp_ tagis required");519 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 520 if (!status) { 521 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 522 return false; 523 } 524 if (!exp_id) { 525 psError(PS_ERR_UNKNOWN, true, "-exp_id is required"); 526 526 return false; 527 527 } … … 539 539 } 540 540 541 if (!p_psDBRunQuery(config->dbh, query, exp_ tag)) {541 if (!p_psDBRunQuery(config->dbh, query, exp_id)) { 542 542 psError(PS_ERR_UNKNOWN, false, "database error"); 543 543 psFree(query); … … 608 608 if (detrend) { 609 609 // set the state for the newExp to stop 610 if (!pxnewExpSetState(config, exp_ tag, "stop")) {610 if (!pxnewExpSetState(config, exp_id, "stop")) { 611 611 // rollback 612 612 if (!psDBRollback(config->dbh)) { 613 613 psError(PS_ERR_UNKNOWN, false, "database error"); 614 614 } 615 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_ tag: %s", exp_tag);615 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id); 616 616 psFree(output); 617 617 return false; … … 622 622 623 623 // set the state for the newExp to stop 624 if (!pxnewExpSetState(config, exp_ tag, "stop")) {624 if (!pxnewExpSetState(config, exp_id, "stop")) { 625 625 // rollback 626 626 if (!psDBRollback(config->dbh)) { 627 627 psError(PS_ERR_UNKNOWN, false, "database error"); 628 628 } 629 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_ tag: %s", exp_tag);629 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id); 630 630 psFree(output); 631 631 return false; … … 634 634 // insert an entry into the chipPendingExp table 635 635 // this can only be run as the newExp's state has been set to stop 636 if (!pxchipQueueByExpTag(config, exp_ tag, NULL, NULL, NULL, NULL, NULL)) {636 if (!pxchipQueueByExpTag(config, exp_id, NULL, NULL, NULL, NULL, NULL)) { 637 637 // rollback 638 638 if (!psDBRollback(config->dbh)) { … … 776 776 { 777 777 return guidePendingExpRowAlloc( 778 newExp->exp_ tag,778 newExp->exp_id, 779 779 newExp->camera, 780 780 newExp->telescope, … … 810 810 chipPendingExpRow *chipExp = chipPendingExpRowAlloc( 811 811 0, // chip ID, assigned by db 812 exp->exp_ tag,812 exp->exp_id, 813 813 0xdeadbeef, // guide version 814 814 label, … … 839 839 840 840 bool status = false; 841 // required 842 psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name"); 843 if (!status) { 844 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name"); 845 return false; 846 } 847 if (!exp_name) { 848 psError(PS_ERR_UNKNOWN, true, "-exp_name is required"); 849 return false; 850 } 851 852 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 853 if (!status) { 854 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst"); 855 return false; 856 } 857 if (!camera) { 858 psError(PS_ERR_UNKNOWN, true, "-inst is required"); 859 return false; 860 } 861 862 psString telescope = psMetadataLookupStr(&status, config->args, "-telescope"); 863 if (!status) { 864 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope"); 865 return false; 866 } 867 if (!telescope) { 868 psError(PS_ERR_UNKNOWN, true, "-telescope is required"); 869 return false; 870 } 871 872 psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles"); 873 if (!status) { 874 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles"); 875 return false; 876 } 877 if (!imfiles) { 878 psError(PS_ERR_UNKNOWN, true, "-imfiles is required"); 879 return false; 880 } 881 882 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 883 if (!status) { 884 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 885 return false; 886 } 887 if (!exp_tag) { 888 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 889 return false; 890 } 891 841 892 // optional 842 893 psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type"); … … 989 1040 990 1041 rawExpRow *raw = rawExpRowAlloc( 991 exp->exp_tag,992 1042 exp->exp_id, 993 exp->camera, 994 exp->telescope, 1043 exp_name, 1044 camera, 1045 telescope, 995 1046 dateobs, 1047 exp_tag, 996 1048 exp_type, 997 exp->imfiles,1049 imfiles, 998 1050 filelevel, 999 1051 exp->workdir, … … 1011 1063 ccd_temp, 1012 1064 posang, 1013 user_1,1014 user_2,1015 user_3,1016 user_4,1017 user_5,1065 user_1, 1066 user_2, 1067 user_3, 1068 user_4, 1069 user_5, 1018 1070 object, 1019 1071 0.0, … … 1035 1087 1036 1088 bool status = false; 1089 // required 1090 psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name"); 1091 if (!status) { 1092 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name"); 1093 return false; 1094 } 1095 if (!exp_name) { 1096 psError(PS_ERR_UNKNOWN, true, "-exp_name is required"); 1097 return false; 1098 } 1099 1100 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 1101 if (!status) { 1102 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst"); 1103 return false; 1104 } 1105 if (!camera) { 1106 psError(PS_ERR_UNKNOWN, true, "-inst is required"); 1107 return false; 1108 } 1109 1110 psString telescope = psMetadataLookupStr(&status, config->args, "-telescope"); 1111 if (!status) { 1112 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope"); 1113 return false; 1114 } 1115 if (!telescope) { 1116 psError(PS_ERR_UNKNOWN, true, "-telescope is required"); 1117 return false; 1118 } 1119 1120 psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id"); 1121 if (!status) { 1122 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id"); 1123 return false; 1124 } 1125 if (!tmp_class_id) { 1126 psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required"); 1127 return false; 1128 } 1129 1130 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 1131 if (!status) { 1132 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id"); 1133 return false; 1134 } 1135 if (!class_id) { 1136 psError(PS_ERR_UNKNOWN, true, "-class_id is required"); 1137 return false; 1138 } 1139 1037 1140 // optional 1038 1141 psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type"); … … 1180 1283 1181 1284 rawImfileRow *raw = rawImfileRowAlloc( 1182 imfile->exp_tag, 1183 imfile->class_id, 1285 imfile->exp_id, 1286 exp_name, 1287 camera, 1288 telescope, 1289 dateobs, 1290 tmp_class_id, 1291 class_id, 1184 1292 imfile->uri, 1185 1293 exp_type, … … 1198 1306 ccd_temp, 1199 1307 posang, 1200 user_1,1201 user_2,1202 user_3,1203 user_4,1204 user_5,1308 user_1, 1309 user_2, 1310 user_3, 1311 user_4, 1312 user_5, 1205 1313 object, 1206 dateobs,1207 1314 code 1208 1315 );
Note:
See TracChangeset
for help on using the changeset viewer.
