Changeset 32422 for trunk/ippTools
- Timestamp:
- Sep 21, 2011, 11:11:16 AM (15 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 1 added
- 6 edited
-
share/Makefile.am (modified) (1 diff)
-
share/laptool_WSdiff_check.sql (added)
-
share/laptool_definerun.sql (modified) (2 diffs)
-
share/laptool_pendingexp.sql (modified) (1 diff)
-
src/laptool.c (modified) (5 diffs)
-
src/laptool.h (modified) (1 diff)
-
src/laptoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/Makefile.am
r32283 r32422 424 424 laptool_pendingexp.sql \ 425 425 laptool_pendingrun.sql \ 426 laptool_WSdiff_check.sql \ 426 427 laptool_stacks.sql 427 428 -
trunk/ippTools/share/laptool_definerun.sql
r31604 r32422 1 SELECT DISTINCT want.exp_id, have.chip_id, false as private, true as active, false as pairwise 1 SELECT DISTINCT 2 want.exp_id, 3 have.chip_id, 4 COALESCE(have.private,false) as private, 5 true as active, 6 false as pairwise 2 7 FROM 3 8 (SELECT exp_id FROM rawExp … … 8 13 ) AS want 9 14 LEFT JOIN 10 (SELECT exp_id,MAX(chip_id) AS chip_id, chipRun.state 15 (SELECT 16 exp_id, 17 MAX(chip_id) AS chip_id, 18 chipRun.state, 19 lapExp.private 11 20 FROM lapExp JOIN chipRun USING(exp_id,chip_id) 12 where private IS FALSE13 ANDchip_id IS NOT NULL21 JOIN lapRun USING(lap_id) 22 where chip_id IS NOT NULL 14 23 AND 15 ( 24 -- This is the restriction to only draw from the current lapSequence 25 @CHIPWHERE@ 26 -- ( 16 27 -- (active = TRUE) OR 17 (chipRun.state = 'full') OR18 (chipRun.state = 'new')28 -- (chipRun.state = 'full') OR 29 -- (chipRun.state = 'new') 19 30 -- when we can do updates, put that here. 20 )31 -- ) 21 32 GROUP BY exp_id 22 33 ) AS have USING(exp_id) -
trunk/ippTools/share/laptool_pendingexp.sql
r31435 r32422 3 3 lapRun.dist_group, lapRun.registered, lapRun.fault, lapRun.quick_sass_id, lapRun.final_sass_id, 4 4 exp_id, chip_id, pair_id, private, pairwise, active, lapExp.data_state, 5 dateobs, object, comment 5 dateobs, object, comment, 6 chipRun.state AS chip_state 6 7 FROM lapRun JOIN lapExp USING(lap_id) 7 8 JOIN rawExp USING(exp_id,filter) 9 LEFT JOIN chipRun USING(exp_id,chip_id) 8 10 WHERE active IS TRUE AND lapRun.fault = 0 9 11 -- lap_id restriction here. -
trunk/ippTools/src/laptool.c
r31827 r32422 30 30 static bool updateexpMode(pxConfig *config); 31 31 32 static bool diffcheckMode(pxConfig *config); 33 32 34 static bool inactiveexpMode(pxConfig *config); 33 35 … … 62 64 MODECASE(LAPTOOL_MODE_UPDATEEXP, updateexpMode); 63 65 66 MODECASE(LAPTOOL_MODE_DIFFCHECK, diffcheckMode); 67 64 68 MODECASE(LAPTOOL_MODE_INACTIVEEXP, inactiveexpMode); 65 69 default: … … 276 280 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 277 281 282 psMetadata *chipWhere = psMetadataAlloc(); 283 PXOPT_COPY_S64(config->args, chipWhere, "-seq_id", "lapRun.seq_id", "=="); 284 278 285 // This seems unnecessarily clunky. 279 286 if (!all_obsmode) { … … 296 303 } 297 304 305 psString chipWhereClause = psDBGenerateWhereConditionSQL(chipWhere,NULL); 298 306 if (whereClause) { 299 307 psStringSubstitute(&query,whereClause,"@WHERE@"); 300 308 } 309 if (chipWhereClause) { 310 psStringSubstitute(&query,chipWhereClause,"@CHIPWHERE@"); 311 } 301 312 psFree(where); 313 psFree(chipWhere); 302 314 303 315 // Fetch exposures … … 755 767 } 756 768 757 758 769 static bool diffcheckMode(pxConfig *config) 770 { 771 PS_ASSERT_PTR_NON_NULL(config, false); 772 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 773 774 psMetadata *where = psMetadataAlloc(); 775 PXOPT_COPY_S64(config->args, where, "-lap_id", "lapRun.lap_id", "=="); 776 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 777 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 778 PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "=="); 779 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 780 PXOPT_COPY_STR(config->args, where, "-skycell_id", "skycell_id", "=="); 781 782 psString query = pxDataGet("laptool_WSdiff_check.sql"); 783 if (!query) { 784 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 785 return(false); 786 } 787 788 if (psListLength(where->list)) { 789 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 790 psStringPrepend(&whereClause, "\n AND "); 791 psStringSubstitute(&query,whereClause,"@WHERE@"); 792 psFree(whereClause); 793 } 794 795 if (!p_psDBRunQuery(config->dbh, query)) { 796 psError(PS_ERR_UNKNOWN, false, "database error"); 797 psFree(query); 798 return false; 799 } 800 psFree(query); 801 802 psArray *output = p_psDBFetchResult(config->dbh); 803 if (!output) { 804 psErrorCode err = psErrorCodeLast(); 805 switch (err) { 806 case PS_ERR_DB_CLIENT: 807 psError(PXTOOLS_ERR_SYS, false, "database error"); 808 case PS_ERR_DB_SERVER: 809 psError(PXTOOLS_ERR_PROG, false, "database error"); 810 default: 811 psError(PXTOOLS_ERR_PROG, false, "unknown error %d",err); 812 } 813 814 return false; 815 } 816 if (!psArrayLength(output)) { 817 psTrace("laptool", PS_LOG_INFO, "no rows found"); 818 psFree(output); 819 return true; 820 } 821 822 if (psArrayLength(output)) { 823 if (!ippdbPrintMetadatas(stdout, output, "lapRunWarpStackSkycells", !simple)) { 824 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 825 psFree(output); 826 return false; 827 } 828 } 829 830 psFree(output); 831 return(true); 832 } 759 833 760 834 static bool inactiveexpMode(pxConfig *config) -
trunk/ippTools/src/laptool.h
r31435 r32422 19 19 LAPTOOL_MODE_STACKS, 20 20 LAPTOOL_MODE_UPDATEEXP, 21 LAPTOOL_MODE_DIFFCHECK, 21 22 LAPTOOL_MODE_INACTIVEEXP 22 23 } laptoolMode; -
trunk/ippTools/src/laptoolConfig.c
r31528 r32422 132 132 ADD_OPT(Bool,updateexpArgs, "-inactive", "set this exposure to active", 0); 133 133 134 // -diffcheck 135 psMetadata *diffcheckArgs = psMetadataAlloc(); 136 ADD_OPT(S64, diffcheckArgs, "-lap_id", "search by lap run ID", 0); 137 ADD_OPT(S64, diffcheckArgs, "-exp_id", "search by exposure ID", 0); 138 ADD_OPT(S64, diffcheckArgs, "-chip_id", "search by chip ID", 0); 139 ADD_OPT(S64, diffcheckArgs, "-warp_id", "search by warp ID", 0); 140 ADD_OPT(S64, diffcheckArgs, "-seq_id", "search by lap sequence ID", 0); 141 ADD_OPT(Str, diffcheckArgs, "-skycell_id", "search by skycell ID", 0); 142 ADD_OPT(Bool, diffcheckArgs, "-simple", "use simple output format", 0); 143 134 144 // -inactiveexp 135 145 psMetadata *inactiveexpArgs = psMetadataAlloc(); … … 152 162 PXOPT_ADD_MODE("-stacks", "", LAPTOOL_MODE_STACKS, stacksArgs); 153 163 PXOPT_ADD_MODE("-updateexp", "", LAPTOOL_MODE_UPDATEEXP, updateexpArgs); 164 PXOPT_ADD_MODE("-diffcheck", "", LAPTOOL_MODE_DIFFCHECK, diffcheckArgs); 154 165 PXOPT_ADD_MODE("-inactiveexp", "", LAPTOOL_MODE_INACTIVEEXP, inactiveexpArgs); 155 166
Note:
See TracChangeset
for help on using the changeset viewer.
