Changeset 30675 for branches/eam_branches/ipp-20110213/ippTools
- Timestamp:
- Feb 17, 2011, 3:19:36 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/ippTools
- Files:
-
- 13 edited
-
share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
share/disttool_pending_raw.sql (modified) (5 diffs)
-
share/magicdstool_torevert_camera.sql (modified) (1 diff)
-
share/magicdstool_torevert_chip.sql (modified) (1 diff)
-
share/magicdstool_torevert_diff.sql (modified) (1 diff)
-
share/magicdstool_torevert_raw.sql (modified) (1 diff)
-
share/magicdstool_torevert_warp.sql (modified) (1 diff)
-
share/pxadmin_create_tables.sql (modified) (1 prop)
-
src (modified) (1 prop)
-
src/magicdstool.c (modified) (9 diffs)
-
src/magictool.c (modified) (1 prop)
-
src/regtool.c (modified) (5 diffs)
-
src/regtoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/share/disttool_pending_raw.sql
r30387 r30675 12 12 TRIM(TRAILING '.fits' FROM rawImfile.uri) AS path_base, 13 13 CAST(NULL AS CHAR(255)) AS alt_path_base, 14 chipProcessedImfile.path_base as chip_path_base, 14 -- pass camera stage path base since we want the camera mask file. The script knows what to do 15 camProcessedExp.path_base as chip_path_base, 15 16 CAST(NULL AS CHAR(255)) AS state, 16 17 CAST(NULL AS CHAR(255)) AS data_state, … … 26 27 JOIN chipProcessedImfile 27 28 USING(chip_id, class_id) 29 JOIN camRun USING(chip_id) 30 JOIN camProcessedExp using(cam_id) 28 31 LEFT JOIN distComponent 29 32 ON distRun.dist_id = distComponent.dist_id … … 36 39 AND distComponent.dist_id IS NULL 37 40 AND (rawExp.magicked OR distRun.no_magic) 41 -- need to have magicked the chip image which makes the camera mask 42 AND chipProcessedImfile.magicked != 0 43 AND camRun.magicked > 0 38 44 AND (Label.active OR Label.active IS NULL) 39 45 UNION … … 52 58 TRIM(TRAILING '.fits' FROM rawImfile.uri) AS path_base, 53 59 magicDSFile.backup_path_base AS alt_path_base, 54 chipProcessedImfile.path_base AS chip_path_base, 60 -- pass camera stage path base since we want the camera mask file. The script knows what to do 61 camProcessedExp.path_base AS chip_path_base, 55 62 CAST('full' AS CHAR(255)) AS state, 56 63 CAST('full' AS CHAR(255)) AS data_state, … … 77 84 AND distRun.clean = 0 78 85 AND distComponent.dist_id IS NULL 79 AND chipProcessedImfile. data_state = 'full'80 AND c hipProcessedImfile.magicked > 086 AND chipProcessedImfile.magicked != 0 87 AND camRun.magicked > 0 81 88 AND (Label.active OR Label.active IS NULL) 82 89 UNION -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_camera.sql
r27945 r30675 11 11 camProcessedExp.path_base, 12 12 camProcessedExp.path_base AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_chip.sql
r29561 r30675 11 11 chipProcessedImfile.path_base, 12 12 camProcessedExp.path_base AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_diff.sql
r30256 r30675 13 13 magicDSFile.recovery_path_base, 14 14 "NULL" AS cam_path_base, 15 recovery_path_base, 15 16 CAST(diffRun.bothways AS SIGNED) AS bothways, 16 17 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_raw.sql
r27945 r30675 11 11 rawImfile.uri AS path_base, 12 12 CAST(NULL AS CHAR(255)) AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_warp.sql
r27945 r30675 11 11 warpSkyfile.path_base, 12 12 "NULL" AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src (added) merged: 30639,30652,30671
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110213/ippTools/src/magicdstool.c
r30548 r30675 709 709 710 710 711 // update the magicked column for the underlying component 712 // Note: Must be called inside a transaction 713 711 714 static bool 712 setMagicked(pxConfig *config, psS64 magic_ds_id, psString component )715 setMagicked(pxConfig *config, psS64 magic_ds_id, psString component, bool clearMagicked) 713 716 { 714 717 // first query the magicDSRun to find the stage and the stage_id … … 741 744 psS64 stage_id = psMetadataLookupS64(NULL, row, "stage_id"); 742 745 psS64 magic_id = psMetadataLookupS64(NULL, row, "magic_id"); 746 psFree(output); 747 748 psS64 newMagickedValue; 749 if (clearMagicked) { 750 newMagickedValue = 0; 751 } else { 752 newMagickedValue = magic_id; 753 } 743 754 744 755 ippStage stageNum = ippStringToStage(stage); 745 756 746 757 // chose the appropriate query based on the stage 758 char *clearRunQuery = NULL; 747 759 switch (stageNum) { 748 760 case IPP_STAGE_RAW: 749 761 query = "UPDATE rawImfile SET magicked = %" PRId64 " where exp_id = %" PRId64 " AND class_id = '%s'"; 762 clearRunQuery = "UPDATE rawExp SET magicked = 0 where exp_id = %" PRId64; 750 763 break; 751 764 case IPP_STAGE_CHIP: 752 765 query = "UPDATE chipProcessedImfile SET magicked = %" PRId64 " where chip_id = %" PRId64 " AND class_id = '%s'"; 766 clearRunQuery = "UPDATE chipRun set magicked = 0 where chip_id = %" PRId64; 753 767 break; 754 768 case IPP_STAGE_CHIP_BG: 755 769 query = "UPDATE chipBackgroundImfile SET magicked = %" PRId64 " where chip_bg_id = %" PRId64 " AND class_id = '%s'"; 770 clearRunQuery = "UPDATE chipBackgroundRun SET magicked = 0 where chip_bg_id = %" PRId64; 756 771 break; 757 772 case IPP_STAGE_CAMERA: 758 // no there is no magicked column in camProcessedExp so we have nothing to do 759 psFree(output); 760 return true; 773 psFree(query); 774 query = NULL; 775 clearRunQuery = "UPDATE chipBackgroundRun SET magicked = 0 where chip_bg_id = %" PRId64; 776 break; 761 777 case IPP_STAGE_WARP: 762 778 query = "UPDATE warpSkyfile SET magicked = %" PRId64 " where warp_id = %" PRId64 " AND skycell_id = '%s'"; 779 clearRunQuery = "UPDATE warpRun SET magicked = 0 where warp_id = %" PRId64; 763 780 break; 764 781 case IPP_STAGE_WARP_BG: 765 782 query = "UPDATE warpBackgroundSkyfile SET magicked = %" PRId64 " where warp_bg_id = %" PRId64 " AND skycell_id = '%s'"; 783 clearRunQuery = "UPDATE warpBackgroundRun SET magicked = 0 where warp_bg_id = %" PRId64; 766 784 break; 767 785 case IPP_STAGE_DIFF: 768 786 query = "UPDATE diffSkyfile SET magicked = %" PRId64 " where diff_id = %" PRId64 " AND skycell_id = '%s'"; 787 clearRunQuery = "UPDATE diffRun SET magicked = 0 where diff_id = %" PRId64; 769 788 break; 770 789 default: 771 790 psError(PS_ERR_UNKNOWN, true, "unexpected value for stage: %s found", stage); 772 psFree(output); 773 return false; 774 } 775 776 if (!p_psDBRunQueryF(config->dbh, query, magic_id, stage_id, component)) { 777 psError(PS_ERR_UNKNOWN, false, "database error"); 778 return false; 779 } 780 psFree(output); 781 782 psU64 affected = psDBAffectedRows(config->dbh); 783 if (affected != 1) { 784 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 785 return false; 791 return false; 792 } 793 794 if (query) { 795 if (!p_psDBRunQueryF(config->dbh, query, newMagickedValue, stage_id, component)) { 796 psError(PS_ERR_UNKNOWN, false, "database error"); 797 return false; 798 } 799 } 800 801 if (clearMagicked && clearRunQuery) { 802 if (!p_psDBRunQueryF(config->dbh, clearRunQuery, stage_id)) { 803 psError(PS_ERR_UNKNOWN, false, "database error"); 804 return false; 805 } 786 806 } 787 807 … … 896 916 if (setmagicked) { 897 917 // set the image file's magicked flag 898 if (!setMagicked(config, magic_ds_id, component )) {918 if (!setMagicked(config, magic_ds_id, component, false)) { 899 919 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 900 920 if (!psDBRollback(config->dbh)) { … … 1111 1131 pxAddLabelSearchArgs (config, where, "-label", "label", "=="); 1112 1132 1133 PXOPT_LOOKUP_S64(magic_ds_id, config->args, "-magic_ds_id", true, false); 1134 PXOPT_LOOKUP_STR(component, config->args, "-component", true, false); 1113 1135 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 1114 1136 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); … … 1116 1138 psString queryFile = NULL; 1117 1139 bool stateIsUpdate = false; 1140 bool toRestored = !strcmp(state, "goto_restored"); 1118 1141 if (state) { 1119 if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) {1142 if (! strcmp(state, "new") || toRestored) { 1120 1143 queryFile = "magicdstool_revertdestreakedfile.sql"; 1121 1144 } else if (!strcmp(state, "update")) { … … 1153 1176 } 1154 1177 1178 if (!psDBTransaction(config->dbh)) { 1179 psError(PS_ERR_UNKNOWN, false, "database error"); 1180 return false; 1181 } 1155 1182 if (!p_psDBRunQuery(config->dbh, query)) { 1156 1183 psError(PS_ERR_UNKNOWN, false, "failed to revert"); … … 1159 1186 } 1160 1187 psFree(query); 1188 if (toRestored) { 1189 // clear the underlying component's magicked value 1190 if (!setMagicked(config, magic_ds_id, component, true)) { 1191 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 1192 if (!psDBRollback(config->dbh)) { 1193 psError(PS_ERR_UNKNOWN, false, "database error"); 1194 } 1195 return false; 1196 } 1197 } 1198 if (!psDBCommit(config->dbh)) { 1199 psError(PS_ERR_UNKNOWN, false, "database error"); 1200 return false; 1201 } 1161 1202 return true; 1162 1203 } … … 1661 1702 } 1662 1703 if (!strcmp(data_state, "full")) { 1663 // if -tofullfile optoinally set the magicked value for the component 1664 PXOPT_LOOKUP_BOOL(setmagicked, config->args, "-setmagicked", false); 1665 // set the image file's magicked flag 1666 if (!setMagicked(config, magic_ds_id, component)) { 1704 // set the component's magicked flag 1705 1706 if (!setMagicked(config, magic_ds_id, component, false)) { 1667 1707 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 1668 1708 if (!psDBRollback(config->dbh)) { … … 1716 1756 return change_file_data_state(config, "full"); 1717 1757 } 1718 /*1719 static bool topurgedimfileMode(pxConfig *config)1720 {1721 return change_imfile_data_state(config, "purged", "goto_purged");1722 }1723 static bool toscrubbedfileMode(pxConfig *config)1724 {1725 return change_file_data_state(config, "scrubbed", "goto_scrubbed");1726 }1727 */1728 1758 1729 1759 // a very specfic function to queue a cleaned magicDSFile to be updated -
branches/eam_branches/ipp-20110213/ippTools/src/magictool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/src/regtool.c
r30594 r30675 259 259 continue; 260 260 } 261 char *is_ccim = strchr(psMetadataLookupStr(NULL,row,"exp_name"),'c'); 262 if (is_ccim) { // Is a camera commanded exposure 263 // fprintf(stderr,"IN camera commanded!\n"); 264 if ((strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DOMEFLAT") == 0)|| 265 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DARK") == 0) || 266 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"BIAS") == 0)) { 267 continue; 268 } 269 } 261 270 262 271 if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)|| … … 367 376 } 368 377 378 char *is_ccim = strchr(psMetadataLookupStr(NULL,row,"exp_name"),'c'); 379 if (is_ccim) { // Is a camera commanded exposure 380 // fprintf(stderr,"IN camera commanded!\n"); 381 if ((strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DOMEFLAT") == 0)|| 382 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DARK") == 0) || 383 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"BIAS") == 0)) { 384 continue; 385 } 386 } 387 369 388 bool status = false; 370 389 char *tmp_id = psMetadataLookupStr(&status,row,"summit_class_id"); … … 389 408 } 390 409 410 391 411 if (0 && !strcmp(this_class_id, "ota44")) { 392 412 printf("STAT 1: %s (%d %d) %d %d %d\n", … … 857 877 PXOPT_LOOKUP_STR(set_md5sum, config->args, "-set_md5sum", false, false); 858 878 PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false); 859 879 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 880 860 881 if ((fault == INT16_MAX) && (burntool_state == INT16_MAX) && !set_state) { 861 882 psError(PS_ERR_UNKNOWN, false, "one of -fault or -burntool_state or -set_state must be selected"); … … 905 926 psStringAppend(&setvalues,"rawImfile.data_state = '%s'",set_state); 906 927 } 907 928 if (hostname) { 929 if (setvalues) { 930 psStringAppend(&setvalues,","); 931 } 932 psStringAppend(&setvalues,"rawImfile.hostname = '%s'", hostname); 933 } 908 934 psString query = pxDataGet("regtool_updateprocessedimfile.sql"); 909 935 if (!query) { -
branches/eam_branches/ipp-20110213/ippTools/src/regtoolConfig.c
r30352 r30675 189 189 ADD_OPT(S16, updateprocessedimfileArgs, "-burntool_state", "set burntool state", INT16_MAX); 190 190 ADD_OPT(S16, updateprocessedimfileArgs, "-fault", "set fault code", INT16_MAX); 191 ADD_OPT(Str, updateprocessedimfileArgs, "-hostname", "set host name", NULL); 191 192 ADD_OPT(S32, updateprocessedimfileArgs, "-set_bytes", "set bytes", INT32_MAX); 192 193 ADD_OPT(Str, updateprocessedimfileArgs, "-set_md5sum", "set md5sum", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
