Changeset 12024
- Timestamp:
- Feb 23, 2007, 3:41:56 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
-
dbconfig/config.md (modified) (1 diff)
-
dbconfig/p4.md (modified) (4 diffs)
-
dbconfig/p5.md (modified) (3 diffs)
-
dbconfig/p6.md (modified) (2 diffs)
-
dbconfig/tasks.md (modified) (10 diffs)
-
ippTools/scripts/camtest.sh (modified) (1 diff)
-
ippTools/scripts/chiptest.sh (modified) (1 diff)
-
ippTools/scripts/dettest.sh (modified) (1 diff)
-
ippTools/scripts/difftest.sh (modified) (1 diff)
-
ippTools/scripts/mapfile.txt (modified) (1 diff)
-
ippTools/scripts/regtest.sh (modified) (2 diffs)
-
ippTools/scripts/warptest.sh (modified) (1 diff)
-
ippTools/src/camtool.c (modified) (23 diffs)
-
ippTools/src/camtoolConfig.c (modified) (2 diffs)
-
ippTools/src/chiptool.c (modified) (34 diffs)
-
ippTools/src/dettool.c (modified) (1 diff)
-
ippTools/src/dettoolConfig.c (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (23 diffs)
-
ippTools/src/difftoolConfig.c (modified) (8 diffs)
-
ippTools/src/guidetool.c (modified) (6 diffs)
-
ippTools/src/guidetoolConfig.c (modified) (3 diffs)
-
ippTools/src/pxtables.c (modified) (5 diffs)
-
ippTools/src/regtool.c (modified) (9 diffs)
-
ippTools/src/stacktool.c (modified) (24 diffs)
-
ippTools/src/warptool.c (modified) (35 diffs)
-
ippTools/src/warptoolConfig.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/config.md
r11979 r12024 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 1.1.1 04 pkg_version STR 1.1.11 5 5 END -
trunk/dbconfig/p4.md
r11984 r12024 1 # $Id: p4.md,v 1.1 5 2007-02-22 01:54:56jhoblitt Exp $1 # $Id: p4.md,v 1.16 2007-02-24 01:40:38 jhoblitt Exp $ 2 2 3 3 # … … 8 8 # 9 9 10 # define a new p4run for a single skycell11 p4Run METADATA12 p4_idS32 0 # Primary Key AUTO_INCREMENT10 # define a new warprun for a single skycell 11 warpRun METADATA 12 warp_id S32 0 # Primary Key AUTO_INCREMENT 13 13 mode STR 64 # Key 14 14 state STR 64 # Key … … 23 23 24 24 # the list of imfiles in our skycell keyed against phase 3 25 # only allow one p3_version of an exp_tag per p4Run26 p4InputExp METADATA27 p4_idS32 0 # Primary Key25 # only allow one cam_version of an exp_tag per warpRun 26 warpInputExp METADATA 27 warp_id S32 0 # Primary Key 28 28 exp_tag STR 64 # Primary Key 29 p3_version S32 0 # Key29 cam_version S32 0 # Key 30 30 # if magic is T then look for the exp_tag in the magic output tables 31 31 magiced BOOL f # Key 32 32 END 33 33 34 p4SkyCellMap METADATA35 p4_idS32 0 # Primary Key34 warpSkyCellMap METADATA 35 warp_id S32 0 # Primary Key 36 36 skycell_id STR 64 # Primary Key 37 37 tess_id STR 64 # Primary Key 38 38 exp_tag STR 64 # Primary Key 39 p3_version S32 0 # Primary Key39 cam_version S32 0 # Primary Key 40 40 # class is not yet consistently carried through pXtools 41 41 # class STR 64 # Primary Key … … 43 43 END 44 44 45 p4Skyfile METADATA46 p4_idS32 0 # Primary Key45 warpSkyfile METADATA 46 warp_id S32 0 # Primary Key 47 47 skycell_id STR 64 # Primary Key 48 48 tess_id STR 64 # Primary Key -
trunk/dbconfig/p5.md
r11984 r12024 1 # $Id: p5.md,v 1. 6 2007-02-22 01:54:56jhoblitt Exp $1 # $Id: p5.md,v 1.7 2007-02-24 01:40:38 jhoblitt Exp $ 2 2 3 p5Run METADATA4 p5_idS32 0 # Primary Key AUTO_INCREMENT3 diffRun METADATA 4 diff_id S32 0 # Primary Key AUTO_INCREMENT 5 5 state STR 64 # Key 6 6 workdir STR 255 … … 16 16 17 17 # only ever 2 per run 18 p5InputSkyfile METADATA19 p5_idS32 0 # Primary Key20 p4_idS32 0 # Primary Key18 diffInputSkyfile METADATA 19 diff_id S32 0 # Primary Key 20 warp_id S32 0 # Primary Key 21 21 skycell_id STR 64 # Primary Key 22 22 tess_id STR 64 # Primary Key … … 26 26 END 27 27 28 p5DiffSkyfile METADATA29 p5_idS32 0 # Primary Key28 diffSkyfile METADATA 29 diff_id S32 0 # Primary Key 30 30 uri STR 255 31 31 bg F64 0.0 -
trunk/dbconfig/p6.md
r11984 r12024 1 # $Id: p6.md,v 1. 6 2007-02-22 01:54:56jhoblitt Exp $1 # $Id: p6.md,v 1.7 2007-02-24 01:40:38 jhoblitt Exp $ 2 2 3 p6Run METADATA4 p6_idS32 0 # Primary Key AUTO_INCREMENT3 stackRun METADATA 4 stack_id S32 0 # Primary Key AUTO_INCREMENT 5 5 state STR 64 # Key 6 6 workdir STR 255 … … 11 11 END 12 12 13 p6InputSkyfile METADATA14 p6_idS32 0 # Primary Key15 p4_idS32 0 # Primary Key13 stackInputSkyfile METADATA 14 stack_id S32 0 # Primary Key 15 warp_id S32 0 # Primary Key 16 16 END 17 17 18 p6SumSkyfile METADATA19 p6_idS32 0 # Primary Key18 stackSumSkyfile METADATA 19 stack_id S32 0 # Primary Key 20 20 uri STR 255 21 21 bg F64 0.0 -
trunk/dbconfig/tasks.md
r11872 r12024 1 # $Id: tasks.md,v 1.1 19 2007-02-17 04:14:23jhoblitt Exp $1 # $Id: tasks.md,v 1.120 2007-02-24 01:40:38 jhoblitt Exp $ 2 2 3 3 # this table records all exposure ID ever seen from the summit … … 154 154 # 155 155 156 p1PendingExp METADATA157 exp_tag STR 64 # Primary Key 158 p1_version S32 0 # Primary Key156 guidePendingExp METADATA 157 exp_tag STR 64 # Primary Key 158 guide_version S32 0 # Primary Key 159 159 recipe STR 64 160 160 END … … 163 163 # class is missing 164 164 165 p2PendingExp METADATA166 exp_tag STR 64 # Primary Key 167 p2_version S32 0 # Primary Key168 p1_version S32 0165 chipPendingExp METADATA 166 exp_tag STR 64 # Primary Key 167 chip_version S32 0 # Primary Key 168 guide_version S32 0 169 169 label STR 64 # key 170 170 recipe STR 64 … … 175 175 # uris in & out ? 176 176 177 p2PendingImfile METADATA178 exp_tag STR 64 # Primary Key 179 p2_version S32 0 # Primary Key180 p1_version S32 0177 chipPendingImfile METADATA 178 exp_tag STR 64 # Primary Key 179 chip_version S32 0 # Primary Key 180 guide_version S32 0 181 181 class_id STR 64 # Primary Key 182 182 recipe STR 64 … … 187 187 # and/or logging imfile done better? 188 188 189 p2ProcessedExp METADATA190 exp_tag STR 64 # Primary Key 191 p2_version S32 0 # Primary Key192 p1_version S32 0189 chipProcessedExp METADATA 190 exp_tag STR 64 # Primary Key 191 chip_version S32 0 # Primary Key 192 guide_version S32 0 193 193 label STR 64 # key 194 194 expgroup STR 64 # key … … 196 196 END 197 197 198 p2Mask METADATA198 chipMask METADATA 199 199 label STR 64 # Primary Key 200 200 END … … 203 203 # state? 204 204 205 p2ProcessedImfile METADATA206 exp_tag STR 64 # Primary Key 207 p2_version S32 0 # Primary Key208 p1_version S32 0205 chipProcessedImfile METADATA 206 exp_tag STR 64 # Primary Key 207 chip_version S32 0 # Primary Key 208 guide_version S32 0 209 209 class_id STR 64 # Primary Key 210 210 recipe STR 64 … … 220 220 # imfiles is not here... is it needed? 221 221 222 p3PendingExp METADATA223 exp_tag STR 64 # Primary Key 224 p3_version S32 0 # Primary Key225 p2_version S32 0222 camPendingExp METADATA 223 exp_tag STR 64 # Primary Key 224 cam_version S32 0 # Primary Key 225 chip_version S32 0 226 226 label STR 64 # key 227 227 expgroup STR 64 # key … … 229 229 END 230 230 231 p3ProcessedExp METADATA232 exp_tag STR 64 # Primary Key 233 p3_version S32 0 # Primary Key234 p2_version S32 0231 camProcessedExp METADATA 232 exp_tag STR 64 # Primary Key 233 cam_version S32 0 # Primary Key 234 chip_version S32 0 235 235 label STR 64 # key 236 236 uri STR 255 … … 251 251 END 252 252 253 p3Mask METADATA253 camMask METADATA 254 254 label STR 64 # Primary Key 255 255 END -
trunk/ippTools/scripts/camtest.sh
r10962 r12024 3 3 set -o verbose 4 4 5 p2test.sh || exit 15 chiptest.sh || exit 1 6 6 7 p3tool -pendingexp || exit 18 p3tool -pendingimfile || exit 17 camtool -pendingexp || exit 1 8 camtool -pendingimfile || exit 1 9 9 10 p3tool -addprocessedexp -exp_tag t10.1 -uri file://p3p -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -b1_uri file:///foo -b2_uri file://bar -zp_mean 1 -zp_stdev 2 || exit 111 p3tool -addprocessedexp -exp_tag t11.2 -uri file://p3p -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -b1_uri file:///foo -b2_uri file://bar -zp_mean 1 -zp_stdev 2 || exit 110 camtool -addprocessedexp -exp_tag t10.1 -uri file://camp -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -b1_uri file:///foo -b2_uri file://bar -zp_mean 1 -zp_stdev 2 || exit 1 11 camtool -addprocessedexp -exp_tag t11.2 -uri file://camp -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -b1_uri file:///foo -b2_uri file://bar -zp_mean 1 -zp_stdev 2 || exit 1 -
trunk/ippTools/scripts/chiptest.sh
r11022 r12024 3 3 set -o verbose 4 4 5 p0test.sh || exit 15 regtest.sh || exit 1 6 6 7 p2tool -pendingimfile || exit 17 chiptool -pendingimfile || exit 1 8 8 9 9 for ID in `seq 0 3`; do 10 p2tool -addprocessedimfile -exp_tag t10.1 -class_id $ID -uri file://p2p-t10.$ID -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri file:///foo -b2_uri file://bar || exit 110 chiptool -addprocessedimfile -exp_tag t10.1 -class_id $ID -uri file://chipp-t10.$ID -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri file:///foo -b2_uri file://bar || exit 1 11 11 done; 12 12 13 13 for ID in `seq 0 3`; do 14 p2tool -addprocessedimfile -exp_tag t11.2 -class_id $ID -uri file://p2p-t11.$ID -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri file:///foo -b2_uri file://bar || exit 114 chiptool -addprocessedimfile -exp_tag t11.2 -class_id $ID -uri file://chipp-t11.$ID -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri file:///foo -b2_uri file://bar || exit 1 15 15 done; 16 16 17 p2tool -pendingimfile || exit 117 chiptool -pendingimfile || exit 1 -
trunk/ippTools/scripts/dettest.sh
r11197 r12024 5 5 det_id=1 6 6 7 ./ p0test.sh -detrend || exit 17 ./regtest.sh -detrend || exit 1 8 8 9 9 det_id=`dettool -definebyquery -det_type flat -exp_type fooflat -filter foo -airmass_min 1 -airmass_max 10 -exp_time_min 10 -exp_time_max 30.0 -workdir file::///some/path -simple | cut -f1 -d" "` || exit 1 -
trunk/ippTools/scripts/difftest.sh
r11987 r12024 3 3 set -o verbose 4 4 5 p4test.sh || exit 15 warptest.sh || exit 1 6 6 7 7 8 p5tool -definerun -workdir file:///tmp/p5-skycell_id foo -tess_id bar || exit 19 p5tool -addinputskyfile -p5_id 2 -p4_id 1 -skycell_id foo1 -tess_id bar1 -kind warped -template || exit 110 p5tool -addinputskyfile -p5_id 2 -p4_id 1 -skycell_id foo2 -tess_id bar2 -kind warped || exit 111 p5tool -updaterun -state run -p5_id 1 || exit 112 p5tool -todiffskyfile || exit 113 p5tool -inputskyfile || exit 114 p5tool -adddiffskyfile -p5_id 1 -uri file:///tmp/p5/skyfile -bg 1 -bg_mean_stdev 2 || exit 115 p5tool -diffskyfile -p5_id 1 || exit 116 p5tool -updaterun -state stop -p5_id 1 || exit 18 difftool -definerun -workdir file:///tmp/diff -skycell_id foo -tess_id bar || exit 1 9 difftool -addinputskyfile -diff_id 2 -warp_id 1 -skycell_id foo1 -tess_id bar1 -kind warped -template || exit 1 10 difftool -addinputskyfile -diff_id 2 -warp_id 1 -skycell_id foo2 -tess_id bar2 -kind warped || exit 1 11 difftool -updaterun -state run -diff_id 1 || exit 1 12 difftool -todiffskyfile || exit 1 13 difftool -inputskyfile || exit 1 14 difftool -adddiffskyfile -diff_id 1 -uri file:///tmp/diff/skyfile -bg 1 -bg_mean_stdev 2 || exit 1 15 difftool -diffskyfile -diff_id 1 || exit 1 16 difftool -updaterun -state stop -diff_id 1 || exit 1 -
trunk/ippTools/scripts/mapfile.txt
r11807 r12024 1 p4SkyCellMap MULTI1 warpSkyCellMap MULTI 2 2 3 p4SkyCellMap METADATA4 p4_id S32 15 skycell_id STR foo 6 tess_id STR bar 27 exp_tag STR baz28 p3_version S32 09 class_id STR quix 3 warpSkyCellMap METADATA 4 warp_id S32 1 5 skycell_id STR foo1 6 tess_id STR bar 7 exp_tag STR t10.1 8 cam_version S32 0 9 class_id STR quix1 10 10 END 11 11 12 p4SkyCellMap METADATA13 p4_id S32 112 warpSkyCellMap METADATA 13 warp_id S32 1 14 14 skycell_id STR foo2 15 tess_id STR bar 216 exp_tag STR baz17 p3_version S32 018 class_id STR quix 15 tess_id STR bar 16 exp_tag STR t10.1 17 cam_version S32 0 18 class_id STR quix2 19 19 END -
trunk/ippTools/scripts/regtest.sh
r11142 r12024 4 4 5 5 inject="pxinject" 6 p0tool="p0tool"6 regtool="regtool" 7 7 8 8 echo -e "YES\nipp\n\n" | pxadmin -recreate || exit 1 … … 20 20 done; 21 21 22 $ p0tool -pendingimfile || exit 122 $regtool -pendingimfile || exit 1 23 23 24 24 for ID in `seq 0 3`; do 25 $ p0tool -addprocessedimfile -exp_tag $exp_tag1 -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 -object dog -dateobs 2006-10-20T10:10:10Z || exit 125 $regtool -addprocessedimfile -exp_tag $exp_tag1 -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 -object dog -dateobs 2006-10-20T10:10:10Z || exit 1 26 26 done; 27 27 28 $ p0tool -pendingexp|| exit 128 $regtool -pendingexp|| exit 1 29 29 30 $ p0tool -addprocessedexp -exp_tag $exp_tag1 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 -object dog -dateobs "2006-10-20T10:10:10Z" -label foobar $* || exit 130 $regtool -addprocessedexp -exp_tag $exp_tag1 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 -object dog -dateobs "2006-10-20T10:10:10Z" -label foobar $* || exit 1 31 31 32 $ p0tool -pendingimfile || exit 132 $regtool -pendingimfile || exit 1 33 33 34 34 for ID in `seq 0 3`; do 35 $ p0tool -addprocessedimfile -exp_tag $exp_tag2 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 -object dog -dateobs 2006-10-20T10:10:10Z || exit 135 $regtool -addprocessedimfile -exp_tag $exp_tag2 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 -object dog -dateobs 2006-10-20T10:10:10Z || exit 1 36 36 done; 37 37 38 $ p0tool -pendingexp|| exit 138 $regtool -pendingexp|| exit 1 39 39 40 $ p0tool -addprocessedexp -exp_tag $exp_tag2 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 -object dog -dateobs 2006-10-20T10:10:10Z -label foobar $* || exit 140 $regtool -addprocessedexp -exp_tag $exp_tag2 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 -object dog -dateobs 2006-10-20T10:10:10Z -label foobar $* || exit 1 -
trunk/ippTools/scripts/warptest.sh
r11987 r12024 3 3 set -o verbose 4 4 5 p3test.sh || exit 15 camtest.sh || exit 1 6 6 7 p4tool -definerun -mode warp -workdir file:///foo || exit 17 warptool -definerun -mode warp -workdir file:///foo || exit 1 8 8 9 p4tool -addinputexp -p4_id 1 -exp_tag t10.1 -p3_version 0 || exit 19 warptool -addinputexp -warp_id 1 -exp_tag t10.1 -cam_version 0 || exit 1 10 10 11 p4tool -updaterun -p4_id 1 -state run || exit 111 warptool -updaterun -warp_id 1 -state run || exit 1 12 12 13 p4tool -exp -p4_id 1 || exit 113 warptool -exp -warp_id 1 || exit 1 14 14 15 p4tool -imfile -p4_id 1 || exit 115 warptool -imfile -warp_id 1 || exit 1 16 16 17 p4tool -tooverlap -p4_id 1 || exit 117 warptool -tooverlap -warp_id 1 || exit 1 18 18 19 p4tool -addoverlap -mapfile mapfile.txt || exit 119 warptool -addoverlap -mapfile mapfile.txt || exit 1 20 20 21 p4tool -scmap || exit 121 warptool -scmap || exit 1 22 22 23 p4tool -towarped || exit 123 warptool -towarped || exit 1 24 24 25 p4tool -addwarped -p4_id 1 -skycell_id foo1 -tess_id bar -uri file:///tmp/foo -bg 1 -bg_mean_stdev 2 || exit 126 p4tool -addwarped -p4_id 1 -skycell_id foo2 -tess_id bar -uri file:///tmp/foo -bg 1 -bg_mean_stdev 2 || exit 125 warptool -addwarped -warp_id 1 -skycell_id foo1 -tess_id bar -uri file:///tmp/foo -bg 1 -bg_mean_stdev 2 || exit 1 26 warptool -addwarped -warp_id 1 -skycell_id foo2 -tess_id bar -uri file:///tmp/foo -bg 1 -bg_mean_stdev 2 || exit 1 27 27 28 p4tool -warped -p4_id 1 || exit 128 warptool -warped -warp_id 1 || exit 1 29 29 30 # p4tool -updaterun -p4_id 1 -state stop || exit 130 #warptool -updaterun -warp_id 1 -state stop || exit 1 -
trunk/ippTools/src/camtool.c
r11997 r12024 96 96 psString query = psStringCopy( 97 97 "SELECT" 98 " p3PendingExp.*,"98 " camPendingExp.*," 99 99 " rawExp.camera," 100 100 " rawExp.workdir" 101 " FROM p3PendingExp"101 " FROM camPendingExp" 102 102 " JOIN rawExp" 103 103 " USING(exp_tag)" 104 " LEFT JOIN p3ProcessedExp"104 " LEFT JOIN camProcessedExp" 105 105 " USING(exp_tag)" 106 " LEFT JOIN p3Mask"107 " ON p3PendingExp.label = p3Mask.label"106 " LEFT JOIN camMask" 107 " ON camPendingExp.label = camMask.label" 108 108 " WHERE" 109 " p3ProcessedExp.exp_tag IS NULL"110 " AND p3Mask.label IS NULL"109 " camProcessedExp.exp_tag IS NULL" 110 " AND camMask.label IS NULL" 111 111 ); 112 112 113 113 if (config->where) { 114 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p3PendingExp");114 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "camPendingExp"); 115 115 psStringAppend(&query, " AND %s", whereClause); 116 116 psFree(whereClause); … … 138 138 if (!psArrayLength(output)) { 139 139 // XXX check psError here 140 psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");140 psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found"); 141 141 psFree(output); 142 142 return true; … … 154 154 155 155 // negate simple so the default is true 156 if (!ippdbPrintMetadatas(stdout, output, " p3PendingExp", !simple)) {156 if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) { 157 157 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 158 158 psFree(output); … … 171 171 psString query = psStringCopy( 172 172 "SELECT" 173 " p2ProcessedImfile.*,"173 " chipProcessedImfile.*," 174 174 " rawExp.camera," 175 175 " rawExp.workdir" 176 " FROM p3PendingExp"177 " JOIN p2ProcessedImfile"178 " USING(exp_tag, p2_version)"176 " FROM camPendingExp" 177 " JOIN chipProcessedImfile" 178 " USING(exp_tag, chip_version)" 179 179 " JOIN rawExp" 180 180 " USING(exp_tag)" 181 " LEFT JOIN p3ProcessedExp"181 " LEFT JOIN camProcessedExp" 182 182 " USING(exp_tag)" 183 " LEFT JOIN p3Mask"184 " ON p3PendingExp.label = p3Mask.label"183 " LEFT JOIN camMask" 184 " ON camPendingExp.label = camMask.label" 185 185 " WHERE" 186 " p3ProcessedExp.exp_tag IS NULL"187 " AND p3Mask.label IS NULL"186 " camProcessedExp.exp_tag IS NULL" 187 " AND camMask.label IS NULL" 188 188 ); 189 189 190 190 if (config->where) { 191 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p2ProcessedImfile");191 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile"); 192 192 psStringAppend(&query, " AND %s", whereClause); 193 193 psFree(whereClause); … … 208 208 if (!psArrayLength(output)) { 209 209 // XXX check psError here 210 psError(PS_ERR_UNKNOWN, false, "no pending p2ProcessedImfile rows found");210 psError(PS_ERR_UNKNOWN, false, "no pending chipProcessedImfile rows found"); 211 211 psFree(output); 212 212 return true; … … 224 224 225 225 // negate simple so the default is true 226 if (!ippdbPrintMetadatas(stdout, output, " p2ProcessedImfile", !simple)) {226 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 227 227 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 228 228 psFree(output); … … 362 362 363 363 psString query = psStringCopy( 364 "SELECT p3PendingExp.*"365 " FROM p3PendingExp"366 " LEFT JOIN p3ProcessedExp"364 "SELECT camPendingExp.*" 365 " FROM camPendingExp" 366 " LEFT JOIN camProcessedExp" 367 367 " USING(exp_tag)" 368 368 " WHERE" 369 " p3ProcessedExp.exp_tag IS NULL"370 " AND p3PendingExp.exp_tag = '%s'"369 " camProcessedExp.exp_tag IS NULL" 370 " AND camPendingExp.exp_tag = '%s'" 371 371 ); 372 372 … … 384 384 } 385 385 if (!psArrayLength(output)) { 386 psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");386 psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found"); 387 387 psFree(output); 388 388 return true; … … 390 390 391 391 // start a transaction so we don't end up with an exp_tag is both 392 // p3PendingExp & p3ProcessedExp392 // camPendingExp & camProcessedExp 393 393 if (!psDBTransaction(config->dbh)) { 394 394 psError(PS_ERR_UNKNOWN, false, "database error"); … … 397 397 } 398 398 399 p3PendingExpRow *pendingRow = p3PendingExpObjectFromMetadata(output->data[0]);399 camPendingExpRow *pendingRow = camPendingExpObjectFromMetadata(output->data[0]); 400 400 psFree(output); 401 // create a new p3ProcessedImfile object402 p3ProcessedExpRow *row = p3ProcessedExpRowAlloc(401 // create a new camProcessedImfile object 402 camProcessedExpRow *row = camProcessedExpRowAlloc( 403 403 exp_tag, 404 pendingRow-> p3_version,405 pendingRow-> p2_version,404 pendingRow->cam_version, 405 pendingRow->chip_version, 406 406 pendingRow->label, 407 407 uri, … … 422 422 ); 423 423 424 // insert the new row into the p3ProcessedImfile table425 if (! p3ProcessedExpInsertObject(config->dbh, row)) {424 // insert the new row into the camProcessedImfile table 425 if (!camProcessedExpInsertObject(config->dbh, row)) { 426 426 // rollback 427 427 if (!psDBRollback(config->dbh)) { … … 435 435 psFree(row); 436 436 437 // delete the p3PendingExp row from the database438 if (! p3PendingExpDeleteObject(config->dbh, pendingRow)) {437 // delete the camPendingExp row from the database 438 if (!camPendingExpDeleteObject(config->dbh, pendingRow)) { 439 439 // rollback 440 440 if (!psDBRollback(config->dbh)) { … … 448 448 psFree(pendingRow); 449 449 450 // point of no return for p3PendingExp -> p3ProcessedExp450 // point of no return for camPendingExp -> camProcessedExp 451 451 if (!psDBCommit(config->dbh)) { 452 452 psError(PS_ERR_UNKNOWN, false, "database error"); … … 476 476 psString query = psStringCopy( 477 477 "SELECT" 478 " p3ProcessedExp.*,"478 " camProcessedExp.*," 479 479 " rawExp.camera," 480 480 " rawExp.workdir" 481 " FROM p3ProcessedExp"481 " FROM camProcessedExp" 482 482 " JOIN rawExp" 483 483 " USING(exp_tag)" 484 484 " WHERE" 485 " p3ProcessedExp.exp_tag IS NOT NULL"485 " camProcessedExp.exp_tag IS NOT NULL" 486 486 ); 487 487 … … 494 494 if (faulted) { 495 495 // list only faulted rows 496 psStringAppend(&query, " %s", "AND p3ProcessedExp.fault != 0");496 psStringAppend(&query, " %s", "AND camProcessedExp.fault != 0"); 497 497 } else { 498 498 // don't list faulted rows 499 psStringAppend(&query, " %s", "AND p3ProcessedExp.fault = 0");499 psStringAppend(&query, " %s", "AND camProcessedExp.fault = 0"); 500 500 } 501 501 … … 521 521 if (!psArrayLength(output)) { 522 522 // XXX check psError here 523 psError(PS_ERR_UNKNOWN, false, "no p3ProcessedExp rows found");523 psError(PS_ERR_UNKNOWN, false, "no camProcessedExp rows found"); 524 524 psFree(output); 525 525 return true; … … 537 537 538 538 // negate simple so the default is true 539 if (!ippdbPrintMetadatas(stdout, output, " p3ProcessedExp", !simple)) {539 if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) { 540 540 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 541 541 psFree(output); … … 560 560 } 561 561 562 if (!pxSetFaultCode(config->dbh, " p3ProcessedExp", config->where, code)) {562 if (!pxSetFaultCode(config->dbh, "camProcessedExp", config->where, code)) { 563 563 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 564 564 return false; … … 584 584 } 585 585 586 if (! p3MaskInsert(config->dbh, label)) {586 if (!camMaskInsert(config->dbh, label)) { 587 587 psError(PS_ERR_UNKNOWN, false, "database error"); 588 588 return false; … … 596 596 PS_ASSERT_PTR_NON_NULL(config, false); 597 597 598 psString query = psStringCopy("SELECT * FROM p3Mask");598 psString query = psStringCopy("SELECT * FROM camMask"); 599 599 600 600 if (!p_psDBRunQuery(config->dbh, query)) { … … 612 612 if (!psArrayLength(output)) { 613 613 // XXX check psError here 614 psError(PS_ERR_UNKNOWN, false, "no p3Mask rows found");614 psError(PS_ERR_UNKNOWN, false, "no camMask rows found"); 615 615 psFree(output); 616 616 return true; … … 628 628 629 629 // negative simple so the default is true 630 if (!ippdbPrintMetadatas(stdout, output, " p3Mask", !simple)) {630 if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) { 631 631 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 632 632 psFree(output); … … 654 654 } 655 655 656 char *query = "DELETE FROM p3Mask WHERE label = '%s'";656 char *query = "DELETE FROM camMask WHERE label = '%s'"; 657 657 658 658 if (!p_psDBRunQuery(config->dbh, query, label)) { -
trunk/ippTools/src/camtoolConfig.c
r11997 r12024 48 48 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 49 49 "search by exposure ID", NULL); 50 psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "- p2_version", 0,51 "search for exposures with this p2version", -1);52 psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "- p3_version", 0,53 "search for exposures with this p3version", -1);50 psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-chip_version", 0, 51 "search for exposures with this chip version", -1); 52 psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-cam_version", 0, 53 "search for exposures with this cam version", -1); 54 54 psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit", 0, 55 55 "limit result set to N items", 0); … … 107 107 psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 108 108 "search by exposure ID", NULL); 109 psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "- p2_version", 0,110 "search for exposures with this p2version", -1);111 psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "- p3_version", 0,112 "search for exposures with this p3version", -1);109 psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-chip_version", 0, 110 "search for exposures with this chip version", -1); 111 psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-cam_version", 0, 112 "search for exposures with this cam version", -1); 113 113 psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit", 0, 114 114 "limit result set to N items", 0); -
trunk/ippTools/src/chiptool.c
r11997 r12024 1 1 /* 2 * p2tool.c2 * chiptool.c 3 3 * 4 4 * Copyright (C) 2006 Joshua Hoblitt … … 38 38 static bool unblockMode(pxConfig *config); 39 39 40 static p2ProcessedImfileRow *p2PendingToProcessedImfile(pxConfig *config, p2PendingImfileRow *imfile);41 static p2ProcessedExpRow *p2PendingToProcessedExp(pxConfig *config, p2PendingExpRow *pendingExp);42 static p3PendingExpRow *p2PendingToP3PendingExp(pxConfig *config, p2PendingExpRow *pendingExp);43 static bool p2ProcessedCompleteExp(pxConfig *config);40 static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile); 41 static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp); 42 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp); 43 static bool chipProcessedCompleteExp(pxConfig *config); 44 44 45 45 # define MODECASE(caseName, func) \ … … 166 166 // XXX this does not work!!! 167 167 psString query = psStringCopy( 168 "INSERT INTO p2PendingExp\n"168 "INSERT INTO chipPendingExp\n" 169 169 " SElECT\n" 170 170 " exp_tag,\n" 171 171 " 'my recipe',\n" // recipe 172 " 255\n" // p1_version173 " 255\n" // p2_version172 " 255\n" // guide_version 173 " 255\n" // chip_version 174 174 " %s\n" 175 175 " FROM rawExp" 176 " LEFT JOIN p2ProcessedExp"176 " LEFT JOIN chipProcessedExp" 177 177 " USING(exp_tag)" 178 178 " WHERE" … … 200 200 if (!psArrayLength(output)) { 201 201 // XXX check psError here 202 psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");202 psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found"); 203 203 psFree(output); 204 204 return false; … … 220 220 221 221 // XXX does this need to be constrained so that it won't return any results 222 // if a match p2PendingExp hasn't been registered?222 // if a match chipPendingExp hasn't been registered? 223 223 psString query = psStringCopy( 224 224 "SELECT" 225 " p2PendingImfile.*,"225 " chipPendingImfile.*," 226 226 " rawExp.camera," 227 227 " rawExp.workdir" 228 " FROM p2PendingImfile"229 " JOIN p2PendingExp"228 " FROM chipPendingImfile" 229 " JOIN chipPendingExp" 230 230 " USING(exp_tag)" 231 231 " JOIN rawExp" 232 232 " USING(exp_tag)" 233 " LEFT JOIN p2Mask"234 " ON p2PendingExp.label = p2Mask.label"233 " LEFT JOIN chipMask" 234 " ON chipPendingExp.label = chipMask.label" 235 235 " WHERE" 236 " p2Mask.label IS NULL"236 " chipMask.label IS NULL" 237 237 ); 238 238 239 239 if (config->where) { 240 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p2PendingImfile");240 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipPendingImfile"); 241 241 psStringAppend(&query, " AND %s", whereClause); 242 242 psFree(whereClause); … … 264 264 if (!psArrayLength(output)) { 265 265 // XXX check psError here 266 psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");266 psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found"); 267 267 psFree(output); 268 268 return true; … … 280 280 281 281 // negative simple so the default is true 282 if (!ippdbPrintMetadatas(stdout, output, " p2PendingImfile", !simple)) {282 if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) { 283 283 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 284 284 psFree(output); … … 296 296 PS_ASSERT_PTR_NON_NULL(config, false); 297 297 298 // select * from p2ProcessedImfiles298 // select * from chipProcessedImfiles 299 299 // where 300 // exp_tag & class_id are not in p2PendingImfile300 // exp_tag & class_id are not in chipPendingImfile 301 301 302 302 // add the completed imfile to 303 // the p2ProcessedeImfile tables303 // the chipProcessedeImfile tables 304 304 // remove corresponding entries from the 305 // p2PendingImfile table306 // check to see if any p2PendingExps have no307 // associated p2PendingImfiles308 // if so move the p2PendingExp(s) to p2ProcessedExp305 // chipPendingImfile table 306 // check to see if any chipPendingExps have no 307 // associated chipPendingImfiles 308 // if so move the chipPendingExp(s) to chipProcessedExp 309 309 310 310 psString query = psStringCopy( 311 311 "SELECT DISTINCT" 312 " p2PendingImfile.*"313 " FROM p2PendingImfile "314 " LEFT JOIN p2ProcessedImfile"312 " chipPendingImfile.*" 313 " FROM chipPendingImfile " 314 " LEFT JOIN chipProcessedImfile" 315 315 " USING(exp_tag, class_id)" 316 316 " WHERE" 317 " p2ProcessedImfile.exp_tag IS NULL"318 " AND p2ProcessedImfile.class_id IS NULL"317 " chipProcessedImfile.exp_tag IS NULL" 318 " AND chipProcessedImfile.class_id IS NULL" 319 319 ); 320 320 { … … 349 349 } 350 350 351 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p2PendingImfile");351 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipPendingImfile"); 352 352 psFree(where); 353 353 if (whereClause) { … … 371 371 if (!psArrayLength(output)) { 372 372 // XXX check psError here 373 psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");373 psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found"); 374 374 psFree(output); 375 375 return false; … … 384 384 } 385 385 386 // insert into p2ProcessedImfile387 // remove p2PendingImfile entry386 // insert into chipProcessedImfile 387 // remove chipPendingImfile entry 388 388 for (long i = 0; i < psArrayLength(output); i++) { 389 389 psMetadata *row = output->data[i]; 390 // convert metadata into a p2PendingImfile object391 p2PendingImfileRow *object = p2PendingImfileObjectFromMetadata(row);392 // convert p2PendingImfile object into a p2ProcessedImfile object393 p2ProcessedImfileRow *imfile = p2PendingToProcessedImfile(config, object);390 // convert metadata into a chipPendingImfile object 391 chipPendingImfileRow *object = chipPendingImfileObjectFromMetadata(row); 392 // convert chipPendingImfile object into a chipProcessedImfile object 393 chipProcessedImfileRow *imfile = chipPendingToProcessedImfile(config, object); 394 394 if (!imfile) { 395 395 // rollback … … 397 397 psError(PS_ERR_UNKNOWN, false, "database error"); 398 398 } 399 psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingImfile to p2ProcessedImfile");399 psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingImfile to chipProcessedImfile"); 400 400 psFree(object); 401 401 psFree(output); 402 402 return false; 403 403 } 404 // insert p2ProccessedImfile object into the database405 if (! p2ProcessedImfileInsertObject(config->dbh, imfile)) {404 // insert chipProccessedImfile object into the database 405 if (!chipProcessedImfileInsertObject(config->dbh, imfile)) { 406 406 // rollback 407 407 if (!psDBRollback(config->dbh)) { … … 415 415 } 416 416 psFree(imfile); 417 // delete the p2PendingImfile object from the database418 if (! p2PendingImfileDeleteObject(config->dbh, object)) {417 // delete the chipPendingImfile object from the database 418 if (!chipPendingImfileDeleteObject(config->dbh, object)) { 419 419 // there must be atleast 1 Imfile to get this far 420 420 // rollback … … 437 437 // migration can't happen. 438 438 439 if (! p2ProcessedCompleteExp(config)) {439 if (!chipProcessedCompleteExp(config)) { 440 440 // rollback 441 441 if (!psDBRollback(config->dbh)) { … … 446 446 } 447 447 448 // point of no return for p2PendingImfile -> p2ProcessedImfile449 // point of no return for p2PendingExp -> p2ProcessedExp448 // point of no return for chipPendingImfile -> chipProcessedImfile 449 // point of no return for chipPendingExp -> chipProcessedExp 450 450 if (!psDBCommit(config->dbh)) { 451 451 psError(PS_ERR_UNKNOWN, false, "database error"); … … 475 475 476 476 // XXX does this need to be constrained so that it won't return any results 477 // if a match p2PendingExp hasn't been registered?477 // if a match chipPendingExp hasn't been registered? 478 478 psString query = psStringCopy( 479 479 "SELECT" 480 " p2ProcessedImfile.*,"480 " chipProcessedImfile.*," 481 481 " rawExp.camera," 482 482 " rawExp.workdir" 483 " FROM p2ProcessedImfile"483 " FROM chipProcessedImfile" 484 484 " JOIN rawExp" 485 485 " USING(exp_tag)" 486 486 " WHERE " 487 " p2ProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too487 " chipProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too 488 488 ); 489 489 490 490 if (config->where) { 491 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p2ProcessedImfile");491 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile"); 492 492 psStringAppend(&query, " AND %s", whereClause); 493 493 psFree(whereClause); … … 496 496 if (faulted) { 497 497 // list only faulted rows 498 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault != 0");498 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault != 0"); 499 499 } else { 500 500 // don't list faulted rows 501 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault = 0");501 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault = 0"); 502 502 } 503 503 … … 523 523 if (!psArrayLength(output)) { 524 524 // XXX check psError here 525 psError(PS_ERR_UNKNOWN, false, "no p2ProcessedImfile rows found");525 psError(PS_ERR_UNKNOWN, false, "no chipProcessedImfile rows found"); 526 526 psFree(output); 527 527 return true; … … 539 539 540 540 // negative simple so the default is true 541 if (!ippdbPrintMetadatas(stdout, output, " p2ProcessedImfile", !simple)) {541 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 542 542 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 543 543 psFree(output); … … 562 562 } 563 563 564 if (!pxSetFaultCode(config->dbh, " p2ProcessedImfile", config->where, code)) {564 if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", config->where, code)) { 565 565 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 566 566 return false; … … 586 586 } 587 587 588 if (! p2MaskInsert(config->dbh, label)) {588 if (!chipMaskInsert(config->dbh, label)) { 589 589 psError(PS_ERR_UNKNOWN, false, "database error"); 590 590 return false; … … 599 599 PS_ASSERT_PTR_NON_NULL(config, false); 600 600 601 psString query = psStringCopy("SELECT * FROM p2Mask");601 psString query = psStringCopy("SELECT * FROM chipMask"); 602 602 603 603 if (!p_psDBRunQuery(config->dbh, query)) { … … 615 615 if (!psArrayLength(output)) { 616 616 // XXX check psError here 617 psError(PS_ERR_UNKNOWN, false, "no p2Mask rows found");617 psError(PS_ERR_UNKNOWN, false, "no chipMask rows found"); 618 618 psFree(output); 619 619 return true; … … 631 631 632 632 // negative simple so the default is true 633 if (!ippdbPrintMetadatas(stdout, output, " p2Mask", !simple)) {633 if (!ippdbPrintMetadatas(stdout, output, "chipMask", !simple)) { 634 634 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 635 635 psFree(output); … … 658 658 } 659 659 660 char *query = "DELETE FROM p2Mask WHERE label = '%s'";660 char *query = "DELETE FROM chipMask WHERE label = '%s'"; 661 661 662 662 if (!p_psDBRunQuery(config->dbh, query, label)) { … … 670 670 671 671 672 static bool p2ProcessedCompleteExp(pxConfig *config)672 static bool chipProcessedCompleteExp(pxConfig *config) 673 673 { 674 674 PS_ASSERT_PTR_NON_NULL(config, false); 675 675 676 // look for completed p2PendingExp677 // migrate them to p2ProccessedExp & p3PendingExp678 679 // select * from p2PendingExp680 // where exp_tag is not in p2ProcessedExp681 // where exp_tag is not in p2PendingImfile682 // where the number of entries in p2ProccessedImfile matches the .imfiles676 // look for completed chipPendingExp 677 // migrate them to chipProccessedExp & camPendingExp 678 679 // select * from chipPendingExp 680 // where exp_tag is not in chipProcessedExp 681 // where exp_tag is not in chipPendingImfile 682 // where the number of entries in chipProccessedImfile matches the .imfiles 683 683 // entry in rawExp 684 684 psString query = psStringCopy( 685 685 "SELECT DISTINCT" 686 " p2PendingExp.*,"686 " chipPendingExp.*," 687 687 " rawExp.imfiles," 688 " p2ProcessedImfile.class_id"689 " FROM p2PendingExp"688 " chipProcessedImfile.class_id" 689 " FROM chipPendingExp" 690 690 " JOIN rawExp" 691 " ON p2PendingExp.exp_tag = rawExp.exp_tag"692 " LEFT JOIN p2ProcessedExp"693 " ON p2PendingExp.exp_tag = p2ProcessedExp.exp_tag"694 " LEFT JOIN p2PendingImfile"695 " ON p2PendingExp.exp_tag = p2PendingImfile.exp_tag"696 " LEFT JOIN p2ProcessedImfile"697 " ON p2PendingExp.exp_tag = p2ProcessedImfile.exp_tag"691 " ON chipPendingExp.exp_tag = rawExp.exp_tag" 692 " LEFT JOIN chipProcessedExp" 693 " ON chipPendingExp.exp_tag = chipProcessedExp.exp_tag" 694 " LEFT JOIN chipPendingImfile" 695 " ON chipPendingExp.exp_tag = chipPendingImfile.exp_tag" 696 " LEFT JOIN chipProcessedImfile" 697 " ON chipPendingExp.exp_tag = chipProcessedImfile.exp_tag" 698 698 " WHERE" 699 " p2ProcessedExp.exp_tag IS NULL"700 " AND p2PendingImfile.exp_tag IS NULL"701 " AND p2ProcessedImfile.exp_tag IS NOT NULL"699 " chipProcessedExp.exp_tag IS NULL" 700 " AND chipPendingImfile.exp_tag IS NULL" 701 " AND chipProcessedImfile.exp_tag IS NOT NULL" 702 702 " GROUP BY" 703 " p2PendingExp.exp_tag"704 " HAVING rawExp.imfiles = COUNT( p2ProcessedImfile.class_id)"703 " chipPendingExp.exp_tag" 704 " HAVING rawExp.imfiles = COUNT(chipProcessedImfile.class_id)" 705 705 ); 706 706 … … 719 719 if (!psArrayLength(output)) { 720 720 // XXX check psError here 721 psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");721 psError(PS_ERR_UNKNOWN, false, "no chipPendingExp rows found"); 722 722 psFree(output); 723 723 return true; 724 724 } 725 725 726 // insert into p2ProcessedExp727 // insert into p3PendingExp728 // remove p2PendingExp entry726 // insert into chipProcessedExp 727 // insert into camPendingExp 728 // remove chipPendingExp entry 729 729 for (long i = 0; i < psArrayLength(output); i++) { 730 730 psMetadata *row = output->data[i]; 731 // convert metadata into a p2PendingExp object732 p2PendingExpRow *object = p2PendingExpObjectFromMetadata(row);731 // convert metadata into a chipPendingExp object 732 chipPendingExpRow *object = chipPendingExpObjectFromMetadata(row); 733 733 // do both *Exp type conversion first so we don't insert one and then 734 734 // have to rollback the change as the 2nd failed 735 // convert p2PendingExp object into a p2ProcesseExp object736 p2ProcessedExpRow *processedExp = p2PendingToProcessedExp(config, object);735 // convert chipPendingExp object into a chipProcesseExp object 736 chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, object); 737 737 if (!processedExp) { 738 psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingExp to p2ProcessedExp");738 psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to chipProcessedExp"); 739 739 psFree(object); 740 740 psFree(output); 741 741 return false; 742 742 } 743 // convert p2PendingExp object into a p3PendingExp object744 p3PendingExpRow *pendingExp = p2PendingToP3PendingExp(config, object);743 // convert chipPendingExp object into a camPendingExp object 744 camPendingExpRow *pendingExp = chipPendingTocamPendingExp(config, object); 745 745 if (!processedExp) { 746 psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingExp to p3PendingExp");746 psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to camPendingExp"); 747 747 psFree(processedExp); 748 748 psFree(object); … … 750 750 return false; 751 751 } 752 // insert p2ProccessedExp object into the database753 if (! p2ProcessedExpInsertObject(config->dbh, processedExp)) {752 // insert chipProccessedExp object into the database 753 if (!chipProcessedExpInsertObject(config->dbh, processedExp)) { 754 754 psError(PS_ERR_UNKNOWN, false, "database error"); 755 755 psFree(processedExp); … … 760 760 } 761 761 psFree(processedExp); 762 // insert p3PendingExp object into the database763 if (! p3PendingExpInsertObject(config->dbh, pendingExp)) {762 // insert camPendingExp object into the database 763 if (!camPendingExpInsertObject(config->dbh, pendingExp)) { 764 764 psError(PS_ERR_UNKNOWN, false, "database error"); 765 765 psFree(pendingExp); … … 769 769 } 770 770 psFree(pendingExp); 771 // delete the p2PendingExp object from the database772 if (! p2PendingExpDeleteObject(config->dbh, object)) {771 // delete the chipPendingExp object from the database 772 if (!chipPendingExpDeleteObject(config->dbh, object)) { 773 773 // there must be atleast 1 Imfile to get this far 774 774 psError(PS_ERR_UNKNOWN, false, "database error"); … … 786 786 787 787 788 static p2ProcessedImfileRow *p2PendingToProcessedImfile(pxConfig *config, p2PendingImfileRow *imfile)788 static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile) 789 789 { 790 790 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 850 850 } 851 851 852 return p2ProcessedImfileRowAlloc(852 return chipProcessedImfileRowAlloc( 853 853 imfile->exp_tag, 854 imfile-> p2_version,855 imfile-> p1_version,854 imfile->chip_version, 855 imfile->guide_version, 856 856 imfile->class_id, 857 857 recipe, … … 867 867 868 868 869 static p2ProcessedExpRow *p2PendingToProcessedExp(pxConfig *config, p2PendingExpRow *pendingExp)869 static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp) 870 870 { 871 871 PS_ASSERT_PTR_NON_NULL(pendingExp, NULL); 872 872 873 return p2ProcessedExpRowAlloc(873 return chipProcessedExpRowAlloc( 874 874 pendingExp->exp_tag, 875 pendingExp-> p2_version,876 pendingExp-> p1_version,875 pendingExp->chip_version, 876 pendingExp->guide_version, 877 877 pendingExp->label, 878 878 pendingExp->expgroup, … … 882 882 883 883 884 static p3PendingExpRow *p2PendingToP3PendingExp(pxConfig *config, p2PendingExpRow *pendingExp)884 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp) 885 885 { 886 886 PS_ASSERT_PTR_NON_NULL(pendingExp, NULL); 887 887 888 return p3PendingExpRowAlloc(888 return camPendingExpRowAlloc( 889 889 pendingExp->exp_tag, 890 0x0, // p3version891 pendingExp-> p2_version,890 0x0, // cam version 891 pendingExp->chip_version, 892 892 pendingExp->label, 893 893 pendingExp->expgroup, -
trunk/ippTools/src/dettool.c
r11855 r12024 5695 5695 if (faulted) { 5696 5696 // list only faulted rows 5697 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault != 0");5697 psStringAppend(&query, " %s", "AND detRunSummary.fault != 0"); 5698 5698 } else { 5699 5699 // don't list faulted rows 5700 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault = 0");5700 psStringAppend(&query, " %s", "AND detRunSummary.fault = 0"); 5701 5701 } 5702 5702 -
trunk/ippTools/src/dettoolConfig.c
r11855 r12024 942 942 int n = 0; 943 943 bool status = false; 944 if ((n = psMetadataLookupS32(&status, config->args, "- p1_version"))) {945 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, " p1_version", 0, "==", n)) {946 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");944 if ((n = psMetadataLookupS32(&status, config->args, "-guide_version"))) { 945 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "guide_version", 0, "==", n)) { 946 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 947 947 psFree(config); 948 948 return NULL; -
trunk/ippTools/src/difftool.c
r11997 r12024 39 39 static bool diffskyfileMode(pxConfig *config); 40 40 41 static bool set p5RunState(pxConfig *config, const char *p4_id, const char *state);41 static bool setdiffRunState(pxConfig *config, const char *warp_id, const char *state); 42 42 43 43 # define MODECASE(caseName, func) \ … … 139 139 } 140 140 141 p5RunRow *run = p5RunRowAlloc(141 diffRunRow *run = diffRunRowAlloc( 142 142 0, // ID 143 143 "reg", // state … … 150 150 psFree(registered); 151 151 if (!run) { 152 psError(PS_ERR_UNKNOWN, false, "failed to alloc p5Run object");152 psError(PS_ERR_UNKNOWN, false, "failed to alloc diffRun object"); 153 153 return true; 154 154 } 155 if (! p5RunInsertObject(config->dbh, run)) {155 if (!diffRunInsertObject(config->dbh, run)) { 156 156 psError(PS_ERR_UNKNOWN, false, "database error"); 157 157 psFree(run); … … 159 159 } 160 160 161 // get the assigned p5_id162 run-> p5_id = psDBLastInsertID(config->dbh);161 // get the assigned diff_id 162 run->diff_id = psDBLastInsertID(config->dbh); 163 163 164 164 bool simple = false; … … 173 173 } 174 174 175 if (! p5RunPrintObject(stdout, run, !simple)) {175 if (!diffRunPrintObject(stdout, run, !simple)) { 176 176 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 177 177 psFree(run); … … 190 190 191 191 bool status = false; 192 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");193 if (!status) { 194 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p5_id");195 return false; 196 } 197 if (! p5_id) {198 psError(PS_ERR_UNKNOWN, true, "- p5_id is required");192 psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id"); 193 if (!status) { 194 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id"); 195 return false; 196 } 197 if (!diff_id) { 198 psError(PS_ERR_UNKNOWN, true, "-diff_id is required"); 199 199 return false; 200 200 } … … 212 212 if (state) { 213 213 // set detRun.state to state 214 return set p5RunState(config, p5_id, state);214 return setdiffRunState(config, diff_id, state); 215 215 } 216 216 … … 224 224 225 225 bool status = false; 226 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");227 if (!status) { 228 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p5_id");229 return false; 230 } 231 if (! p5_id) {232 psError(PS_ERR_UNKNOWN, true, "- p5_id is required");233 return false; 234 } 235 236 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");237 if (!status) { 238 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p4_id");239 return false; 240 } 241 if (! p5_id) {242 psError(PS_ERR_UNKNOWN, true, "- p5_id is required");226 psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id"); 227 if (!status) { 228 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id"); 229 return false; 230 } 231 if (!diff_id) { 232 psError(PS_ERR_UNKNOWN, true, "-diff_id is required"); 233 return false; 234 } 235 236 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 237 if (!status) { 238 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 239 return false; 240 } 241 if (!diff_id) { 242 psError(PS_ERR_UNKNOWN, true, "-diff_id is required"); 243 243 return false; 244 244 } … … 277 277 } 278 278 279 // XXX need to validate the p4_id here279 // XXX need to validate the warp_id here 280 280 // XXX instead of validiting it here we should just use forgein key 281 281 // constrants 282 if (! p5InputSkyfileInsert(config->dbh,283 (psS32)atoi( p5_id),284 (psS32)atoi( p4_id),282 if (!diffInputSkyfileInsert(config->dbh, 283 (psS32)atoi(diff_id), 284 (psS32)atoi(warp_id), 285 285 skycell_id, 286 286 tess_id, … … 310 310 psString query = psStringCopy( 311 311 "SELECT\n" 312 " p4Skyfile.*,\n"313 " p5InputSkyfile.template\n"314 " FROM p5Run\n"315 " JOIN p5InputSkyfile\n"316 " USING( p5_id)\n"317 " JOIN p4Skyfile\n"318 " ON p5InputSkyfile.p4_id = p4Skyfile.p4_id\n"319 " AND p5InputSkyfile.skycell_id = p4Skyfile.skycell_id\n"320 " AND p5InputSkyfile.tess_id = p4Skyfile.tess_id\n"312 " warpSkyfile.*,\n" 313 " diffInputSkyfile.template\n" 314 " FROM diffRun\n" 315 " JOIN diffInputSkyfile\n" 316 " USING(diff_id)\n" 317 " JOIN warpSkyfile\n" 318 " ON diffInputSkyfile.warp_id = warpSkyfile.warp_id\n" 319 " AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id\n" 320 " AND diffInputSkyfile.tess_id = warpSkyfile.tess_id\n" 321 321 " WHERE\n" 322 " p5Run.state = 'run'\n"322 " diffRun.state = 'run'\n" 323 323 ); 324 324 325 325 if (config->where) { 326 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p5InputSkyfile");326 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffInputSkyfile"); 327 327 psStringAppend(&query, " AND %s", whereClause); 328 328 psFree(whereClause); … … 358 358 } 359 359 if (!psArrayLength(output)) { 360 psError(PS_ERR_UNKNOWN, false, "no p5InputSkyfile rows found");360 psError(PS_ERR_UNKNOWN, false, "no diffInputSkyfile rows found"); 361 361 psFree(output); 362 362 return true; … … 375 375 if (psArrayLength(output)) { 376 376 // negative simple so the default is true 377 if (!ippdbPrintMetadatas(stdout, output, " p5InputSkyfile", !simple)) {377 if (!ippdbPrintMetadatas(stdout, output, "diffInputSkyfile", !simple)) { 378 378 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 379 379 psFree(output); … … 402 402 psString query = psStringCopy( 403 403 "SELECT DISTINCT\n" 404 " p5Run.p5_id\n"405 " FROM p5Run\n"406 " JOIN p5InputSkyfile\n"407 " USING( p5_id)\n"408 " JOIN p4Skyfile\n"409 " ON p5InputSkyfile.p4_id = p4Skyfile.p4_id\n"410 " AND p5InputSkyfile.skycell_id = p4Skyfile.skycell_id\n"411 " AND p5InputSkyfile.tess_id = p4Skyfile.tess_id\n"412 " LEFT JOIN p5DiffSkyfile\n"413 " ON p5InputSkyfile.p5_id = p5DiffSkyfile.p5_id\n"404 " diffRun.diff_id\n" 405 " FROM diffRun\n" 406 " JOIN diffInputSkyfile\n" 407 " USING(diff_id)\n" 408 " JOIN warpSkyfile\n" 409 " ON diffInputSkyfile.warp_id = warpSkyfile.warp_id\n" 410 " AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id\n" 411 " AND diffInputSkyfile.tess_id = warpSkyfile.tess_id\n" 412 " LEFT JOIN diffSkyfile\n" 413 " ON diffInputSkyfile.diff_id = diffSkyfile.diff_id\n" 414 414 " WHERE\n" 415 " p5Run.state = 'run'\n"416 " AND p5DiffSkyfile.p5_id IS NULL\n"415 " diffRun.state = 'run'\n" 416 " AND diffSkyfile.diff_id IS NULL\n" 417 417 ); 418 418 419 419 if (config->where) { 420 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p5Skyfile");420 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffSkyfile"); 421 421 psStringAppend(&query, " AND %s", whereClause); 422 422 psFree(whereClause); … … 452 452 } 453 453 if (!psArrayLength(output)) { 454 psError(PS_ERR_UNKNOWN, false, "no p5Skyfile rows found");454 psError(PS_ERR_UNKNOWN, false, "no diffSkyfile rows found"); 455 455 psFree(output); 456 456 return true; … … 469 469 if (psArrayLength(output)) { 470 470 // negative simple so the default is true 471 if (!ippdbPrintMetadatas(stdout, output, " p5Skyfile", !simple)) {471 if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) { 472 472 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 473 473 psFree(output); … … 487 487 488 488 bool status = false; 489 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");490 if (!status) { 491 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p5_id");492 return false; 493 } 494 if (! p5_id) {495 psError(PS_ERR_UNKNOWN, true, "- p5_id is required");489 psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id"); 490 if (!status) { 491 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id"); 492 return false; 493 } 494 if (!diff_id) { 495 psError(PS_ERR_UNKNOWN, true, "-diff_id is required"); 496 496 return false; 497 497 } … … 525 525 } 526 526 527 if (! p5DiffSkyfileInsert(config->dbh,528 (psS32)atoi( p5_id),527 if (!diffSkyfileInsert(config->dbh, 528 (psS32)atoi(diff_id), 529 529 uri, 530 530 bg, … … 538 538 } 539 539 540 if (!set p5RunState(config, p5_id, "stop")) {540 if (!setdiffRunState(config, diff_id, "stop")) { 541 541 if (!psDBRollback(config->dbh)) { 542 542 psError(PS_ERR_UNKNOWN, false, "database error"); … … 570 570 psString query = psStringCopy( 571 571 "SELECT\n" 572 " p5Run.skycell_id,\n"573 " p5Run.tess_id,\n"574 " p5DiffSkyfile.*\n"575 " FROM p5Run\n"576 " JOIN p5DiffSkyfile\n"577 " USING( p5_id)\n"572 " diffRun.skycell_id,\n" 573 " diffRun.tess_id,\n" 574 " diffSkyfile.*\n" 575 " FROM diffRun\n" 576 " JOIN diffSkyfile\n" 577 " USING(diff_id)\n" 578 578 " WHERE\n" 579 " p5Run.state = 'run'\n"579 " diffRun.state = 'run'\n" 580 580 ); 581 581 582 582 if (config->where) { 583 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p5DiffSkyfile");583 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffSkyfile"); 584 584 psStringAppend(&query, " AND %s", whereClause); 585 585 psFree(whereClause); … … 615 615 } 616 616 if (!psArrayLength(output)) { 617 psError(PS_ERR_UNKNOWN, false, "no p5DiffSkyfile rows found");617 psError(PS_ERR_UNKNOWN, false, "no diffSkyfile rows found"); 618 618 psFree(output); 619 619 return true; … … 632 632 if (psArrayLength(output)) { 633 633 // negative simple so the default is true 634 if (!ippdbPrintMetadatas(stdout, output, " p5DiffSkyfile", !simple)) {634 if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) { 635 635 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 636 636 psFree(output); … … 644 644 } 645 645 646 static bool set p5RunState(pxConfig *config, const char *p5_id, const char *state)647 { 648 PS_ASSERT_PTR_NON_NULL( p5_id, false);646 static bool setdiffRunState(pxConfig *config, const char *diff_id, const char *state) 647 { 648 PS_ASSERT_PTR_NON_NULL(diff_id, false); 649 649 PS_ASSERT_PTR_NON_NULL(state, false); 650 650 … … 657 657 ) { 658 658 psError(PS_ERR_UNKNOWN, false, 659 "invalid p5Run state: %s", state);660 return false; 661 } 662 663 char *query = "UPDATE p5Run SET state = '%s' WHERE p5_id = '%s'";664 if (!p_psDBRunQuery(config->dbh, query, state, p5_id)) {659 "invalid diffRun state: %s", state); 660 return false; 661 } 662 663 char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = '%s'"; 664 if (!p_psDBRunQuery(config->dbh, query, state, diff_id)) { 665 665 psError(PS_ERR_UNKNOWN, false, 666 "failed to change state for p5_id %s", p5_id);667 return false; 668 } 669 670 return true; 671 } 666 "failed to change state for diff_id %s", diff_id); 667 return false; 668 } 669 670 return true; 671 } -
trunk/ippTools/src/difftoolConfig.c
r11997 r12024 62 62 // -updaterun 63 63 psMetadata *updaterunArgs = psMetadataAlloc(); 64 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "- p5_id", 0,65 "define p5ID (required)", NULL);64 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-diff_id", 0, 65 "define diff ID (required)", NULL); 66 66 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, 67 67 "set state (required)", NULL); … … 75 75 // -addinputskyfile 76 76 psMetadata *addinputskyfileArgs = psMetadataAlloc(); 77 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "- p5_id", 0,78 "define p5ID (required)", NULL);79 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "- p4_id", 0,80 "define p4ID (required)", NULL);77 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, 78 "define diff ID (required)", NULL); 79 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-warp_id", 0, 80 "define warp ID (required)", NULL); 81 81 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, 82 82 "define by skycell ID", NULL); … … 90 90 // -inputskyfile 91 91 psMetadata *inputskyfileArgs = psMetadataAlloc(); 92 psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "- p5_id", 0,93 "search by p5ID (required)", NULL);94 psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "- p4_id", 0,95 "search by p4ID (required)", NULL);92 psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, 93 "search by diff ID (required)", NULL); 94 psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-warp_id", 0, 95 "search by warp ID (required)", NULL); 96 96 psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, 97 97 "search by skycell ID", NULL); … … 109 109 // -todiffskyfile 110 110 psMetadata *todiffskyfileArgs = psMetadataAlloc(); 111 psMetadataAddStr(todiffskyfileArgs, PS_LIST_TAIL, "- p5_id", 0,112 "search by p5ID", NULL);111 psMetadataAddStr(todiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, 112 "search by diff ID", NULL); 113 113 psMetadataAddU64(todiffskyfileArgs, PS_LIST_TAIL, "-limit", 0, 114 114 "limit result set to N items", 0); … … 118 118 // -adddiffskyfile 119 119 psMetadata *adddiffskyfileArgs = psMetadataAlloc(); 120 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "- p5_id", 0,121 "define p4ID (required)", NULL);120 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, 121 "define warp ID (required)", NULL); 122 122 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-uri", 0, 123 123 "define URI of file (required)", 0); … … 129 129 // -diffskyfile 130 130 psMetadata *diffskyfileArgs = psMetadataAlloc(); 131 psMetadataAddStr(diffskyfileArgs, PS_LIST_TAIL, "- p5_id", 0,132 "search by p4ID", NULL);131 psMetadataAddStr(diffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, 132 "search by warp ID", NULL); 133 133 psMetadataAddStr(diffskyfileArgs , PS_LIST_TAIL, "-skycell_id", 0, 134 134 "define skycell ID (required)", NULL); … … 238 238 psString str = NULL; 239 239 bool status = false; 240 if ((str = psMetadataLookupStr(&status, config->args, "- p5_id"))) {241 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, " p5_id", 0, "==", (psS32)atoi(str))) {242 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");240 if ((str = psMetadataLookupStr(&status, config->args, "-diff_id"))) { 241 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "diff_id", 0, "==", (psS32)atoi(str))) { 242 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 243 243 psFree(config); 244 244 return NULL; … … 249 249 psString str = NULL; 250 250 bool status = false; 251 if ((str = psMetadataLookupStr(&status, config->args, "- p4_id"))) {252 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, " p4_id", 0, "==", (psS32)atoi(str))) {253 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");251 if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) { 252 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) { 253 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 254 254 psFree(config); 255 255 return NULL; -
trunk/ippTools/src/guidetool.c
r11997 r12024 29 29 static bool pendingMode(pxConfig *config); 30 30 static bool defineMode(pxConfig *config); 31 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *exp);31 static guidePendingExpRow *rawScienceToguidePendingExp(pxConfig *config, rawScienceExpRow *exp); 32 32 33 33 int main(int argc, char **argv) … … 61 61 PS_ASSERT_PTR_NON_NULL(config, false); 62 62 63 // return all p1PendingExp rows unless there CLI search options64 psArray * p1PendingExp = p1PendingExpSelectRowObjects(63 // return all guidePendingExp rows unless there CLI search options 64 psArray *guidePendingExp = guidePendingExpSelectRowObjects( 65 65 config->dbh, 66 66 config->where ? config->where : NULL, 67 67 0 68 68 ); 69 if (! p1PendingExp) {70 psError(PS_ERR_UNKNOWN, false, "no p1PendingExp found");69 if (!guidePendingExp) { 70 psError(PS_ERR_UNKNOWN, false, "no guidePendingExp found"); 71 71 return false; 72 72 } … … 74 74 psMetadata *output = psMetadataAlloc(); 75 75 76 for (long i = 0; i < psArrayLength( p1PendingExp); i++) {77 psMetadata *md = p1PendingExpMetadataFromObject(p1PendingExp->data[i]);78 psMetadataAddMetadata(output, PS_LIST_TAIL, " p1PendingExp",76 for (long i = 0; i < psArrayLength(guidePendingExp); i++) { 77 psMetadata *md = guidePendingExpMetadataFromObject(guidePendingExp->data[i]); 78 psMetadataAddMetadata(output, PS_LIST_TAIL, "guidePendingExp", 79 79 PS_META_DUPLICATE_OK, NULL, md); 80 80 psFree(md); … … 106 106 } 107 107 108 // insert the rawScienceExps into p1PendingExp108 // insert the rawScienceExps into guidePendingExp 109 109 // XXX for the being we're going to skip checking for duplicate entries 110 110 // XXX this will have to implimented unless duplicate key insertion 111 111 // XXX support is implimented in psDB 112 112 for (long i = 0; i < psArrayLength(rawScienceExps); i++) { 113 p1PendingExpRow * new = rawScienceTop1PendingExp(113 guidePendingExpRow * new = rawScienceToguidePendingExp( 114 114 config, rawScienceExps->data[i]); 115 if (! p1PendingExpInsertObject(config->dbh, new)) {115 if (!guidePendingExpInsertObject(config->dbh, new)) { 116 116 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 117 117 return false; … … 123 123 } 124 124 125 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *exp)125 static guidePendingExpRow *rawScienceToguidePendingExp(pxConfig *config, rawScienceExpRow *exp) 126 126 { 127 127 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 184 184 } 185 185 186 return p1PendingExpRowAlloc(186 return guidePendingExpRowAlloc( 187 187 exp->exp_tag, 188 188 exp->camera, -
trunk/ippTools/src/guidetoolConfig.c
r11997 r12024 66 66 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-recipe", 0, 67 67 "define recipe of interest", NULL); 68 psMetadataAddS32(pendingArgs, PS_LIST_TAIL, "- p1_version", 0,69 "define p1_version of interest", 0);68 psMetadataAddS32(pendingArgs, PS_LIST_TAIL, "-guide_version", 0, 69 "define guide_version of interest", 0); 70 70 71 71 // -define inputs … … 86 86 psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-recipe", 0, 87 87 "define recipe of interest", NULL); 88 psMetadataAddS32(defineArgs, PS_LIST_TAIL, "- p1_version", 0,89 "define p1_version of interest", 0);88 psMetadataAddS32(defineArgs, PS_LIST_TAIL, "-guide_version", 0, 89 "define guide_version of interest", 0); 90 90 91 91 // find which mode we're running under … … 182 182 addWhereStr(stats); 183 183 addWhereStr(recipe); 184 if ((n = psMetadataLookupS32(&status, config->args, "- p1_version"))) {185 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, " p1_version", 0, "==", n)) {186 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");184 if ((n = psMetadataLookupS32(&status, config->args, "-guide_version"))) { 185 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "guide_version", 0, "==", n)) { 186 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 187 187 exit(EXIT_FAILURE); 188 188 } -
trunk/ippTools/src/pxtables.c
r11985 r12024 59 59 CREATE_TABLE(rawExpCreateTable); 60 60 CREATE_TABLE(rawImfileCreateTable); 61 CREATE_TABLE( p1PendingExpCreateTable);62 CREATE_TABLE( p2PendingExpCreateTable);63 CREATE_TABLE( p2PendingImfileCreateTable);64 CREATE_TABLE( p2ProcessedExpCreateTable);65 CREATE_TABLE( p2ProcessedImfileCreateTable);66 CREATE_TABLE( p2MaskCreateTable);67 CREATE_TABLE( p3PendingExpCreateTable);68 CREATE_TABLE( p3ProcessedExpCreateTable);69 CREATE_TABLE( p3MaskCreateTable);61 CREATE_TABLE(guidePendingExpCreateTable); 62 CREATE_TABLE(chipPendingExpCreateTable); 63 CREATE_TABLE(chipPendingImfileCreateTable); 64 CREATE_TABLE(chipProcessedExpCreateTable); 65 CREATE_TABLE(chipProcessedImfileCreateTable); 66 CREATE_TABLE(chipMaskCreateTable); 67 CREATE_TABLE(camPendingExpCreateTable); 68 CREATE_TABLE(camProcessedExpCreateTable); 69 CREATE_TABLE(camMaskCreateTable); 70 70 CREATE_TABLE(detRunCreateTable); 71 71 CREATE_TABLE(detInputExpCreateTable); … … 79 79 CREATE_TABLE(detResidExpCreateTable); 80 80 CREATE_TABLE(detRunSummaryCreateTable); 81 CREATE_TABLE( p4RunCreateTable);82 CREATE_TABLE( p4InputExpCreateTable);83 CREATE_TABLE( p4SkyCellMapCreateTable);84 CREATE_TABLE( p4SkyfileCreateTable);85 CREATE_TABLE( p5RunCreateTable);86 CREATE_TABLE( p5InputSkyfileCreateTable);87 CREATE_TABLE( p5DiffSkyfileCreateTable);88 CREATE_TABLE( p6RunCreateTable);89 CREATE_TABLE( p6InputSkyfileCreateTable);90 CREATE_TABLE( p6SumSkyfileCreateTable);81 CREATE_TABLE(warpRunCreateTable); 82 CREATE_TABLE(warpInputExpCreateTable); 83 CREATE_TABLE(warpSkyCellMapCreateTable); 84 CREATE_TABLE(warpSkyfileCreateTable); 85 CREATE_TABLE(diffRunCreateTable); 86 CREATE_TABLE(diffInputSkyfileCreateTable); 87 CREATE_TABLE(diffSkyfileCreateTable); 88 CREATE_TABLE(stackRunCreateTable); 89 CREATE_TABLE(stackInputSkyfileCreateTable); 90 CREATE_TABLE(stackSumSkyfileCreateTable); 91 91 92 92 return true; … … 99 99 PS_ASSERT_PTR_NON_NULL(config, false); 100 100 101 fprintf (stdout, "*** delete the P2tables? ***\n");101 fprintf (stdout, "*** delete the chip tables? ***\n"); 102 102 fprintf (stdout, "*** to delete the tables, answer YES, and give password ***\n"); 103 103 fprintf (stdout, "*** WARNING: this action is permanent ***\n\n"); 104 104 105 fprintf (stdout, "delete the P2tables (YES/[n]): ");105 fprintf (stdout, "delete the chip tables (YES/[n]): "); 106 106 fgets (line, 128, stdin); 107 107 sscanf (line, "%s", answer); … … 135 135 DROP_TABLE(rawExpDropTable); 136 136 DROP_TABLE(rawImfileDropTable); 137 DROP_TABLE( p1PendingExpDropTable);138 DROP_TABLE( p2PendingExpDropTable);139 DROP_TABLE( p2PendingImfileDropTable);140 DROP_TABLE( p2ProcessedExpDropTable);141 DROP_TABLE( p2ProcessedImfileDropTable);142 DROP_TABLE( p2MaskDropTable);143 DROP_TABLE( p3PendingExpDropTable);144 DROP_TABLE( p3ProcessedExpDropTable);145 DROP_TABLE( p3MaskDropTable);137 DROP_TABLE(guidePendingExpDropTable); 138 DROP_TABLE(chipPendingExpDropTable); 139 DROP_TABLE(chipPendingImfileDropTable); 140 DROP_TABLE(chipProcessedExpDropTable); 141 DROP_TABLE(chipProcessedImfileDropTable); 142 DROP_TABLE(chipMaskDropTable); 143 DROP_TABLE(camPendingExpDropTable); 144 DROP_TABLE(camProcessedExpDropTable); 145 DROP_TABLE(camMaskDropTable); 146 146 DROP_TABLE(detRunDropTable); 147 147 DROP_TABLE(detInputExpDropTable); … … 155 155 DROP_TABLE(detResidExpDropTable); 156 156 DROP_TABLE(detRunSummaryDropTable); 157 DROP_TABLE( p4RunDropTable);158 DROP_TABLE( p4InputExpDropTable);159 DROP_TABLE( p4SkyCellMapDropTable);160 DROP_TABLE( p4SkyfileDropTable);161 DROP_TABLE( p5RunDropTable);162 DROP_TABLE( p5InputSkyfileDropTable);163 DROP_TABLE( p5DiffSkyfileDropTable);164 DROP_TABLE( p6RunDropTable);165 DROP_TABLE( p6InputSkyfileDropTable);166 DROP_TABLE( p6SumSkyfileDropTable);157 DROP_TABLE(warpRunDropTable); 158 DROP_TABLE(warpInputExpDropTable); 159 DROP_TABLE(warpSkyCellMapDropTable); 160 DROP_TABLE(warpSkyfileDropTable); 161 DROP_TABLE(diffRunDropTable); 162 DROP_TABLE(diffInputSkyfileDropTable); 163 DROP_TABLE(diffSkyfileDropTable); 164 DROP_TABLE(stackRunDropTable); 165 DROP_TABLE(stackInputSkyfileDropTable); 166 DROP_TABLE(stackSumSkyfileDropTable); 167 167 168 168 return status; -
trunk/ippTools/src/regtool.c
r11997 r12024 39 39 40 40 // static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp); 41 static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *newExp);42 static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile);41 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp); 42 static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile); 43 43 44 44 static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp); … … 672 672 } 673 673 674 // if this is a detrend image don't put it in the p2queue (and we're674 // if this is a detrend image don't put it in the chip queue (and we're 675 675 // done) 676 676 if (detrend) { … … 679 679 } 680 680 681 // insert an entry into the p2PendingExp table682 p2PendingExpRow *p2PendingExp = newToP2PendingExp(config, newExp);683 if (! p2PendingExp) {684 psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to p2PendingExp");681 // insert an entry into the chipPendingExp table 682 chipPendingExpRow *chipPendingExp = newTochipPendingExp(config, newExp); 683 if (!chipPendingExp) { 684 psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to chipPendingExp"); 685 685 psFree(newExp); 686 686 psFree(output); … … 688 688 } 689 689 690 // insert the p2PendingExp object into the database691 if (! p2PendingExpInsertObject(config->dbh, p2PendingExp)) {690 // insert the chipPendingExp object into the database 691 if (!chipPendingExpInsertObject(config->dbh, chipPendingExp)) { 692 692 // rollback 693 693 if (!psDBRollback(config->dbh)) { … … 695 695 } 696 696 psError(PS_ERR_UNKNOWN, false, "database error"); 697 psFree( p2PendingExp);697 psFree(chipPendingExp); 698 698 psFree(newExp); 699 699 psFree(output); 700 700 return false; 701 701 } 702 psFree( p2PendingExp);703 704 // find all of the rawImfiles associated with the p2PendingExp object702 psFree(chipPendingExp); 703 704 // find all of the rawImfiles associated with the chipPendingExp object 705 705 psArray *rawImfiles = NULL; 706 706 { … … 744 744 return false; 745 745 } 746 // convert the rawImfiles into p2PendingImfiles and insert them into746 // convert the rawImfiles into chipPendingImfiles and insert them into 747 747 // the database 748 748 for (long i = 0; i < psArrayLength(rawImfiles); i++) { 749 749 rawImfileRow *rawImfile = rawImfiles->data[i]; 750 p2PendingImfileRow *pendingImfile = rawImfileToP2PendingImfile(config, rawImfile);751 if (! p2PendingImfileInsertObject(config->dbh, pendingImfile)){750 chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, rawImfile); 751 if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){ 752 752 // rollback 753 753 if (!psDBRollback(config->dbh)) { … … 915 915 916 916 917 static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *exp)917 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *exp) 918 918 { 919 919 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 928 928 } 929 929 930 p2PendingExpRow *p2Exp = p2PendingExpRowAlloc(930 chipPendingExpRow *chipExp = chipPendingExpRowAlloc( 931 931 exp->exp_tag, 932 0x0, // p2version XXX calc version number932 0x0, // chip version XXX calc version number 933 933 0xdeadbeef, // p1 version 934 934 label, … … 938 938 ); 939 939 940 return p2Exp;941 } 942 943 944 static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile)945 { 946 return p2PendingImfileRowAlloc(940 return chipExp; 941 } 942 943 944 static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile) 945 { 946 return chipPendingImfileRowAlloc( 947 947 rawImfile->exp_tag, 948 0x0, // p2version XXX calc version number948 0x0, // chip version XXX calc version number 949 949 0xdeadbeef, // p1 version 950 950 rawImfile->class_id, -
trunk/ippTools/src/stacktool.c
r11997 r12024 39 39 static bool sumskyfileMode(pxConfig *config); 40 40 41 static bool set p6RunState(pxConfig *config, const char *p6_id, const char *state);41 static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state); 42 42 43 43 # define MODECASE(caseName, func) \ … … 125 125 126 126 // we have to support multipe exp_tags 127 psMetadataItem * p4_ids = psMetadataLookup(config->args, "-p4_id");128 if (! p4_ids) {127 psMetadataItem *warp_ids = psMetadataLookup(config->args, "-warp_id"); 128 if (!warp_ids) { 129 129 // this shouldn't actually happen when using psArgs 130 psError(PS_ERR_UNKNOWN, true, "- p4_id is required");130 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 131 131 return false; 132 132 } … … 147 147 } 148 148 149 p6RunRow *run = p6RunRowAlloc(149 stackRunRow *run = stackRunRowAlloc( 150 150 0, // ID 151 151 "run", // state … … 158 158 psFree(registered); 159 159 if (!run) { 160 psError(PS_ERR_UNKNOWN, false, "failed to alloc p6Run object");160 psError(PS_ERR_UNKNOWN, false, "failed to alloc stackRun object"); 161 161 return true; 162 162 } … … 167 167 } 168 168 169 if (! p6RunInsertObject(config->dbh, run)) {169 if (!stackRunInsertObject(config->dbh, run)) { 170 170 if (!psDBRollback(config->dbh)) { 171 171 psError(PS_ERR_UNKNOWN, false, "database error"); … … 176 176 } 177 177 178 // get the assigned p4_id179 run-> p6_id = psDBLastInsertID(config->dbh);180 181 // insert the p6InputSkyfile rows182 psListIterator *iter = psListIteratorAlloc( p4_ids->data.list, 0, false);178 // get the assigned warp_id 179 run->stack_id = psDBLastInsertID(config->dbh); 180 181 // insert the stackInputSkyfile rows 182 psListIterator *iter = psListIteratorAlloc(warp_ids->data.list, 0, false); 183 183 psMetadataItem *item = NULL; 184 184 while ((item = psListGetAndIncrement(iter))) { 185 if (! p6InputSkyfileInsert(config->dbh, run->p6_id, atoi((char *)item->data.V))) {185 if (!stackInputSkyfileInsert(config->dbh, run->stack_id, atoi((char *)item->data.V))) { 186 186 if (!psDBRollback(config->dbh)) { 187 187 psError(PS_ERR_UNKNOWN, false, "database error"); 188 188 } 189 psError(PS_ERR_UNKNOWN, false, "failed to insert p6InputSkyfile rows");189 psError(PS_ERR_UNKNOWN, false, "failed to insert stackInputSkyfile rows"); 190 190 return false; 191 191 } … … 210 210 } 211 211 212 if (! p6RunPrintObject(stdout, run, !simple)) {212 if (!stackRunPrintObject(stdout, run, !simple)) { 213 213 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 214 214 psFree(run); … … 227 227 228 228 bool status = false; 229 psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");230 if (!status) { 231 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p6_id");232 return false; 233 } 234 if (! p6_id) {235 psError(PS_ERR_UNKNOWN, true, "- p6_id is required");229 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 230 if (!status) { 231 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 232 return false; 233 } 234 if (!stack_id) { 235 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 236 236 return false; 237 237 } … … 249 249 if (state) { 250 250 // set detRun.state to state 251 return set p6RunState(config, p6_id, state);251 return setstackRunState(config, stack_id, state); 252 252 } 253 253 … … 261 261 262 262 bool status = false; 263 psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");264 if (!status) { 265 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p6_id");266 return false; 267 } 268 if (! p6_id) {269 psError(PS_ERR_UNKNOWN, true, "- p6_id is required");270 return false; 271 272 } 273 274 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");275 if (!status) { 276 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p4_id");277 return false; 278 } 279 if (! p4_id) {280 psError(PS_ERR_UNKNOWN, true, "- p4_id is required");281 return false; 282 } 283 284 285 // XXX need to validate the p4_id here263 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 264 if (!status) { 265 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 266 return false; 267 } 268 if (!stack_id) { 269 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 270 return false; 271 272 } 273 274 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 275 if (!status) { 276 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 277 return false; 278 } 279 if (!warp_id) { 280 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 281 return false; 282 } 283 284 285 // XXX need to validate the warp_id here 286 286 // XXX instead of validiting it here we should just use forgein key 287 287 // constrants 288 if (! p6InputSkyfileInsert(config->dbh,289 (psS32)atoi( p6_id),290 (psS32)atoi( p4_id)288 if (!stackInputSkyfileInsert(config->dbh, 289 (psS32)atoi(stack_id), 290 (psS32)atoi(warp_id) 291 291 )) { 292 292 psError(PS_ERR_UNKNOWN, false, "database error"); … … 312 312 psString query = psStringCopy( 313 313 "SELECT\n" 314 " p4Skyfile.*\n"315 " FROM p6Run\n"316 " JOIN p6InputSkyfile\n"317 " USING( p6_id)\n"318 " JOIN p4Skyfile\n"319 " ON p6InputSkyfile.p4_id = p4Skyfile.p4_id\n"320 " AND p6Run.skycell_id = p4Skyfile.skycell_id\n"321 " AND p6Run.tess_id = p4Skyfile.tess_id\n"314 " warpSkyfile.*\n" 315 " FROM stackRun\n" 316 " JOIN stackInputSkyfile\n" 317 " USING(stack_id)\n" 318 " JOIN warpSkyfile\n" 319 " ON stackInputSkyfile.warp_id = warpSkyfile.warp_id\n" 320 " AND stackRun.skycell_id = warpSkyfile.skycell_id\n" 321 " AND stackRun.tess_id = warpSkyfile.tess_id\n" 322 322 " WHERE\n" 323 " p6Run.state = 'run'\n"323 " stackRun.state = 'run'\n" 324 324 ); 325 325 if (config->where) { 326 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p6InputSkyfile");326 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackInputSkyfile"); 327 327 psStringAppend(&query, " AND %s", whereClause); 328 328 psFree(whereClause); … … 358 358 } 359 359 if (!psArrayLength(output)) { 360 psError(PS_ERR_UNKNOWN, false, "no p6InputSkyfile rows found");360 psError(PS_ERR_UNKNOWN, false, "no stackInputSkyfile rows found"); 361 361 psFree(output); 362 362 return true; … … 375 375 if (psArrayLength(output)) { 376 376 // negative simple so the default is true 377 if (!ippdbPrintMetadatas(stdout, output, " p6InputSkyfile", !simple)) {377 if (!ippdbPrintMetadatas(stdout, output, "stackInputSkyfile", !simple)) { 378 378 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 379 379 psFree(output); … … 402 402 psString query = psStringCopy( 403 403 "SELECT\n" 404 " p6Run.p6_id\n"405 " FROM p6Run\n"406 " LEFT JOIN p6SumSkyfile\n"407 " USING( p6_id)\n"404 " stackRun.stack_id\n" 405 " FROM stackRun\n" 406 " LEFT JOIN stackSumSkyfile\n" 407 " USING(stack_id)\n" 408 408 " WHERE\n" 409 " p6Run.state = 'run'\n"410 " AND p6SumSkyfile.p6_id IS NULL\n"409 " stackRun.state = 'run'\n" 410 " AND stackSumSkyfile.stack_id IS NULL\n" 411 411 ); 412 412 413 413 if (config->where) { 414 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p6SumSkyfile");414 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile"); 415 415 psStringAppend(&query, " AND %s", whereClause); 416 416 psFree(whereClause); … … 446 446 } 447 447 if (!psArrayLength(output)) { 448 psError(PS_ERR_UNKNOWN, false, "no p6SumSkyfile rows found");448 psError(PS_ERR_UNKNOWN, false, "no stackSumSkyfile rows found"); 449 449 psFree(output); 450 450 return true; … … 463 463 if (psArrayLength(output)) { 464 464 // negative simple so the default is true 465 if (!ippdbPrintMetadatas(stdout, output, " p6SumSkyfile", !simple)) {465 if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) { 466 466 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 467 467 psFree(output); … … 481 481 482 482 bool status = false; 483 psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");484 if (!status) { 485 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p6_id");486 return false; 487 } 488 if (! p6_id) {489 psError(PS_ERR_UNKNOWN, true, "- p6_id is required");483 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 484 if (!status) { 485 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 486 return false; 487 } 488 if (!stack_id) { 489 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 490 490 return false; 491 491 … … 520 520 } 521 521 522 // XXX need to validate the p6_id here522 // XXX need to validate the stack_id here 523 523 // XXX instead of validiting it here we should just use forgein key 524 524 // constrants 525 if (! p6SumSkyfileInsert(config->dbh,526 (psS32)atoi( p6_id),525 if (!stackSumSkyfileInsert(config->dbh, 526 (psS32)atoi(stack_id), 527 527 uri, 528 528 bg, … … 536 536 } 537 537 538 if (set p6RunState(config, p6_id, "stop")) {538 if (setstackRunState(config, stack_id, "stop")) { 539 539 if (!psDBRollback(config->dbh)) { 540 540 psError(PS_ERR_UNKNOWN, false, "database error"); 541 541 } 542 psError(PS_ERR_UNKNOWN, false, "failed to change p6Run's state");542 psError(PS_ERR_UNKNOWN, false, "failed to change stackRun's state"); 543 543 return false; 544 544 } … … 568 568 psString query = psStringCopy( 569 569 "SELECT\n" 570 " p6SumSkyfile.*\n"571 " FROM p6Run\n"572 " JOIN p6SumSkyfile\n"573 " USING( p6_id)\n"570 " stackSumSkyfile.*\n" 571 " FROM stackRun\n" 572 " JOIN stackSumSkyfile\n" 573 " USING(stack_id)\n" 574 574 " WHERE\n" 575 " p6Run.state = 'run'\n"575 " stackRun.state = 'run'\n" 576 576 ); 577 577 578 578 if (config->where) { 579 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p6SumSkyfile");579 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile"); 580 580 psStringAppend(&query, " AND %s", whereClause); 581 581 psFree(whereClause); … … 611 611 } 612 612 if (!psArrayLength(output)) { 613 psError(PS_ERR_UNKNOWN, false, "no p4Skyfile rows found");613 psError(PS_ERR_UNKNOWN, false, "no warpSkyfile rows found"); 614 614 psFree(output); 615 615 return true; … … 627 627 628 628 if (psArrayLength(output)) { 629 if (!ippdbPrintMetadatas(stdout, output, " p6SumSkyfile", !simple)) {629 if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) { 630 630 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 631 631 psFree(output); … … 640 640 641 641 642 static bool set p6RunState(pxConfig *config, const char *p6_id, const char *state)643 { 644 PS_ASSERT_PTR_NON_NULL( p6_id, false);642 static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state) 643 { 644 PS_ASSERT_PTR_NON_NULL(stack_id, false); 645 645 PS_ASSERT_PTR_NON_NULL(state, false); 646 646 … … 653 653 ) { 654 654 psError(PS_ERR_UNKNOWN, false, 655 "invalid p4Run state: %s", state);656 return false; 657 } 658 659 char *query = "UPDATE p6Run SET state = '%s' WHERE p6_id = '%s'";660 if (!p_psDBRunQuery(config->dbh, query, state, p6_id)) {655 "invalid warpRun state: %s", state); 656 return false; 657 } 658 659 char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = '%s'"; 660 if (!p_psDBRunQuery(config->dbh, query, state, stack_id)) { 661 661 psError(PS_ERR_UNKNOWN, false, 662 "failed to change state for p6_id %s", p6_id);663 return false; 664 } 665 666 return true; 667 } 662 "failed to change state for stack_id %s", stack_id); 663 return false; 664 } 665 666 return true; 667 } -
trunk/ippTools/src/warptool.c
r12004 r12024 44 44 45 45 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); 46 static bool set p4RunState(pxConfig *config, const char *p4_id, const char *state);46 static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state); 47 47 static bool isValidMode(pxConfig *config, const char *mode); 48 bool p4CompletedRuns(pxConfig *config);48 bool warpCompletedRuns(pxConfig *config); 49 49 50 50 # define MODECASE(caseName, func) \ … … 145 145 } 146 146 147 p4RunRow *p4Run = p4RunRowAlloc(147 warpRunRow *warpRun = warpRunRowAlloc( 148 148 0, // ID 149 149 mode, … … 154 154 ); 155 155 psFree(registered); 156 if (! p4Run) {157 psError(PS_ERR_UNKNOWN, false, "failed to alloc p4Run object");156 if (!warpRun) { 157 psError(PS_ERR_UNKNOWN, false, "failed to alloc warpRun object"); 158 158 return true; 159 159 } 160 if (! p4RunInsertObject(config->dbh, p4Run)) {161 psError(PS_ERR_UNKNOWN, false, "database error"); 162 psFree( p4Run);160 if (!warpRunInsertObject(config->dbh, warpRun)) { 161 psError(PS_ERR_UNKNOWN, false, "database error"); 162 psFree(warpRun); 163 163 return true; 164 164 } 165 165 166 // get the assigned p4_id167 p4Run->p4_id = psDBLastInsertID(config->dbh);166 // get the assigned warp_id 167 warpRun->warp_id = psDBLastInsertID(config->dbh); 168 168 169 169 bool simple = false; … … 173 173 if (!status) { 174 174 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 175 psFree( p4Run);176 return false; 177 } 178 } 179 180 if (! p4RunPrintObject(stdout, p4Run, !simple)) {175 psFree(warpRun); 176 return false; 177 } 178 } 179 180 if (!warpRunPrintObject(stdout, warpRun, !simple)) { 181 181 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 182 psFree( p4Run);183 return false; 184 } 185 186 psFree( p4Run);182 psFree(warpRun); 183 return false; 184 } 185 186 psFree(warpRun); 187 187 188 188 return true; … … 195 195 196 196 bool status = false; 197 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");198 if (!status) { 199 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p4t_id");200 return false; 201 } 202 if (! p4_id) {203 psError(PS_ERR_UNKNOWN, true, "- p4_id is required");197 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 198 if (!status) { 199 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warpt_id"); 200 return false; 201 } 202 if (!warp_id) { 203 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 204 204 return false; 205 205 } … … 217 217 if (state) { 218 218 // set detRun.state to state 219 return set p4RunState(config, p4_id, state);219 return setwarpRunState(config, warp_id, state); 220 220 } 221 221 … … 229 229 230 230 bool status = false; 231 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");232 if (!status) { 233 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p4_id");234 return false; 235 } 236 if (! p4_id) {237 psError(PS_ERR_UNKNOWN, true, "- p4_id is required");231 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 232 if (!status) { 233 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 234 return false; 235 } 236 if (!warp_id) { 237 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 238 238 return false; 239 239 } … … 250 250 251 251 // defaults to 0 252 psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");253 if (!status) { 254 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p3_version");252 psS32 cam_version = psMetadataLookupS32(&status, config->args, "-cam_version"); 253 if (!status) { 254 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version"); 255 255 return false; 256 256 } 257 257 258 258 // defaults to false 259 bool magiced = psMetadataLookupBool(&status, config->args, "- p3_version");260 if (!status) { 261 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p3_version");262 return false; 263 } 264 265 // XXX need to validate the p4_id here259 bool magiced = psMetadataLookupBool(&status, config->args, "-cam_version"); 260 if (!status) { 261 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version"); 262 return false; 263 } 264 265 // XXX need to validate the warp_id here 266 266 // XXX instead of validiting it here we should just use forgein key 267 267 // constrants 268 if (! p4InputExpInsert(config->dbh,269 (psS32)atoi( p4_id),268 if (!warpInputExpInsert(config->dbh, 269 (psS32)atoi(warp_id), 270 270 exp_tag, 271 p3_version,271 cam_version, 272 272 magiced 273 273 )) { … … 294 294 psString query = psStringCopy( 295 295 "SELECT\n" 296 " p3ProcessedExp.*\n"297 " FROM p4Run\n"298 " JOIN p4InputExp\n"299 " USING( p4_id)\n"300 " JOIN p3ProcessedExp\n"301 " ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"302 " AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"296 " camProcessedExp.*\n" 297 " FROM warpRun\n" 298 " JOIN warpInputExp\n" 299 " USING(warp_id)\n" 300 " JOIN camProcessedExp\n" 301 " ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n" 302 " AND warpInputExp.cam_version = camProcessedExp.cam_version\n" 303 303 " WHERE\n" 304 " p4Run.state = 'run'\n"305 " AND p3ProcessedExp.fault = 0\n"304 " warpRun.state = 'run'\n" 305 " AND camProcessedExp.fault = 0\n" 306 306 ); 307 307 308 308 if (config->where) { 309 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4InputExp");309 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp"); 310 310 psStringAppend(&query, " AND %s", whereClause); 311 311 psFree(whereClause); … … 358 358 if (psArrayLength(output)) { 359 359 // negative simple so the default is true 360 if (!ippdbPrintMetadatas(stdout, output, " p4InputExp", !simple)) {360 if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) { 361 361 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 362 362 psFree(output); … … 386 386 "SELECT\n" 387 387 " rawImfile.*\n" 388 " FROM p4Run\n"389 " JOIN p4InputExp\n"390 " USING( p4_id)\n"388 " FROM warpRun\n" 389 " JOIN warpInputExp\n" 390 " USING(warp_id)\n" 391 391 " JOIN rawImfile\n" // is there any reason not to refer back to rawimfiles? 392 " ON p4InputExp.exp_tag = rawImfile.exp_tag\n"392 " ON warpInputExp.exp_tag = rawImfile.exp_tag\n" 393 393 " WHERE\n" 394 " p4Run.state = 'run'\n"394 " warpRun.state = 'run'\n" 395 395 ); 396 396 if (config->where) { 397 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4InputExp");397 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp"); 398 398 psStringAppend(&query, " AND %s", whereClause); 399 399 psFree(whereClause); … … 446 446 if (psArrayLength(output)) { 447 447 // negative simple so the default is true 448 if (!ippdbPrintMetadatas(stdout, output, " p4InputImfile", !simple)) {448 if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) { 449 449 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 450 450 psFree(output); … … 473 473 psString query = psStringCopy( 474 474 "SELECT\n" 475 " p3ProcessedExp.*\n"476 " FROM p4Run\n"477 " JOIN p4InputExp\n"478 " USING( p4_id)\n"479 " JOIN p3ProcessedExp\n"480 " ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"481 " AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"482 " LEFT JOIN p4SkyCellMap\n"483 " ON p4InputExp.p4_id = p4SkyCellMap.p4_id\n"484 " AND p4InputExp.exp_tag = p4SkyCellMap.exp_tag\n"485 " AND p4InputExp.p3_version = p4SkyCellMap.p3_version\n"475 " camProcessedExp.*\n" 476 " FROM warpRun\n" 477 " JOIN warpInputExp\n" 478 " USING(warp_id)\n" 479 " JOIN camProcessedExp\n" 480 " ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n" 481 " AND warpInputExp.cam_version = camProcessedExp.cam_version\n" 482 " LEFT JOIN warpSkyCellMap\n" 483 " ON warpInputExp.warp_id = warpSkyCellMap.warp_id\n" 484 " AND warpInputExp.exp_tag = warpSkyCellMap.exp_tag\n" 485 " AND warpInputExp.cam_version = warpSkyCellMap.cam_version\n" 486 486 " WHERE\n" 487 " p4Run.state = 'run'\n"488 " AND p3ProcessedExp.fault = 0\n"489 " AND p4SkyCellMap.p4_id IS NULL\n"490 " AND p4SkyCellMap.exp_tag IS NULL\n"491 " AND p4SkyCellMap.p3_version IS NULL\n"487 " warpRun.state = 'run'\n" 488 " AND camProcessedExp.fault = 0\n" 489 " AND warpSkyCellMap.warp_id IS NULL\n" 490 " AND warpSkyCellMap.exp_tag IS NULL\n" 491 " AND warpSkyCellMap.cam_version IS NULL\n" 492 492 ); 493 493 494 494 if (config->where) { 495 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4InputExp");495 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp"); 496 496 psStringAppend(&query, " AND %s", whereClause); 497 497 psFree(whereClause); … … 544 544 if (psArrayLength(output)) { 545 545 // negative simple so the default is true 546 if (!ippdbPrintMetadatas(stdout, output, " p4InputExp", !simple)) {546 if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) { 547 547 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 548 548 psFree(output); … … 623 623 // this conversion isn't strictly nessicary but it's an easy way of 624 624 // validating the format 625 p4SkyCellMapRow *row = p4SkyCellMapObjectFromMetadata(sc);625 warpSkyCellMapRow *row = warpSkyCellMapObjectFromMetadata(sc); 626 626 if (!row) { 627 psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a p4SkyCellMap object", mapfile);627 psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a warpSkyCellMap object", mapfile); 628 628 psFree(iter); 629 629 psFree(skycells); … … 631 631 } 632 632 633 if (! p4SkyCellMapInsertObject(config->dbh, row)) {633 if (!warpSkyCellMapInsertObject(config->dbh, row)) { 634 634 psErrorCode err = psErrorCodeLast(); 635 635 switch (err) { … … 670 670 psString query = psStringCopy( 671 671 "SELECT\n" 672 " p4SkyCellMap.*\n"673 " FROM p4Run\n"674 " JOIN p4SkyCellMap\n"675 " USING( p4_id)\n"672 " warpSkyCellMap.*\n" 673 " FROM warpRun\n" 674 " JOIN warpSkyCellMap\n" 675 " USING(warp_id)\n" 676 676 " WHERE\n" 677 " p4Run.state = 'run'\n"677 " warpRun.state = 'run'\n" 678 678 ); 679 679 680 680 if (config->where) { 681 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4SkyCellMap");681 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap"); 682 682 psStringAppend(&query, " AND %s", whereClause); 683 683 psFree(whereClause); … … 713 713 } 714 714 if (!psArrayLength(output)) { 715 psError(PS_ERR_UNKNOWN, false, "no p4SkyCellMap rows found");715 psError(PS_ERR_UNKNOWN, false, "no warpSkyCellMap rows found"); 716 716 psFree(output); 717 717 return true; … … 730 730 if (psArrayLength(output)) { 731 731 // negative simple so the default is true 732 if (!ippdbPrintMetadatas(stdout, output, " p4SkyCellMap", !simple)) {732 if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) { 733 733 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 734 734 psFree(output); … … 757 757 psString query = psStringCopy( 758 758 "SELECT\n" 759 " p4SkyCellMap.*\n"760 " FROM p4Run\n"761 " JOIN p4SkyCellMap\n"762 " USING( p4_id)\n"763 " LEFT JOIN p4Skyfile\n"764 " USING( p4_id, skycell_id, tess_id)\n"759 " warpSkyCellMap.*\n" 760 " FROM warpRun\n" 761 " JOIN warpSkyCellMap\n" 762 " USING(warp_id)\n" 763 " LEFT JOIN warpSkyfile\n" 764 " USING(warp_id, skycell_id, tess_id)\n" 765 765 " WHERE\n" 766 " p4Run.state = 'run'\n"767 " AND p4Skyfile.p4_id IS NULL\n"768 " AND p4Skyfile.skycell_id IS NULL\n"769 " AND p4Skyfile.tess_id IS NULL\n"766 " warpRun.state = 'run'\n" 767 " AND warpSkyfile.warp_id IS NULL\n" 768 " AND warpSkyfile.skycell_id IS NULL\n" 769 " AND warpSkyfile.tess_id IS NULL\n" 770 770 ); 771 771 772 772 if (config->where) { 773 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4SkyCellMap");773 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap"); 774 774 psStringAppend(&query, " AND %s", whereClause); 775 775 psFree(whereClause); … … 805 805 } 806 806 if (!psArrayLength(output)) { 807 psError(PS_ERR_UNKNOWN, false, "no p4PendingSkyCell rows found");807 psError(PS_ERR_UNKNOWN, false, "no warpPendingSkyCell rows found"); 808 808 psFree(output); 809 809 return true; … … 822 822 if (psArrayLength(output)) { 823 823 // negative simple so the default is true 824 if (!ippdbPrintMetadatas(stdout, output, " p4PendingSkyCell", !simple)) {824 if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) { 825 825 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 826 826 psFree(output); … … 840 840 841 841 bool status = false; 842 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");843 if (!status) { 844 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p4_id");845 return false; 846 } 847 if (! p4_id) {848 psError(PS_ERR_UNKNOWN, true, "- p4_id is required");842 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 843 if (!status) { 844 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 845 return false; 846 } 847 if (!warp_id) { 848 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 849 849 return false; 850 850 } … … 900 900 } 901 901 902 // XXX need to validate that this coresponds to an p4InputImfile903 if (! p4SkyfileInsert(config->dbh,904 (psS32)atoi( p4_id),902 // XXX need to validate that this coresponds to an warpInputImfile 903 if (!warpSkyfileInsert(config->dbh, 904 (psS32)atoi(warp_id), 905 905 skycell_id, 906 906 tess_id, … … 916 916 } 917 917 918 if (! p4CompletedRuns(config)) {918 if (!warpCompletedRuns(config)) { 919 919 if (!psDBRollback(config->dbh)) { 920 920 psError(PS_ERR_UNKNOWN, false, "database error"); … … 933 933 } 934 934 935 bool p4CompletedRuns(pxConfig *config)935 bool warpCompletedRuns(pxConfig *config) 936 936 { 937 937 PS_ASSERT_PTR_NON_NULL(config, false); … … 945 945 // modifying. 946 946 char *query = 947 "UPDATE p4Run\n"948 " SET p4Run.state = 'stop'\n"947 "UPDATE warpRun\n" 948 " SET warpRun.state = 'stop'\n" 949 949 " WHERE\n" 950 " p4Run.p4_id =\n"950 " warpRun.warp_id =\n" 951 951 " (SELECT DISTINCT\n" 952 " p4_id\n"952 " warp_id\n" 953 953 " FROM\n" 954 954 " (SELECT DISTINCT\n" 955 " p4Run.p4_id,\n"956 " p4SkyCellMap.p4_id as foo,\n"957 " p4Skyfile.p4_id as bar\n"958 " FROM p4Run\n"959 " JOIN p4SkyCellMap\n"960 " USING( p4_id)\n"961 " LEFT JOIN p4Skyfile\n"962 " USING( p4_id, skycell_id, tess_id)\n"955 " warpRun.warp_id,\n" 956 " warpSkyCellMap.warp_id as foo,\n" 957 " warpSkyfile.warp_id as bar\n" 958 " FROM warpRun\n" 959 " JOIN warpSkyCellMap\n" 960 " USING(warp_id)\n" 961 " LEFT JOIN warpSkyfile\n" 962 " USING(warp_id, skycell_id, tess_id)\n" 963 963 " WHERE\n" 964 " p4Run.state = 'run'\n"964 " warpRun.state = 'run'\n" 965 965 " GROUP BY\n" 966 " p4Run.p4_id\n"966 " warpRun.warp_id\n" 967 967 " HAVING\n" 968 " COUNT( p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"968 " COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n" 969 969 " ) as Foo\n" 970 970 " )\n"; … … 978 978 char *query = 979 979 "CREATE TEMPORARY TABLE finished\n" 980 " ( p4_id INT, PRIMARY KEY(p4_id)) ENGINE=MEMORY\n";980 " (warp_id INT, PRIMARY KEY(warp_id)) ENGINE=MEMORY\n"; 981 981 982 982 if (!p_psDBRunQuery(config->dbh, query)) { … … 990 990 "INSERT INTO finished\n" 991 991 " SELECT\n" 992 " p4_id\n"992 " warp_id\n" 993 993 " FROM\n" 994 994 " (SELECT DISTINCT\n" 995 " p4Run.p4_id,\n"996 " p4SkyCellMap.p4_id as foo,\n"997 " p4Skyfile.p4_id as bar\n"998 " FROM p4Run\n"999 " JOIN p4SkyCellMap\n"1000 " USING( p4_id)\n"1001 " LEFT JOIN p4Skyfile\n"1002 " USING( p4_id, skycell_id, tess_id)\n"995 " warpRun.warp_id,\n" 996 " warpSkyCellMap.warp_id as foo,\n" 997 " warpSkyfile.warp_id as bar\n" 998 " FROM warpRun\n" 999 " JOIN warpSkyCellMap\n" 1000 " USING(warp_id)\n" 1001 " LEFT JOIN warpSkyfile\n" 1002 " USING(warp_id, skycell_id, tess_id)\n" 1003 1003 " WHERE\n" 1004 " p4Run.state = 'run'\n"1004 " warpRun.state = 'run'\n" 1005 1005 " GROUP BY\n" 1006 " p4Run.p4_id\n"1006 " warpRun.warp_id\n" 1007 1007 " HAVING\n" 1008 " COUNT( p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"1008 " COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n" 1009 1009 " ) as Foo \n"; 1010 1010 … … 1017 1017 { 1018 1018 char *query = 1019 "UPDATE p4Run\n"1020 " SET p4Run.state = 'stop'\n"1019 "UPDATE warpRun\n" 1020 " SET warpRun.state = 'stop'\n" 1021 1021 " WHERE\n" 1022 " p4Run.p4_id =\n"1022 " warpRun.warp_id =\n" 1023 1023 " (SELECT DISTINCT\n" 1024 " p4_id\n"1024 " warp_id\n" 1025 1025 " FROM finished\n" 1026 1026 " )\n"; … … 1050 1050 psString query = psStringCopy( 1051 1051 "SELECT\n" 1052 " p4Skyfile.*\n"1053 " FROM p4Run\n"1054 " JOIN p4Skyfile\n"1055 " USING( p4_id)\n"1052 " warpSkyfile.*\n" 1053 " FROM warpRun\n" 1054 " JOIN warpSkyfile\n" 1055 " USING(warp_id)\n" 1056 1056 " WHERE\n" 1057 " p4Run.state = 'run'\n"1057 " warpRun.state = 'run'\n" 1058 1058 ); 1059 1059 1060 1060 if (config->where) { 1061 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p4Skyfile");1061 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyfile"); 1062 1062 psStringAppend(&query, " AND %s", whereClause); 1063 1063 psFree(whereClause); … … 1093 1093 } 1094 1094 if (!psArrayLength(output)) { 1095 psError(PS_ERR_UNKNOWN, false, "no p4Skyfile rows found");1095 psError(PS_ERR_UNKNOWN, false, "no warpSkyfile rows found"); 1096 1096 psFree(output); 1097 1097 return true; … … 1110 1110 if (psArrayLength(output)) { 1111 1111 // negative simple so the default is true 1112 if (!ippdbPrintMetadatas(stdout, output, " p4Skyfile", !simple)) {1112 if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) { 1113 1113 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1114 1114 psFree(output); … … 1123 1123 1124 1124 1125 static bool set p4RunState(pxConfig *config, const char *p4_id, const char *state)1126 { 1127 PS_ASSERT_PTR_NON_NULL( p4_id, false);1125 static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state) 1126 { 1127 PS_ASSERT_PTR_NON_NULL(warp_id, false); 1128 1128 PS_ASSERT_PTR_NON_NULL(state, false); 1129 1129 … … 1136 1136 ) { 1137 1137 psError(PS_ERR_UNKNOWN, false, 1138 "invalid p4Run state: %s", state);1139 return false; 1140 } 1141 1142 char *query = "UPDATE p4Run SET state = '%s' WHERE p4_id = '%s'";1143 if (!p_psDBRunQuery(config->dbh, query, state, p4_id)) {1138 "invalid warpRun state: %s", state); 1139 return false; 1140 } 1141 1142 char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = '%s'"; 1143 if (!p_psDBRunQuery(config->dbh, query, state, warp_id)) { 1144 1144 psError(PS_ERR_UNKNOWN, false, 1145 "failed to change state for p4_id %s", p4_id);1145 "failed to change state for warp_id %s", warp_id); 1146 1146 return false; 1147 1147 } -
trunk/ippTools/src/warptoolConfig.c
r11997 r12024 59 59 // -updaterun 60 60 psMetadata *updaterunArgs = psMetadataAlloc(); 61 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "- p4_id", 0,62 "define p4ID (required)", NULL);61 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-warp_id", 0, 62 "define warp ID (required)", NULL); 63 63 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, 64 64 "set state (required)", NULL); … … 72 72 // -addinputexp 73 73 psMetadata *addinputexpArgs = psMetadataAlloc(); 74 psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "- p4_id", 0,75 "define p4ID (required)", NULL);74 psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-warp_id", 0, 75 "define warp ID (required)", NULL); 76 76 psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 77 77 "define exposure tag (required)", NULL); 78 psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "- p3_version", 0,78 psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "-cam_version", 0, 79 79 "define phase 3 version of exposure tag (required)", 0); 80 80 psMetadataAddBool(addinputexpArgs, PS_LIST_TAIL, "-magiced", 0, … … 83 83 // -exp 84 84 psMetadata *expArgs = psMetadataAlloc(); 85 psMetadataAddStr(expArgs, PS_LIST_TAIL, "- p4_id", 0,86 "define p4ID (required)", NULL);85 psMetadataAddStr(expArgs, PS_LIST_TAIL, "-warp_id", 0, 86 "define warp ID (required)", NULL); 87 87 psMetadataAddStr(expArgs, PS_LIST_TAIL, "-exp_tag", 0, 88 88 "define exposure tag (required)", NULL); 89 psMetadataAddS32(expArgs, PS_LIST_TAIL, "- p3_version", 0,89 psMetadataAddS32(expArgs, PS_LIST_TAIL, "-cam_version", 0, 90 90 "define phase 3 version of exposure tag (required)", 0); 91 91 psMetadataAddU64(expArgs, PS_LIST_TAIL, "-limit", 0, … … 96 96 // -imfile 97 97 psMetadata *imfileArgs = psMetadataAlloc(); 98 psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "- p4_id", 0,99 "define p4ID (required)", NULL);98 psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-warp_id", 0, 99 "define warp ID (required)", NULL); 100 100 psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 101 101 "define exposure tag (required)", NULL); 102 psMetadataAddS32(imfileArgs, PS_LIST_TAIL, "- p3_version", 0,102 psMetadataAddS32(imfileArgs, PS_LIST_TAIL, "-cam_version", 0, 103 103 "define phase 3 version of exposure tag (required)", 0); 104 104 psMetadataAddU64(imfileArgs, PS_LIST_TAIL, "-limit", 0, … … 109 109 // -tooverlap 110 110 psMetadata *tooverlapArgs = psMetadataAlloc(); 111 psMetadataAddStr(tooverlapArgs, PS_LIST_TAIL, "- p4_id", 0,112 "search by p4ID", NULL);111 psMetadataAddStr(tooverlapArgs, PS_LIST_TAIL, "-warp_id", 0, 112 "search by warp ID", NULL); 113 113 psMetadataAddU64(tooverlapArgs, PS_LIST_TAIL, "-limit", 0, 114 114 "limit result set to N items", 0); … … 123 123 // -scmap 124 124 psMetadata *scmapArgs = psMetadataAlloc(); 125 psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "- p4_id", 0,126 "search by p4ID", NULL);125 psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-warp_id", 0, 126 "search by warp ID", NULL); 127 127 psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-skycell_id", 0, 128 128 "searcy by skycell ID", NULL); … … 136 136 // -towarped 137 137 psMetadata *towarpedArgs = psMetadataAlloc(); 138 psMetadataAddStr(towarpedArgs, PS_LIST_TAIL, "- p4_id", 0,139 "search by p4ID", NULL);138 psMetadataAddStr(towarpedArgs, PS_LIST_TAIL, "-warp_id", 0, 139 "search by warp ID", NULL); 140 140 psMetadataAddU64(towarpedArgs, PS_LIST_TAIL, "-limit", 0, 141 141 "limit result set to N items", 0); … … 145 145 // -addwarped 146 146 psMetadata *addwarpedArgs = psMetadataAlloc(); 147 psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "- p4_id", 0,148 "define p4ID (required)", NULL);147 psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-warp_id", 0, 148 "define warp ID (required)", NULL); 149 149 psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-skycell_id", 0, 150 150 "define skycell ID (required)", NULL); … … 160 160 // -warped 161 161 psMetadata *warpedArgs = psMetadataAlloc(); 162 psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "- p4_id", 0,163 "search by p4ID", NULL);162 psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-warp_id", 0, 163 "search by warp ID", NULL); 164 164 psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-skycell_id", 0, 165 165 "define skycell ID (required)", NULL); … … 168 168 psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-exp_tag", 0, 169 169 "define exposure tag (required)", NULL); 170 psMetadataAddS32(warpedArgs, PS_LIST_TAIL, "- p3_version", 0,170 psMetadataAddS32(warpedArgs, PS_LIST_TAIL, "-cam_version", 0, 171 171 "define phase 3 version of exposure tag (required)", 0); 172 172 psMetadataAddU64(warpedArgs, PS_LIST_TAIL, "-limit", 0, … … 285 285 psString str = NULL; 286 286 bool status = false; 287 if ((str = psMetadataLookupStr(&status, config->args, "- p4_id"))) {288 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, " p4_id", 0, "==", (psS32)atoi(str))) {289 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");287 if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) { 288 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) { 289 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 290 290 psFree(config); 291 291 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
