Changeset 35489
- Timestamp:
- May 2, 2013, 2:15:28 PM (13 years ago)
- Location:
- tags/ipp-20130307
- Files:
-
- 48 edited
- 38 copied
-
DataStoreServer (modified) (1 prop)
-
DataStoreServer/web/php (copied) (copied from trunk/DataStoreServer/web/php )
-
DataStoreServer/web/php/getsmf.php (copied) (copied from trunk/DataStoreServer/web/php/getsmf.php )
-
PS-IPP-PStamp (modified) (1 prop)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (40 diffs)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (7 diffs)
-
dbconfig (modified) (1 prop)
-
dbconfig/changes.txt (modified) (2 diffs, 1 prop)
-
dbconfig/lap.md (modified) (1 diff)
-
ippScripts (modified) (1 prop)
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/scripts/camera_exp.pl (modified) (1 diff)
-
ippScripts/scripts/mergedvodb_merge.pl (modified) (1 diff)
-
ippScripts/scripts/minidvodb_premerge.pl (modified) (5 diffs)
-
ippScripts/scripts/queuestaticsky.pl (copied) (copied from trunk/ippScripts/scripts/queuestaticsky.pl )
-
ippScripts/scripts/relgroup_exp_list.pl (modified) (6 diffs)
-
ippScripts/scripts/whichimage (modified) (2 diffs)
-
ippTasks (modified) (1 prop)
-
ippTasks/lapgroup.pro (copied) (copied from trunk/ippTasks/lapgroup.pro )
-
ippTasks/pstamp.pro (modified) (1 diff)
-
ippTasks/release.pro (copied) (copied from trunk/ippTasks/release.pro )
-
ippTasks/survey.pro (modified) (6 diffs)
-
ippTools (modified) (1 prop)
-
ippTools/share (modified) (1 prop)
-
ippTools/share/Makefile.am (modified) (2 diffs)
-
ippTools/share/addtool_find_processedexp_cam.sql (modified) (1 diff)
-
ippTools/share/laptool_filtersforgroup.sql (copied) (copied from trunk/ippTools/share/laptool_filtersforgroup.sql )
-
ippTools/share/laptool_pendinggroup.sql (copied) (copied from trunk/ippTools/share/laptool_pendinggroup.sql )
-
ippTools/share/laptool_revertgroup.sql (copied) (copied from trunk/ippTools/share/laptool_revertgroup.sql )
-
ippTools/share/pstamptool_completedreq.sql (modified) (1 diff)
-
ippTools/share/pstamptool_getdependent.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (5 diffs, 1 prop)
-
ippTools/share/releasetool_definerelgroup_select_exp_lap.sql (modified) (1 diff)
-
ippTools/share/releasetool_definerelstack.sql (modified) (2 diffs)
-
ippTools/share/releasetool_definerelstack_with_skycal.sql (modified) (1 diff)
-
ippTools/share/releasetool_listrelexp.sql (modified) (1 diff)
-
ippTools/share/releasetool_listrelstack.sql (copied) (copied from trunk/ippTools/share/releasetool_listrelstack.sql )
-
ippTools/share/releasetool_pendingrelgroup.sql (modified) (1 diff)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/laptool.c (modified) (3 diffs)
-
ippTools/src/laptool.h (modified) (1 diff)
-
ippTools/src/laptoolConfig.c (modified) (3 diffs)
-
ippTools/src/pstamptool.c (modified) (16 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (3 diffs)
-
ippTools/src/releasetool.c (modified) (17 diffs)
-
ippTools/src/releasetoolConfig.c (modified) (5 diffs)
-
pstamp (modified) (1 prop)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/psmkreq (modified) (14 diffs)
-
pstamp/scripts/pstamp_finish.pl (modified) (4 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (4 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_request_file (modified) (9 diffs)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (36 diffs)
-
pstamp/src/ppstampParseCamera.c (modified) (3 diffs)
-
pstamp/src/pstampdump.c (modified) (2 diffs)
-
pstamp/test/gpc1 (copied) (copied from trunk/pstamp/test/gpc1 )
-
pstamp/test/gpc1/chip.bycoord.norelease.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.bycoord.norelease.txt )
-
pstamp/test/gpc1/chip.bycoord.preview.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.bycoord.preview.txt )
-
pstamp/test/gpc1/chip.bycoord.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.bycoord.txt )
-
pstamp/test/gpc1/chip.bydiff.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.bydiff.txt )
-
pstamp/test/gpc1/chip.byexp.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.byexp.txt )
-
pstamp/test/gpc1/chip.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.byid.txt )
-
pstamp/test/gpc1/diff.bydiff.txt (copied) (copied from trunk/pstamp/test/gpc1/diff.bydiff.txt )
-
pstamp/test/gpc1/diff.byid.inverse.txt (copied) (copied from trunk/pstamp/test/gpc1/diff.byid.inverse.txt )
-
pstamp/test/gpc1/diff.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/diff.byid.txt )
-
pstamp/test/gpc1/extver.1.txt (copied) (copied from trunk/pstamp/test/gpc1/extver.1.txt )
-
pstamp/test/gpc1/raw.bycoord.txt (copied) (copied from trunk/pstamp/test/gpc1/raw.bycoord.txt )
-
pstamp/test/gpc1/raw.byexp.txt (copied) (copied from trunk/pstamp/test/gpc1/raw.byexp.txt )
-
pstamp/test/gpc1/raw.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/raw.byid.txt )
-
pstamp/test/gpc1/stack.bycoord.3pi.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.bycoord.3pi.txt )
-
pstamp/test/gpc1/stack.bydiff.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.bydiff.txt )
-
pstamp/test/gpc1/stack.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.byid.txt )
-
pstamp/test/gpc1/stack.byskycell.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.byskycell.txt )
-
pstamp/test/gpc1/stack.md08.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.md08.txt )
-
pstamp/test/gpc1/test_qub_ps_request_20130426_225546.tbl (copied) (copied from trunk/pstamp/test/gpc1/test_qub_ps_request_20130426_225546.tbl )
-
pstamp/test/gpc1/tests_todo (copied) (copied from trunk/pstamp/test/gpc1/tests_todo )
-
pstamp/test/gpc1/warp.bycoord.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.bycoord.txt )
-
pstamp/test/gpc1/warp.bycoord.wrongskycell.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.bycoord.wrongskycell.txt )
-
pstamp/test/gpc1/warp.bydiff.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.bydiff.txt )
-
pstamp/test/gpc1/warp.byexp.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.byexp.txt )
-
pstamp/test/gpc1/warp.byid.noverlap.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.byid.noverlap.txt )
-
pstamp/test/gpc1/warp.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.byid.txt )
-
pstamp/test/gpc1/warp.byskycell.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.byskycell.txt )
-
pstamp/test/maketestreq (copied) (copied from trunk/pstamp/test/maketestreq )
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20130307/DataStoreServer
- Property svn:mergeinfo set to
-
tags/ipp-20130307/PS-IPP-PStamp
- Property svn:mergeinfo set to
-
tags/ipp-20130307/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r35480 r35489 15 15 our @EXPORT_OK = qw( 16 16 locate_images 17 locate_images_for_row 17 18 resolve_project 18 19 getCamRunByCamID … … 46 47 my $last_project = ""; 47 48 48 my ($regtool, $chiptool, $camtool, $warptool, $stacktool, $difftool );49 my ($regtool, $chiptool, $camtool, $warptool, $stacktool, $difftool, $releasetool); 49 50 my ($pstamptool, $dvoImagesAtCoords, $whichimage, $ppConfigDump); 50 51 51 52 my $default_data_groups = ""; 53 54 # old locate_images() function. Still used by dqueryparse 55 # Postage stamp server now uses locate_images_for_row() 52 56 53 57 sub locate_images { … … 56 60 my $rowList = shift; # required 57 61 my $req_type = shift; # required 58 my $ img_type = shift; # required62 my $stage = shift; # required 59 63 my $id = shift; # required unless req_type eq bycoord or byskycell 60 64 my $tess_id = shift; … … 78 82 ($req_type ne "byskycell"); 79 83 80 if (!$d efault_data_groups) {84 if (!$data_group and !$default_data_groups) { 81 85 $default_data_groups = load_data_groups($verbose); 82 86 } … … 106 110 my $x = $row->{CENTER_X}; 107 111 my $y = $row->{CENTER_Y}; 108 my $results = lookup_bycoord($ipprc, $row List, $imagedb, $img_type, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose);112 my $results = lookup_bycoord($ipprc, $row, $imagedb, $stage, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 109 113 return $results; 110 114 } 111 115 112 if (($req_type eq "byid") and ($ img_type eq "diff")) {116 if (($req_type eq "byid") and ($stage eq "diff")) { 113 117 # lookups of all of the information for diff images requires a two level lookup to 114 118 # get the exposure information. Switching the req_type allows us to keep that code 115 119 # in one place 116 120 $req_type = "bydiff"; 117 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $ img_type, $verbose);121 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $stage, $verbose); 118 122 return $results; 119 123 } … … 122 126 # for bydiff reuqests we go look up the diffRun to obtain exp_id, chip_id, warp_id, stack_id, or 123 127 # the image from the diffRun 124 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $ img_type, $verbose);128 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $stage, $verbose); 125 129 if (!$results) { 126 130 return undef; 127 131 } 128 if ($ img_type eq "diff") {132 if ($stage eq "diff") { 129 133 # lookup_diff has done all of the work 130 134 return $results; … … 132 136 133 137 my $image = $results->[0]; 134 if ($ img_type eq "raw") {138 if ($stage eq "raw") { 135 139 $req_type = "byid"; 136 140 $id = $image->{exp_id}; 137 141 return undef if !$id; 138 142 # fall through and lookup byid 139 } elsif ($ img_type eq "chip") {143 } elsif ($stage eq "chip") { 140 144 $req_type = "byid"; 141 145 $id = $image->{chip_id}; 142 146 return undef if !$id; 143 147 # fall through and lookup byid 144 } elsif ($ img_type eq "warp") {148 } elsif ($stage eq "warp") { 145 149 $req_type = "byid"; 146 150 $id = $image->{warp_id}; … … 148 152 return undef if !$id; 149 153 # fall through and lookup by warp_id 150 } elsif ($ img_type eq "stack") {154 } elsif ($stage eq "stack") { 151 155 $req_type = "byid"; 152 156 $id = $image->{stack_id}; … … 155 159 } else { 156 160 # This is checked this elsewhere? 157 print STDERR "Error: $ img_type is an unknown image type\n";161 print STDERR "Error: $stage is an unknown image type\n"; 158 162 return undef; 159 163 } 160 164 } elsif ($req_type eq "byskycell") { 161 if (($ img_type eq "raw") or ($img_type eq "chip")) {165 if (($stage eq "raw") or ($stage eq "chip")) { 162 166 print STDERR "REQ_TYPE byskycell not supported for IMG_TYPE raw or chip\n"; 163 167 return undef; … … 169 173 } 170 174 171 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $img_type, $id, $tess_id, $component, 172 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 175 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 176 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 177 0, 0, # fwhm cuts are not applied here 178 undef, undef, undef, $verbose); 179 180 return $results; 181 } 182 183 sub locate_images_for_row { 184 my $ipprc = shift; 185 my $imagedb = shift; 186 my $camera = shift; 187 my $row = shift; 188 my $verbose = shift; 189 190 my $req_type = $row->{REQ_TYPE}; 191 192 # we die in response to bad data in request files 193 # The caller is responsible for updating the database 194 # pstampparse.pl error checks now so this shouldn't happen 195 &my_die("Unknown req_type: $req_type", $PS_EXIT_PROG_ERROR) 196 if ($req_type ne "byid") and 197 ($req_type ne "byexp") and 198 ($req_type ne "bycoord") and 199 ($req_type ne "bydiff") and 200 ($req_type ne "byskycell"); 201 202 my $stage = $row->{IMG_TYPE}; 203 my $id = $row->{ID}; 204 my $component = $row->{COMPONENT}; 205 my $tess_id = $row->{TESS_ID}; 206 207 my $filter = $row->{REQFILT}; 208 my $mjd_min = $row->{MJD_MIN}; 209 my $mjd_max = $row->{MJD_MAX}; 210 my $data_group = $row->{DATA_GROUP}; 211 if (isnull($data_group) and !$default_data_groups) { 212 $default_data_groups = load_data_groups($verbose); 213 } 214 215 my $rownum = $row->{ROWNUM}; 216 my $job_type = $row->{JOB_TYPE}; 217 my $option_mask= $row->{OPTION_MASK}; 218 219 my $dateobs_begin; 220 my $dateobs_end; 221 if (!iszero($mjd_min)) { 222 $dateobs_begin = mjd_to_dateobs($mjd_min); 223 } 224 if (!iszero($mjd_max)) { 225 $dateobs_end = mjd_to_dateobs($mjd_max); 226 } 227 if (isnull($tess_id)) { 228 $tess_id = undef; 229 } 230 if (isnull($data_group)) { 231 $data_group = undef; 232 } 233 if (isnull($filter)) { 234 $filter = undef; 235 } 236 237 if ($req_type eq "bycoord") { 238 my $x = $row->{CENTER_X}; 239 my $y = $row->{CENTER_Y}; 240 my $results = lookup_bycoord($ipprc, $row, $imagedb, $stage, $tess_id, $component, 0, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 241 return $results; 242 } 243 244 # for compatability with the lower level functions that haven't been converted to take a single row 245 my $rowList = [$row]; 246 247 if (($req_type eq "byid") and ($stage eq "diff")) { 248 # lookups of all of the information for diff images requires a two level lookup to 249 # get the exposure information. Switching the req_type allows us to keep that code 250 # in one place 251 $req_type = "bydiff"; 252 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $stage, $verbose); 253 return $results; 254 } 255 256 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 257 if (!$tess_id and $default_tess_id) { 258 $tess_id = $default_tess_id; 259 } 260 261 if ($req_type eq "bydiff") { 262 # for bydiff reuqests we go look up the diffRun to obtain exp_id, chip_id, warp_id, stack_id, or 263 # the image from the diffRun 264 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $stage, $verbose); 265 if (!$results) { 266 return undef; 267 } 268 if ($stage eq "diff") { 269 # lookup_diff has done all of the work 270 return $results; 271 } 272 273 my $image = $results->[0]; 274 if ($stage eq "raw") { 275 $req_type = "byid"; 276 $id = $image->{exp_id}; 277 return undef if !$id; 278 # fall through and lookup byid 279 } elsif ($stage eq "chip") { 280 $req_type = "byid"; 281 $id = $image->{chip_id}; 282 return undef if !$id; 283 # fall through and lookup byid 284 } elsif ($stage eq "warp") { 285 $req_type = "byid"; 286 $id = $image->{warp_id}; 287 $component = $image->{skycell_id}; 288 return undef if !$id; 289 # fall through and lookup by warp_id 290 } elsif ($stage eq "stack") { 291 $req_type = "byid"; 292 $id = $image->{stack_id}; 293 return undef if !$id; 294 # fall though and lookup by stack_id 295 } else { 296 # This is checked this elsewhere? 297 print STDERR "Error: $stage is an unknown image type\n"; 298 return undef; 299 } 300 } elsif ($req_type eq "byskycell") { 301 if (($stage eq "raw") or ($stage eq "chip")) { 302 print STDERR "REQ_TYPE byskycell not supported for IMG_TYPE raw or chip\n"; 303 return undef; 304 } 305 if (!$tess_id or !$component) { 306 print STDERR "component and tess_id are required for REQ_TYPE byskycell\n"; 307 return undef; 308 } 309 } 310 311 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 312 0, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 313 getValOrZero($row->{FWHM_MIN}), getValOrZero($row->{FWHM_MAX}), 314 undef, $release_name, $survey, 315 $verbose); 173 316 174 317 return $results; … … 195 338 my $mjd_min = shift; 196 339 my $mjd_max = shift; 340 my $fwhm_min = shift; 341 my $fwhm_max = shift; 342 my $selectedAstrom = shift; 343 my $release_name = shift; 344 my $survey = shift; 197 345 my $verbose = shift; 198 346 … … 219 367 my $magic_arg = $need_magic ? " -destreaked" : ""; 220 368 369 my $row = $rowList->[0]; 370 221 371 # all rows have the same center type 222 my $skycenter = ! ($rowList->[0]->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS); 372 my $skycenter = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS); 373 374 my $use_releasetool = 0; 375 my $release_args; 376 if (($req_type eq 'byexp' and $stage ne 'raw') or ($req_type eq 'byskycell' and $stage ne 'diff')) { 377 if ($release_name or $survey) { 378 $use_releasetool = 1; 379 if ($release_name) { 380 $release_args = " -release_name $release_name"; 381 } else { 382 $release_args = " -priority_order"; 383 } 384 $release_args .= " -surveyName $survey" if $survey; 385 } 386 } 223 387 224 388 my $component_args; … … 251 415 # use chiptool -processsedimfile. Otherwise use chiptool -listrun and then 252 416 # choose the chips containing the center pixel by calling selectComponets() below 253 if ($component or $use_imfile_id or !$skycenter) { 254 $command = "$chiptool -processedimfile -pstamp_order -dbname $imagedb"; 255 if ($component and $component ne 'all') { 256 $class_id = $component; 257 $component_args = " -class_id $class_id"; 258 } 259 } else { 260 $command = "$chiptool -listrun -pstamp_order -dbname $imagedb"; 417 if ($use_releasetool) { 418 $command = "$releasetool -dbname $imagedb -listrelexp $release_args"; 261 419 $choose_components = 1; 262 } 263 $id_opt = $use_imfile_id ? "-chip_imfile_id" : "-chip_id"; 420 } else { 421 $command = "$chiptool -pstamp_order -dbname $imagedb"; 422 if ($component or $use_imfile_id or !$skycenter) { 423 $command .= " -processedimfile"; 424 if ($component and $component ne 'all') { 425 $class_id = $component; 426 $component_args = " -class_id $class_id"; 427 } 428 } else { 429 $command .= " -listrun"; 430 $choose_components = 1; 431 } 432 $id_opt = $use_imfile_id ? "-chip_imfile_id" : "-chip_id"; 433 } 264 434 # XXX: perhaps we should stop resolving images to this level here and do it at job run time. 265 435 # With the mdc file it has all of the information that it needs. … … 275 445 $want_astrom = 1; 276 446 $set_class_id = 1; 277 } elsif ($stage eq "warp") { 278 if ($component or $use_imfile_id or !$skycenter) { 279 $command = "$warptool -warped -pstamp_order -dbname $imagedb"; 280 if ($component and $component ne 'all') { 281 $skycell_id = $component; 282 $component_args = " -skycell_id $skycell_id"; 283 } 284 } else { 285 $command = "$warptool -listrun -pstamp_order -dbname $imagedb"; 447 } elsif ($stage eq 'warp') { 448 if ($use_releasetool) { 449 $command = "$releasetool -dbname $imagedb -listrelexp $release_args"; 450 $skycell_id = $component; 286 451 $choose_components = 1; 287 } 288 $id_opt = $use_imfile_id ? "-warp_skyfile_id" : "-warp_id"; 452 } else { 453 $command = "$warptool -pstamp_order -dbname $imagedb"; 454 if ($component or $use_imfile_id or !$skycenter) { 455 $command .= " -warped"; 456 if ($component and $component ne 'all') { 457 $skycell_id = $component; 458 $component_args = " -skycell_id $skycell_id"; 459 } 460 } else { 461 $command .= " -listrun"; 462 $choose_components = 1; 463 } 464 $id_opt = $use_imfile_id ? "-warp_skyfile_id" : "-warp_id"; 465 } 289 466 $image_name = "PSWARP.OUTPUT"; 290 467 $mask_name = "PSWARP.OUTPUT.MASK"; … … 294 471 $base_name = "path_base"; # name of the field for the warptool output 295 472 } elsif ($stage eq "diff") { 473 # XXX: is this path ever used for diff images anymore? 296 474 if ($component or $use_imfile_id or !$skycenter) { 297 475 $command = "$difftool -diffskyfile -pstamp_order -dbname $imagedb"; … … 314 492 } elsif ($stage eq "stack") { 315 493 $skycell_id = $component; 316 $command = "$stacktool -sumskyfile -dbname $imagedb"; 317 # only consider stacks in full state. 318 $command .= " -state full"; 319 $id_opt = "-stack_id"; 494 if ($use_releasetool) { 495 $command = "$releasetool -listrelstack -dbname $imagedb $release_args"; 496 $base_name = 'stack_path_base'; 497 my $stack_type = $row->{RUN_TYPE}; 498 if (!isnull($stack_type)) { 499 if (lc($stack_type) eq 'notnightly') { 500 $command .= " -stack_type deep -stack_type reference"; 501 } else { 502 $command .= " -stack_type $stack_type"; 503 } 504 } 505 } else { 506 $command = "$stacktool -sumskyfile -dbname $imagedb"; 507 # only consider stacks in full state. 508 $command .= " -state full"; 509 $id_opt = "-stack_id"; 510 $base_name = 'path_base'; 511 } 320 512 $component_args = " -skycell_id $skycell_id" if $skycell_id and $skycell_id ne 'all'; 321 513 … … 331 523 # this is wrong but gets the right answer. Need to figure out how to find the 332 524 # rule properly 333 #$cmf_name = "PSPHOT.OUTPUT"; # this puts .fpa. in the name334 525 $cmf_name = "PSWARP.OUTPUT.SOURCES"; 526 # $cmf_name = "PSPHOT.OUTPUT"; # this puts .fpa. in the name 335 527 $psf_name = "PPSTACK.TARGET.PSF"; 336 $base_name = "path_base";337 528 } else { 338 die "Unknown IMG_TYP esupplied: $stage";529 die "Unknown IMG_TYPE supplied: $stage"; 339 530 } 340 531 … … 371 562 $command .= " -dateobs_end $dateobs_end" if $dateobs_end; 372 563 } elsif ($req_type ne "byid") { 373 $command .= " -mjd_ obs_begin $mjd_min" if $mjd_min;374 $command .= " -mjd_ obs_end$mjd_max" if $mjd_max;564 $command .= " -mjd_min $mjd_min" if $mjd_min; 565 $command .= " -mjd_max $mjd_max" if $mjd_max; 375 566 } 376 567 … … 379 570 if (!isnull($data_group)) { 380 571 $command .= " -data_group $data_group"; 381 } elsif ($req_type eq 'byskycell') { 572 } elsif (!$use_releasetool and $req_type eq 'byskycell') { 573 # XXX: Why am I using default data_groups only for byskycell requests? 382 574 $command .= $default_data_groups; 575 } 576 577 if ($use_releasetool) { 578 # fwhm arguments are currently only supported when using releasetool for lookups 579 $command .= " -fwhm_min $fwhm_min" if $fwhm_min; 580 $command .= " -fwhm_max $fwhm_max" if $fwhm_max; 383 581 } 384 582 … … 394 592 $images = filterRuns($stage, $need_magic, $images, $inverse, $verbose); 395 593 } 594 396 595 if ($choose_components) { 397 596 # the list of "images" is actually a list of "Runs" 398 597 # match the coords in the rows to the components in the runs 399 598 # returns an actual list of images 400 $images = selectComponents($ipprc, $imagedb, $req_type, $stage, $rowList, $images, $verbose); 599 if ($skycenter and $req_type ne 'byskycell') { 600 $images = selectComponents($ipprc, $imagedb, $req_type, $stage, $rowList, $images, $verbose); 601 } else { 602 $images = selectComponentsByName($ipprc, $imagedb, $req_type, $stage, $component, $rowList, $images, $verbose); 603 } 401 604 } else { 402 # put index for each of the rows into all of the the images605 # put index for each of the rows into all of the the selected images 403 606 setRowRefs($rowList, $images); 404 607 } … … 464 667 # dquery wants these set 465 668 $out->{magicked} = 0; 466 $out->{data_state} = $out->{state}; 669 if ($use_releasetool) { 670 if ($image->{skycal_path_base}) { 671 $out->{astrom} = $image->{skycal_path_base} . ".cmf"; 672 } 673 $out->{data_state} = $out->{state} = $out->{stack_state}; 674 } else { 675 # XXX: Consider looking up skycal results even if we are 676 # not using releasetool 677 $out->{data_state} = $out->{state}; 678 } 467 679 } 468 680 $out->{stage_id} = $stage_id; … … 472 684 my $mask_base; 473 685 if ($want_astrom) { 474 if (! defined $out->{astrom}) { 686 if ($selectedAstrom) { 687 $out->{astrom} = $selectedAstrom; 688 $out->{cam_path_base} = $selectedAstrom; 689 if ($selectedAstrom =~ /\.smf$/) { 690 $out->{cam_path_base} =~ s/\.smf$//; 691 } elsif ($selectedAstrom =~ /\.cmf$/) { 692 $out->{cam_path_base} =~ s/\.cmf$//; 693 } else { 694 die ("ERROR: don't know how to extract cam_path_base from $selectedAstrom\n"); 695 } 696 } elsif (! defined $out->{astrom}) { 475 697 if (! find_astrometry($ipprc, $imagedb, $out, $verbose)) { 476 698 print STDERR "failed to find astrometry for $stage $stage_id\n"; … … 507 729 my $byid = shift; 508 730 my $option_mask = shift; 509 my $ img_type = shift;731 my $stage = shift; 510 732 my $verbose = shift; 511 733 … … 558 780 } 559 781 782 # XXX: The logic below is somewhat messed up. See XXX: ... below 783 # 560 784 # The standard way to do a diff is warp - stack 561 785 # so we interpret the requested image in that way … … 572 796 } 573 797 my $stack_id; 798 if ($image->{diff_mode} == 2) { 799 # XXX: .. stack_id wasn't getting set 800 $stack_id = $stack2; 801 $image->{stack_id} = $stack_id; 802 } 574 803 if ($stack1 and $stack2) { 575 804 # we have a stack - stack diff (well it might be stack - warp....) 576 805 # but at any rate we only handle image type diff and stack 577 if (($ img_type ne "diff") and ($img_type ne "stack")) {578 print STDERR "lookup_diff: cannot lookup IMG_TYPE $ img_type bydiff from a stack stack diff run\n";806 if (($stage ne "diff") and ($stage ne "stack")) { 807 print STDERR "lookup_diff: cannot lookup IMG_TYPE $stage bydiff from a stack stack diff run\n"; 579 808 setErrorCodes($rowList, $PSTAMP_INVALID_REQUEST); 580 809 # all images will be the same so we can stop … … 627 856 } 628 857 629 if ($ img_type eq "diff") {858 if ($stage eq "diff") { 630 859 my @imageList = ($image); 631 860 … … 658 887 sub lookup_bycoord { 659 888 my $ipprc = shift; 660 my $row List= shift;889 my $row = shift; 661 890 my $imagedb = shift; 662 my $ img_type= shift;891 my $stage = shift; 663 892 my $tess_id = shift; 664 893 my $component = shift; … … 666 895 my $ra = shift; 667 896 my $dec = shift; 668 my $dateobs_begin = shift; 897 my $dateobs_begin = shift; # these are used for single frame lookups 669 898 my $dateobs_end = shift; 670 899 my $filter = shift; 671 900 my $data_group = shift; 672 901 my $option_mask = shift; 673 my $mjd_min = shift; 674 my $mjd_max = shift; 902 my $mjd_min = shift; # these are used for stack lookups 903 my $mjd_max = shift; # these are used for stack lookups 675 904 my $verbose = shift; 676 905 906 my $fwhm_min = getValOrZero($row->{FWHM_MIN}); 907 my $fwhm_max = getValOrZero($row->{FWHM_MAX}); 908 909 910 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 911 if (!$tess_id and $default_tess_id) { 912 $tess_id = $default_tess_id; 913 } 914 915 my $rowList = [$row]; 916 677 917 my $results = (); 678 if (($img_type eq "raw") or ($img_type eq "chip")) { 679 680 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $img_type, 681 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose); 918 if (($stage eq "raw") or ($stage eq "chip")) { 919 920 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $stage, 921 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose, 922 $release_name, $survey, $fwhm_min, $fwhm_max); 682 923 683 924 if (!$chips or scalar @$chips == 0) { … … 686 927 foreach my $chip (@$chips) { 687 928 next if $component and ($chip->{component} ne $component); 688 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $ img_type, $chip->{id},929 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $stage, $chip->{id}, 689 930 $tess_id, $chip->{component}, $need_magic, 690 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 931 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 932 $fwhm_min, $fwhm_max, 933 $chip->{astrom}, undef, undef, 934 $verbose); 691 935 692 936 next if !$these_results; … … 697 941 } else { 698 942 # this should have been checked elsewhere 699 die "unexpected image type $ img_type" if ($img_type ne "warp")700 and ($ img_type ne "stack") and ($img_type ne "diff");943 die "unexpected image type $stage" if ($stage ne "warp") 944 and ($stage ne "stack") and ($stage ne "diff"); 701 945 702 946 my $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); … … 705 949 setErrorCodes($rowList, $PSTAMP_NO_IMAGE_MATCH); 706 950 } else { 951 # XXX: We are not applying the fwhm cuts 707 952 foreach my $skycell (@$skycells) { 708 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $ img_type, undef,953 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $stage, undef, 709 954 $skycell->{tess_id}, $skycell->{component}, $need_magic, 710 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 955 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 956 $fwhm_min, $fwhm_max, 957 undef, $release_name, $survey, 958 $verbose); 711 959 712 960 next if !$these_results; … … 724 972 725 973 sub lookup_by_cam_id_and_coords { 726 my $ipprc = shift;727 my $imagedb = shift;728 my $ img_type= shift;729 my $ra = shift;730 my $dec = shift;731 my $need_magic = shift;974 my $ipprc = shift; 975 my $imagedb = shift; 976 my $stage = shift; 977 my $ra = shift; 978 my $dec = shift; 979 my $need_magic = shift; 732 980 my $dateobs_begin = shift; 733 981 my $dateobs_end = shift; … … 735 983 my $data_group = shift; 736 984 my $verbose = shift; 737 738 my $camruns; 739 740 { 741 my $search_radius = 1.6; # XXX: this should be camera specific 742 985 my $release_name = shift; 986 my $survey = shift; 987 my $fwhm_min = shift; 988 my $fwhm_max = shift; 989 990 my $search_radius = 1.6; # XXX: this should be camera specific 991 992 my $command; 993 my $using_camtool = 0; 994 if ($release_name or $survey) { 995 $command = "$releasetool -dbname $imagedb -listrelexp"; 996 if ($survey) { 997 $command .= " -surveyName $survey"; 998 } 999 if ($release_name) { 1000 $command .= " -release_name $release_name"; 1001 } else { 1002 $command .= " -priority_order"; 1003 } 1004 if ($fwhm_min != 0) { 1005 $command .= " -fwhm_min $fwhm_min"; 1006 } 1007 if ($fwhm_max != 0) { 1008 $command .= " -fwhm_max $fwhm_max"; 1009 } 1010 } else { 1011 $using_camtool = 1; 743 1012 my $command = "$camtool -dbname $imagedb -processedexp -pstamp_order"; 744 $command .= " -ra $ra -decl $dec -radius $search_radius";745 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin;746 $command .= " -dateobs_end $dateobs_end" if $dateobs_end ;747 $command .= " -filter $filter" if $filter;748 1013 # NOTE: we are applying the data_group to the camera run. 749 1014 # If we're looking for chip stage images there is no guarentee that … … 757 1022 } 758 1023 $command .= " -destreaked" if $need_magic; 759 760 # run the tool and parse the output 761 $camruns = runToolAndParse($command, $verbose); 762 } 763 if (!$camruns) { 1024 } 1025 $command .= " -ra $ra -decl $dec -radius $search_radius"; 1026 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin; 1027 $command .= " -dateobs_end $dateobs_end" if $dateobs_end ; 1028 $command .= " -filter $filter" if $filter; 1029 1030 # run the tool and parse the output 1031 my $results = runToolAndParse($command, $verbose); 1032 if (!$results) { 764 1033 return undef; 765 1034 } 766 1035 my $components; 767 1036 my $last_exp_id = 0; 768 foreach my $camRun (@$camruns) { 769 my $cam_id = $camRun->{cam_id}; 770 my $exp_id = $camRun->{exp_id}; 771 1037 foreach my $result (@$results) { 1038 my $cam_id = $result->{cam_id}; 1039 my $exp_id = $result->{exp_id}; 1040 1041 # go on if we already have a result for this exposure 772 1042 next if $exp_id eq $last_exp_id; 773 1043 774 next if $camRun->{quality}; 775 next if $camRun->{fault}; 776 777 updateCamRunCache($camRun); 1044 next if $result->{quality}; 1045 1046 if ($using_camtool) { 1047 next if $result->{fault}; 1048 } else { 1049 $result->{path_base} = $result->{cam_path_base}; 1050 } 1051 updateCamRunCache($result); 778 1052 779 1053 $last_exp_id = $exp_id; 780 1054 781 1055 # XXX Use file rule 782 my $astrom = $ camRun->{path_base} . ".smf";1056 my $astrom = $result->{path_base} . ".smf"; 783 1057 my $astrom_resolved = $ipprc->file_resolve($astrom); 784 1058 next if !$astrom_resolved; … … 834 1108 } 835 1109 836 print "cam_id $cam_id exp_id $ camRun->{exp_id} chip_id $camRun->{chip_id} $class_id\n";1110 print "cam_id $cam_id exp_id $result->{exp_id} chip_id $result->{chip_id} $class_id\n"; 837 1111 838 1112 # build the hash to return … … 842 1116 # problem 843 1117 my $comp = { 844 exp_id => $ camRun->{exp_id},845 exp_name => $ camRun->{exp_name},846 chip_id => $ camRun->{chip_id},847 cam_id => $ camRun->{cam_id},1118 exp_id => $result->{exp_id}, 1119 exp_name => $result->{exp_name}, 1120 chip_id => $result->{chip_id}, 1121 cam_id => $result->{cam_id}, 848 1122 class_id => $class_id, 849 component => $class_id 1123 component => $class_id, 1124 astrom => $astrom 850 1125 }; 851 if ($ img_type eq "chip") {852 $comp->{id} = $ camRun->{chip_id};853 $comp->{state} = $ camRun->{chip_state};854 $comp->{magicked} = $camRun->{chip_magicked};855 } else { 856 $comp->{id} = $ camRun->{exp_id};1126 if ($stage eq "chip") { 1127 $comp->{id} = $result->{chip_id}; 1128 $comp->{state} = $result->{chip_state}; 1129 $comp->{magicked} = 0; 1130 } else { 1131 $comp->{id} = $result->{exp_id}; 857 1132 $comp->{state} = 'full'; 858 $comp->{magicked} = $ camRun->{raw_magicked};1133 $comp->{magicked} = $0; 859 1134 } 860 1135 push @$components, $comp; … … 1072 1347 my $val = shift; 1073 1348 return (!defined($val) or ($val == 0)); 1349 } 1350 1351 sub getValOrZero { 1352 my $val = shift; 1353 return iszero($val) ? 0.0 : $val; 1074 1354 } 1075 1355 … … 1283 1563 } 1284 1564 1565 sub selectComponentsByName { 1566 my $ipprc = shift; 1567 my $imagedb = shift; 1568 my $req_type = shift; 1569 my $stage = shift; 1570 my $component = shift; 1571 my $rowList = shift; 1572 my $runList = shift; 1573 my $verbose = shift; 1574 my $results = []; 1575 1576 $component = "" if $component and lc($component) eq 'all'; 1577 1578 # all runs match all rows so they can share a common row_index 1579 # XXX: I'm not sure we ever actually get here with more than one 1580 # row 1581 my $numRows = scalar @$rowList; 1582 my $row_index = []; 1583 for (my $i=0; $i < $numRows; $i++) { 1584 push @$row_index, $i; 1585 } 1586 1587 # XXX: Why did I make this restriction? I added byskycell 1588 if (($req_type eq "byid") or ($req_type eq "byexp") or ($req_type eq 'byskycell')) { 1589 my ($last_tess_id, $tess_dir_abs, $astrom_file) = ("", "", ""); 1590 foreach my $run (@$runList) { 1591 # now find the images for this run 1592 #foreach my $c (keys %components) { 1593 my $command; 1594 my $stage_id; 1595 if ($stage eq 'raw') { 1596 $stage_id = $run->{exp_id}; 1597 $command = "$regtool -processedimfile -exp_id $stage_id"; 1598 $command .= " -class_id $component" if $component; 1599 } elsif ($stage eq 'chip') { 1600 $stage_id = $run->{chip_id}; 1601 $command = "$chiptool -processedimfile -chip_id $stage_id"; 1602 $command .= " -class_id $component" if $component; 1603 } elsif ($stage eq 'warp') { 1604 $stage_id = $run->{warp_id}; 1605 $command = "$warptool -warped -warp_id $stage_id"; 1606 $command .= " -skycell_id $component" if $component; 1607 } 1608 $command .= " -dbname $imagedb"; 1609 my $images = runToolAndParse($command, $verbose); 1610 if (!defined $images) { 1611 print "No $component found for $stage ${stage}_id $stage_id\n"; 1612 next; 1613 } 1614 foreach my $image (@$images) { 1615 $image->{row_index} = $row_index; 1616 if (($stage eq "raw") or ($stage eq 'chip')) { 1617 $image->{cam_id} = $run->{cam_id}; 1618 $image->{cam_path_base} = $run->{cam_path_base}; 1619 } 1620 push @$results, $image; 1621 } 1622 } 1623 } else { 1624 &my_die ("selectComponentsByName not supported for REQ_TYPE: $req_type\n", $PS_EXIT_PROG_ERROR); 1625 } 1626 return $results; 1627 } 1628 1285 1629 sub filterRuns { 1286 1630 my $stage = shift; … … 1409 1753 $dvoImagesAtCoords = can_run('dvoImagesAtCoords') or (warn "Can't find dvoImagesAtCoords" 1410 1754 and $missing_tools = 1); 1755 $releasetool = can_run('releasetool') or (warn "Can't find releasetool" 1756 and $missing_tools = 1); 1411 1757 $whichimage = can_run('whichimage') or (warn "Can't find whichimage" and $missing_tools = 1); 1412 1758 $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); … … 1464 1810 } 1465 1811 1812 sub get_release_info { 1813 my $row = shift; 1814 1815 my $survey; 1816 my $release_name = $row->{IPP_RELEASE}; 1817 if (isnull($release_name)) { 1818 $release_name = ""; 1819 # no release check for survey 1820 $survey = isnull($row->{SURVEY_NAME}) ? "" : $row->{SURVEY_NAME}; 1821 } else { 1822 # if release is given leave survey empty 1823 $survey = ""; 1824 } 1825 1826 my $tess_id; 1827 if ($release_name) { 1828 # hack to optimize bycoord and byskycell lookups for well known releases 1829 # XXX: todo query database and return a list for the survey or release 1830 if ($release_name eq '3PI.PV1') { 1831 $tess_id = 'RINGS.V3'; 1832 } 1833 } 1834 1835 return ($release_name, $survey, $tess_id); 1836 } 1837 1466 1838 sub my_die 1467 1839 { -
tags/ipp-20130307/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r34448 r35489 44 44 $PSTAMP_DUP_REQUEST 45 45 $PSTAMP_INVALID_REQUEST 46 $PSTAMP_UNKNOWN_PROJECT 46 47 $PSTAMP_UNKNOWN_PRODUCT 47 48 $PSTAMP_NO_IMAGE_MATCH … … 80 81 our $PSTAMP_USE_IMFILE_ID = 16384; 81 82 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 83 84 # these bits will be repurposed 82 85 our $PSTAMP_REQUEST_UNCENSORED = 0x10000; 83 86 our $PSTAMP_REQUIRE_UNCENSORED = 0x20000; … … 93 96 our $PSTAMP_DUP_REQUEST = 20; 94 97 our $PSTAMP_INVALID_REQUEST = 21; 95 our $PSTAMP_UNKNOWN_PRODUCT = 22; 98 our $PSTAMP_UNKNOWN_PROJECT = 22; 99 our $PSTAMP_UNKNOWN_PRODUCT = 22; #this error code was mis-named it is left for compatabiliyt 96 100 our $PSTAMP_NO_IMAGE_MATCH = 23; 97 101 our $PSTAMP_NOT_DESTREAKED = 24; 98 102 our $PSTAMP_NOT_AVAILABLE = 25; 99 our $PSTAMP_GONE = 26; 103 our $PSTAMP_GONE = 26; # this value is used in ippTools 100 104 our $PSTAMP_NO_JOBS_QUEUED = 27; 101 105 our $PSTAMP_NO_OVERLAP = 28; … … 131 135 PSTAMP_DUP_REQUEST 132 136 PSTAMP_INVALID_REQUEST 133 PSTAMP_UNKNOWN_PRO DUCT137 PSTAMP_UNKNOWN_PROJECT 134 138 PSTAMP_NO_IMAGE_MATCH 135 139 PSTAMP_NOT_DESTREAKED … … 139 143 PSTAMP_NO_OVERLAP 140 144 PSTAMP_NOT_AUTHORIZED 145 PSTAMP_NOT_AUTHORIZED 141 146 ); 142 147 … … 167 172 my $fields_output; 168 173 { 169 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION USERNAMEEMAIL";174 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL"; 170 175 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 176 run(command => $command, verbose => $verbose); … … 187 192 if ($extver > 1) { 188 193 $header{ACTION} = $action; 189 $header{USER} = $username;190 194 $header{EMAIL} = $email; 191 195 } else { 192 196 $header{ACTION} = $action = "PROCESS"; 193 $header{USERNAME} = 'null';194 197 $header{EMAIL} = 'null'; 195 198 } 196 199 197 if ($action eq "LIST") { 198 return (\%header, undef); 199 } elsif ($action ne "PROCESS") { 200 die "unexpected request ACTION found: $action in $request_file_name"; 200 if ($action ne "PROCESS" and $action ne 'PREVIEW') { 201 die "\nunexpected request ACTION found: $action in $request_file_name"; 201 202 } 202 203 -
tags/ipp-20130307/dbconfig
- Property svn:mergeinfo set to
-
tags/ipp-20130307/dbconfig/changes.txt
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/dbconfig/changes.txt (added) merged: 35350,35413
r35293 r35489 2388 2388 CREATE TABLE lapGroup ( 2389 2389 seq_id BIGINT, 2390 tess_id VARCHAR(64), 2390 2391 projection_cell VARCHAR(64), 2391 2392 state VARCHAR(16), 2393 label VARCHAR(654), 2394 registered TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP 2392 2395 fault SMALLINT, 2393 2396 PRIMARY KEY(seq_id, projection_cell), … … 2397 2400 ) ENGINE=innodb DEFAULT CHARSET=latin1; 2398 2401 2399 UPDATE dbversion set schema_version = '1.1.75', updated= CURRENT_TIMESTAMP(); 2400 2401 -- new Postage Stamp Request columns (NOTE these changes to not apply to gpc1 2402 -- because the pstamp tables have been dropped from that database 2402 -- new Postage Stamp Request columns 2403 -- Note: These do not aply to the gpc1 database because the pstamp tables were 2404 -- deleted from that database. 2403 2405 ALTER TABLE pstampRequest ADD COLUMN username VARCHAR(255) AFTER outdir; 2404 2406 ALTER TABLE pstampRequest ADD COLUMN proj_id BIGINT AFTER username; 2405 ALTER TABLE pstampRequest ADD COLUMN registered TIMESTAMP DEFAULT CURRENT_TIMESTAMPAFTER proj_id;2406 2407 -- default to the gpc1 project (or is it ps1?)2407 ALTER TABLE pstampRequest ADD COLUMN registered DATETIME AFTER proj_id; 2408 2409 -- default to the gpc1 project 2408 2410 UPDATE pstampRequest SET proj_id = 1; 2409 2411 2410 2411 2412 -- unique keys for the release tables 2413 2414 alter table relStack add unique key (rel_id, tess_id, skycell_id, filter, stack_type, mjd_obs) 2415 alter table relExp add UNIQUE KEY(rel_id, exp_id); 2416 alter table ippRelease add unique key (surveyID, release_name); 2417 2418 UPDATE dbversion set schema_version = '1.1.75', updated= CURRENT_TIMESTAMP(); - Property svn:mergeinfo changed
-
tags/ipp-20130307/dbconfig/lap.md
r35213 r35489 33 33 lapGroup METADATA 34 34 seq_id S64 0 35 tess_id STR 64 35 36 projection_cell STR 64 36 37 state STR 64 38 label STR 64 39 registered TAI NULL 37 40 fault S16 0 38 41 end -
tags/ipp-20130307/ippScripts
- Property svn:mergeinfo set to
-
tags/ipp-20130307/ippScripts/Build.PL
r35247 r35489 130 130 scripts/regenerate_background.pl 131 131 scripts/relgroup_exp_list.pl 132 scripts/queuestaticsky.pl 132 133 )], 133 134 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
tags/ipp-20130307/ippScripts/scripts/camera_exp.pl
r35159 r35489 363 363 } 364 364 # Construct FPA continuity corrected background images 365 { 365 if ($camera =~ /ISP/) { 366 print "Skipping FPA continuity corrected background images for ISP\n"; 367 } else { 366 368 my $command; 367 369 $command = "$ppImage"; -
tags/ipp-20130307/ippScripts/scripts/mergedvodb_merge.pl
r33030 r35489 156 156 $merge_command = "rsync -rvat $minidvodb_path/* $mergedvodb_path"; 157 157 } else { 158 $merge_command = "$dvomerge $minidvodb_path into $mergedvodb_path";158 $merge_command = "$dvomerge -parallel $minidvodb_path into $mergedvodb_path"; 159 159 } 160 160 print "\n$merge_command\n"; -
tags/ipp-20130307/ippScripts/scripts/minidvodb_premerge.pl
r33030 r35489 16 16 my $dtime_relphot; 17 17 my $dtime_script; 18 my $dtime_delstar; 18 19 19 20 use vars qw( $VERSION ); … … 33 34 my $dvomerge = can_run('dvomerge') or (warn "Can't find dvomerge" and $missing_tools = 1); 34 35 my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1); 36 my $delstar = can_run('delstar') or (warn "Can't find delstar" and $missing_tools = 1); 35 37 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 36 38 my $relphot = can_run('relphot') or (warn "Can't find relphot" and $missing_tools = 1); 37 39 my $relastro = can_run('relastro') or (warn "Can't find relastro" and $missing_tools = 1); 40 38 41 my $dvoverify = can_run('dvoverify') or (warn "Can't find dvoverify" and $missing_tools = 1); 39 42 … … 80 83 unless ($no_op) { 81 84 82 #this is chopped into several parts: addstar, relphot 85 #this is chopped into several parts: delstar,addstar, relphot, relastro, dvoverify 86 #delstar - first step: are there duplicates, if so remove them 87 { 88 my $command = "$delstar -update -dup-images "; 89 #$command .= " -D CAMERA $camera"; 90 $command .= " -D CATDIR $minidvodb"; 91 my $mjd_delstar_start = DateTime->now->mjd; # MJD of starting script 92 print "\n$command\n"; 93 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 94 run(command => $command, verbose => $verbose); 95 unless ($success) { 96 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 97 &my_die("Unable to perform delstar: $error_code", $minidvodb_id, $error_code); 98 } 99 print $full_buf; 100 $dtime_delstar = 86400.0*(DateTime->now->mjd - $mjd_delstar_start); 101 # MJD of starting script 102 print "delstar time $dtime_delstar\n"; 103 } 104 105 106 83 107 #addstar 84 108 { … … 94 118 &my_die("Unable to perform addstar: $error_code", $minidvodb_id, $error_code); 95 119 } 96 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); $dtime_resort = $dtime_addstar;97 # MJD of starting script120 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); 121 # MJD of starting script 98 122 $dtime_resort = $dtime_addstar; 99 123 print "addstar -resort time $dtime_addstar\n"; … … 105 129 # relphot only takes lower case gpc1 106 130 my $relphot_camera = lc($camera); 107 my $command = "$relphot -averages -update"; 108 $command .= " -D CAMERA $relphot_camera"; 109 $command .= " -D CATDIR $minidvodb"; 131 #my $command = "$relphot -averages -update"; 132 #$command .= " -D CAMERA $relphot_camera"; 133 #$command .= " -D CATDIR $minidvodb"; 134 #this is a friday hack 135 my $command = "echo skipping relphot"; 110 136 print "$command\n"; 111 137 my $mjd_relphot_start = DateTime->now->mjd; # MJD of starting script -
tags/ipp-20130307/ippScripts/scripts/relgroup_exp_list.pl
r35247 r35489 16 16 17 17 18 my ($group_id, $group_type, $lap_id, $ release_name, $rebuild, $dbname, $no_update, $verbose);18 my ($group_id, $group_type, $lap_id, $group_name, $release_name, $rebuild, $dbname, $no_update, $verbose); 19 19 20 20 GetOptions( 21 21 'group_id=s' => \$group_id, 22 'group_type=s' => \$group_type, 22 23 'lap_id=s' => \$lap_id, 23 'group_ type=s' => \$group_type,24 'group_name=s' => \$group_name, 24 25 'release_name=s' => \$release_name, 25 26 'rebuild' => \$rebuild, # rebuild directory if it exists … … 36 37 -exitval => 3) 37 38 unless $lap_id; 39 $group_name = "lap_$lap_id"; 40 } else { 41 pod2usage( -msg => "--group_name is required with --group_type $group_type", 42 -exitval => 3) 43 unless $group_name; 38 44 } 39 45 … … 48 54 49 55 # XXX: get this from site.config 50 my $outputBase = "/data/ippc17.0/www/ipp-misc/ps1-data/single-frame/$release_name"; 51 52 my $outdir; 53 if ($group_type eq 'lap') { 54 $outdir = "$outputBase/lap_$lap_id"; 55 if (-e $outdir) { 56 if ($rebuild) { 57 my $rc = system "rm -rf $outdir"; 58 if ($rc) { 59 my $status = $rc >> 8; 60 my_die("failed to remove existing directory $outdir: $rc $status", $group_id, $PS_EXIT_UNKNOWN_ERROR); 61 } 62 } else { 63 my_die("directory $outdir already exists and --rebuild not supplied", $group_id, $PS_EXIT_UNKNOWN_ERROR); 64 } 65 } 66 } else { 67 my_die("Not ready to do group_type $group_type\n", $group_id, $PS_EXIT_UNKNOWN_ERROR); 56 my $exposureListRoot = "/data/ippc17.0/www/ipp-misc/ps1-data/single-frame"; 57 58 my $outputBase = "$exposureListRoot/$release_name"; 59 60 if (!-e $outputBase) { 61 mkdir $outputBase or &my_die("Failed to create $outputBase", $group_id, $PS_EXIT_SYS_ERROR); 62 } 63 64 my $outdir = "$outputBase/$group_name"; 65 if (-e $outdir) { 66 if ($rebuild) { 67 my $rc = system "rm -rf $outdir"; 68 if ($rc) { 69 my $status = $rc >> 8; 70 my_die("failed to remove existing directory $outdir: $rc $status", $group_id, $PS_EXIT_UNKNOWN_ERROR); 71 } 72 } else { 73 my_die("directory $outdir already exists and --rebuild not supplied", $group_id, $PS_EXIT_UNKNOWN_ERROR); 74 } 68 75 } 69 76 70 77 mkdir $outdir or my_die ("failed to create $outdir", $group_id, $PS_EXIT_UNKNOWN_ERROR); 71 72 if (0) {73 # XXX: old code from prototype for nightly lists74 my $outroot;75 my $oh;76 my ($year, $month, $day);77 if ($outroot) {78 die "usage: $0 <year> <month> <day>\n" unless $year and $month and $day;79 my $monthdir = sprintf "$outroot/%4d/%02d", $year, $month;80 if (! -e $monthdir) {81 die "can't find directory for $year-$month\n";82 }83 my $daydir = sprintf "$monthdir/%02d", $day;84 if (! -e $daydir) {85 mkdir $daydir or die "failed to create $daydir\n";86 }87 my $outfile = sprintf "$daydir/index.html", $day;88 open $oh, ">$outfile" or die "failed to open $outfile";89 } else {90 $oh = *STDOUT;91 }92 93 my $ticks = timegm(0, 0, 0, $day, $month - 1, $year - 1900);94 95 my $mjd = 40587 + ($ticks / 86400.);96 my $date = sprintf "%04d-%02d-%02d", $year, $month, $day;97 }98 78 99 79 my $oh; … … 105 85 open $oh2, ">$outfile2" or my_die("failed to open $outfile2", $group_id, $PS_EXIT_UNKNOWN_ERROR); 106 86 107 my $title = "PS1 Exposure List for $release_name LAP run $lap_id"; 87 my $title = "PS1 Exposure List for"; 88 if ($group_type eq 'lap') { 89 $title .= " $release_name LAP run $lap_id"; 90 } else { 91 $title .= " $group_name"; 92 } 108 93 109 94 my $head = " … … 125 110 126 111 127 # find all exposures on given day that have a chip run112 # find all exposures in this relGroup 128 113 my $query = " 129 114 SELECT … … 149 134 $stmt->execute() or my_die("failed to execute query: $stmt->errstr\n", $group_id, $PS_EXIT_UNKNOWN_ERROR); 150 135 151 printf STDERR "%4d exposures in group for LAP run $lap_id\n", $stmt->rows;136 printf STDERR "%4d exposures in group for $group_name\n", $stmt->rows; 152 137 153 138 # $stmt->dump_results(1000); -
tags/ipp-20130307/ippScripts/scripts/whichimage
r32820 r35489 94 94 my $cmd = "dvoImagesAtCoords -chipcoords $coord_file"; 95 95 $cmd .= " -listchipcoords" if $listchipcoords; 96 97 $tess_id = uc($tess_id) if $tess_id; 96 98 97 99 my $status = 0; … … 125 127 # next if $tess_name eq 'FIXNS'; 126 128 # next if $tess_name eq 'ALLSKY'; 129 next if $tess_name eq 'RINGS.V0'; 127 130 push @tess_ids_to_check, $tess_name; 128 131 } -
tags/ipp-20130307/ippTasks
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippTasks (added) merged: 35350,35413 /trunk/ippTasks (added) merged: 35305,35308,35331,35335,35359-35360,35418,35462,35477
- Property svn:mergeinfo changed
-
tags/ipp-20130307/ippTasks/pstamp.pro
r35475 r35489 965 965 966 966 # XXX: have the script set this up this 967 $MYLOGFILE= "/data/ippc17.0/pstamp/work/logs/cleanup.$REQ_ID"967 $MYLOGFILE=/data/ippc17.0/pstamp/work/logs/cleanup.$REQ_ID 968 968 stdout $MYLOGFILE 969 969 stderr $MYLOGFILE -
tags/ipp-20130307/ippTasks/survey.pro
r34976 r35489 18 18 book create SURVEY_STATICSKYSINGLE 19 19 book create SURVEY_SKYCAL 20 book create SURVEY_LAPGROUP 21 book create SURVEY_RELEXP 20 22 $haveSurveyBooks = TRUE 21 23 end … … 33 35 $SURVEY_PUBLISH_DB = 0 34 36 $SURVEY_SKYCAL_DB = 0 37 $SURVEY_LAPGROUP_DB = 0 38 $SURVEY_RELEXP_DB = 0 35 39 $SURVEY_STATICSKYSINGLE_DB = 0 36 40 $SURVEY_EXEC = 120 … … 78 82 active true 79 83 end 84 task survey.lapgroup 85 active true 86 end 87 task survey.relexp 88 active true 89 end 80 90 end 81 91 … … 118 128 end 119 129 task survey.skycal 130 active false 131 end 132 task survey.lapgroup 133 active false 134 end 135 task survey.relexp 120 136 active false 121 137 end … … 494 510 macro survey.show.skycal 495 511 if ($0 != 1) 496 echo "USAGE: survey.show.sky acl"512 echo "USAGE: survey.show.skycal" 497 513 break 498 514 end 499 515 book listbook SURVEY_SKYCAL 516 end 517 518 macro survey.add.lapgroup 519 if ($0 != 3) 520 echo "USAGE: survey.add.lapgroup (label) (seq_id)" 521 break 522 end 523 book newpage SURVEY_LAPGROUP $1 524 book setword SURVEY_LAPGROUP $1 LABEL $1 525 book setword SURVEY_LAPGROUP $1 SEQ_ID $2 526 book setword SURVEY_LAPGROUP $1 STATE PENDING 527 end 528 529 macro survey.del.lapgroup 530 if ($0 != 2) 531 echo "USAGE: survey.del.lapgroup (label)" 532 break 533 end 534 book delpage SURVEY_LAPGROUP $1 535 end 536 537 macro survey.show.lapgroup 538 if ($0 != 1) 539 echo "USAGE: survey.show.lapgroup" 540 break 541 end 542 book listbook SURVEY_LAPGROUP 543 end 544 545 macro survey.add.relexp 546 if ($0 != 3) 547 echo "USAGE: survey.add.relexp (label) (releasename)" 548 break 549 end 550 book newpage SURVEY_RELEXP $1 551 book setword SURVEY_RELEXP $1 LABEL $1 552 book setword SURVEY_RELEXP $1 RELEASE_NAME $2 553 book setword SURVEY_RELEXP $1 STATE PENDING 554 end 555 556 macro survey.del.relexp 557 if ($0 != 2) 558 echo "USAGE: survey.del.relexp (label)" 559 break 560 end 561 book delpage SURVEY_RELEXP $1 562 end 563 564 macro survey.show.relexp 565 if ($0 != 1) 566 echo "USAGE: survey.show.relexp" 567 break 568 end 569 book listbook SURVEY_RELEXP 500 570 end 501 571 … … 1561 1631 end 1562 1632 end 1633 1634 task survey.lapgroup 1635 host local 1636 1637 periods -poll $SURVEY_POLL 1638 periods -exec $SURVEY_EXEC 1639 periods -timeout $SURVEY_TIMEOUT 1640 npending 1 1641 1642 stdout $LOGDIR/survey.lapgroup.log 1643 stderr $LOGDIR/survey.lapgroup.log 1644 1645 task.exec 1646 book npages SURVEY_LAPGROUP -var N 1647 if ($N == 0) 1648 # echo "No labels for processing" 1649 break 1650 endif 1651 1652 book getpage SURVEY_LAPGROUP 0 -var label -key STATE NEW 1653 if ("$label" == "NULL") 1654 # All labels have been done --- reset 1655 # echo "Resetting labels" 1656 for i 0 $N 1657 book getpage SURVEY_LAPGROUP $i -var label 1658 book setword SURVEY_LAPGROUP $label STATE NEW 1659 end 1660 book getpage SURVEY_LAPGROUP 0 -var label -key STATE NEW 1661 1662 # Select different database 1663 $SURVEY_LAPGROUP_DB ++ 1664 if ($SURVEY_LAPGROUP_DB >= $DB:n) set SURVEY_LAPGROUP_DB = 0 1665 end 1666 1667 book setword SURVEY_LAPGROUP $label STATE DONE 1668 book getword SURVEY_LAPGROUP $label SEQ_ID -var SEQ_ID 1669 1670 # For now the list of filters is hardcoded here 1671 $run = laptool -definegroup -seq_id $SEQ_ID -set_label $label -filter g.00000 -filter r.00000 -filter i.00000 -filter z.00000 -filter y.00000 1672 1673 if ($DB:n == 0) 1674 option DEFAULT 1675 else 1676 $run = $run -dbname $DB:$SURVEY_LAPGROUP_DB 1677 option $DB:$SURVEY_LAPGROUP_DB 1678 end 1679 1680 # echo $run 1681 command $run 1682 end 1683 1684 # success 1685 task.exit 0 1686 # echo "Success" 1687 end 1688 1689 # locked list 1690 task.exit default 1691 showcommand failure 1692 end 1693 1694 task.exit crash 1695 showcommand crash 1696 end 1697 1698 # operation times out? 1699 task.exit timeout 1700 showcommand timeout 1701 end 1702 end 1703 1704 task survey.relexp 1705 host local 1706 1707 periods -poll $SURVEY_POLL 1708 periods -exec $SURVEY_EXEC 1709 periods -timeout $SURVEY_TIMEOUT 1710 npending 1 1711 1712 stdout $LOGDIR/survey.relexp.log 1713 stderr $LOGDIR/survey.relexp.log 1714 1715 task.exec 1716 book npages SURVEY_RELEXP -var N 1717 if ($N == 0) 1718 # echo "No labels for processing" 1719 break 1720 endif 1721 1722 book getpage SURVEY_RELEXP 0 -var label -key STATE NEW 1723 if ("$label" == "NULL") 1724 # All labels have been done --- reset 1725 # echo "Resetting labels" 1726 for i 0 $N 1727 book getpage SURVEY_RELEXP $i -var label 1728 book setword SURVEY_RELEXP $label STATE NEW 1729 end 1730 book getpage SURVEY_RELEXP 0 -var label -key STATE NEW 1731 1732 # Select different database 1733 $SURVEY_RELEXP_DB ++ 1734 if ($SURVEY_RELEXP_DB >= $DB:n) set SURVEY_RELEXP_DB = 0 1735 end 1736 1737 book setword SURVEY_RELEXP $label STATE DONE 1738 book getword SURVEY_RELEXP $label RELEASE_NAME -var RELEASE_NAME 1739 1740 $run = releasetool -definerelexp -label $label -release_name $RELEASE_NAME -set_state processed 1741 1742 if ($DB:n == 0) 1743 option DEFAULT 1744 else 1745 $run = $run -dbname $DB:$SURVEY_RELEXP_DB 1746 option $DB:$SURVEY_RELEXP_DB 1747 end 1748 1749 # echo $run 1750 command $run 1751 end 1752 1753 # success 1754 task.exit 0 1755 # echo "Success" 1756 end 1757 1758 # locked list 1759 task.exit default 1760 showcommand failure 1761 end 1762 1763 task.exit crash 1764 showcommand crash 1765 end 1766 1767 # operation times out? 1768 task.exit timeout 1769 showcommand timeout 1770 end 1771 end -
tags/ipp-20130307/ippTools
- Property svn:mergeinfo set to
-
tags/ipp-20130307/ippTools/share
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippTools/share (added) merged: 35350,35412
- Property svn:mergeinfo changed
-
tags/ipp-20130307/ippTools/share/Makefile.am
r35214 r35489 457 457 laptool_WSdiff_check.sql \ 458 458 laptool_stacks.sql \ 459 laptool_pendinggroup.sql \ 460 laptool_revertgroup.sql \ 461 laptool_filtersforgroup.sql \ 459 462 vptool_find_rawexp.sql \ 460 463 vptool_pendingimfile.sql \ … … 470 473 releasetool_definerelstack.sql \ 471 474 releasetool_definerelstack_with_skycal.sql \ 475 releasetool_listrelstack.sql \ 472 476 releasetool_definerelgroup_select_lap.sql \ 473 477 releasetool_definerelgroup_select_data_group.sql \ -
tags/ipp-20130307/ippTools/share/addtool_find_processedexp_cam.sql
r31375 r35489 1 1 SELECT 2 2 addProcessedExp.*, 3 addRun.workdir 3 addRun.label, 4 addRun.workdir, 5 camRun.cam_id, 6 camRun.label as cam_label, 7 camRun.data_group as cam_data_group, 8 rawExp.exp_id, 9 exp_name 4 10 FROM addProcessedExp 5 11 JOIN addRun -
tags/ipp-20130307/ippTools/share/pstamptool_completedreq.sql
r29563 r35489 8 8 SELECT count(*) FROM pstampJob 9 9 WHERE pstampJob.req_id = pstampRequest.req_id 10 AND pstampJob.state != 'stop' 10 AND pstampJob.state != 'stop' 11 AND pstampJob.state != 'cancel' 11 12 ) = 0 -
tags/ipp-20130307/ippTools/share/pstamptool_getdependent.sql
r28145 r35489 1 1 SELECT DISTINCT pstampDependent.* 2 2 FROM pstampDependent 3 WHERE pstampDependent.state = 'new'3 WHERE (pstampDependent.state = 'new' OR pstampDependent.state = 'hold') -
tags/ipp-20130307/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippTools/share/pxadmin_create_tables.sql (added) merged: 35350,35412
r35293 r35489 1 CREATE TABLE dbversion (1 eREATE TABLE dbversion ( 2 2 schema_version VARCHAR(64), 3 3 updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP … … 2172 2172 priority INT, 2173 2173 PRIMARY KEY(rel_id), 2174 UNIQUE KEY(surveyID, release_name), 2174 2175 KEY(release_name), 2175 2176 KEY(release_state), … … 2196 2197 PRIMARY KEY (relexp_id), 2197 2198 FOREIGN KEY(rel_id) REFERENCES ippRelease(rel_id), 2199 UNIQUE KEY(rel_id, exp_id), 2198 2200 KEY (state), 2199 2201 KEY (fault), … … 2224 2226 time_stamp DATETIME, 2225 2227 PRIMARY KEY (relstack_id), 2228 UNIQUE KEY (rel_id, tess_id, skycell_id, filter, stack_type, mjd_obs), 2226 2229 KEY (tess_id, skycell_id), 2227 KEY (rel_id, tess_id, skycell_id, filter, mjd_obs),2228 2230 KEY (stack_type), 2229 2231 KEY (mjd_obs), … … 2258 2260 CREATE TABLE lapGroup ( 2259 2261 seq_id BIGINT, 2262 tess_id VARCHAR(64), 2260 2263 projection_cell VARCHAR(64), 2261 2264 state VARCHAR(16), 2265 label VARCHAR(64), 2266 registered TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- time group was registered 2262 2267 fault SMALLINT, 2263 PRIMARY KEY(seq_id, projection_cell),2268 PRIMARY KEY(seq_id, tess_id, projection_cell), 2264 2269 KEY(state), 2265 2270 KEY(fault), - Property svn:mergeinfo changed
-
tags/ipp-20130307/ippTools/share/releasetool_definerelgroup_select_exp_lap.sql
r35213 r35489 1 1 SELECT relExp.relexp_id 2 FROM relGroup JOIN lapRun USING(lap_id) 2 FROM relGroup 3 JOIN lapRun USING(lap_id) 4 JOIN lapExp USING(lap_id) 3 5 JOIN relExp using(rel_id, exp_id) 4 6 WHERE relExp.group_id = 0 -
tags/ipp-20130307/ippTools/share/releasetool_definerelstack.sql
r35196 r35489 6 6 stackRun.tess_id, 7 7 stackRun.filter, 8 0 ASmjd_obs,8 stackSumSkyfile.mjd_obs, 9 9 0 AS zpt_obs, 10 10 0 AS zpt_stdev … … 12 12 FROM ippRelease 13 13 JOIN stackRun 14 LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter) 15 14 JOIN stackSumSkyfile using(stack_id) 15 LEFT JOIN relStack AS previousRelStack 16 ON previousRelStack.rel_id = ippRelease.rel_id 17 AND previousRelStack.tess_id = stackRun.tess_id 18 AND previousRelStack.skycell_id = stackRun.skycell_id 19 AND previousRelStack.filter = stackRun.filter 20 -- JOIN hook %s 16 21 WHERE previousRelStack.relstack_id IS NULL 22 AND stackRun.state ='full' 23 AND stackSumSkyfile.quality = 0 24 AND stackSumSkyfile.fault = 0 -
tags/ipp-20130307/ippTools/share/releasetool_definerelstack_with_skycal.sql
r35196 r35489 13 13 JOIN stackRun 14 14 JOIN stackSumSkyfile USING(stack_id) 15 LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter)16 15 JOIN skycalRun ON skycalRun.stack_id = stackRun.stack_id 17 16 JOIN skycalResult ON skycalRun.skycal_id = skycalResult.skycal_id 17 -- LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter) 18 LEFT JOIN relStack AS previousRelStack 19 ON ippRelease.rel_id = previousRelStack.rel_id 20 AND stackRun.tess_id = previousRelStack.tess_id 21 AND stackRun.skycell_id = previousRelStack.skycell_id 22 AND stackRun.filter = previousRelStack.filter 23 -- JOIN Hook %s 18 24 19 25 WHERE previousRelStack.relstack_id IS NULL 26 AND skycalRun.state = 'full' -
tags/ipp-20130307/ippTools/share/releasetool_listrelexp.sql
r35213 r35489 25 25 warpRun.warp_id, 26 26 warpRun.state as warp_state, 27 warpRun.tess_id, 27 28 rawExp.filter, 28 29 rawExp.dateobs, -
tags/ipp-20130307/ippTools/share/releasetool_pendingrelgroup.sql
r35214 r35489 1 SELECT relGroup.* 1 SELECT 2 relGroup.*, 3 ippRelease.release_name 2 4 FROM relGroup 3 5 JOIN ippRelease USING(rel_id) 4 6 WHERE relGroup.state = 'new' 7 AND relGroup.fault = 0 -
tags/ipp-20130307/ippTools/src
- Property svn:mergeinfo changed
-
tags/ipp-20130307/ippTools/src/laptool.c
r34081 r35489 34 34 static bool inactiveexpMode(pxConfig *config); 35 35 36 // Groups 37 static bool definegroupMode(pxConfig *config); 38 static bool pendinggroupMode(pxConfig *config); 39 static bool filtersforgroupMode(pxConfig *config); 40 static bool updategroupMode(pxConfig *config); 41 static bool revertgroupMode(pxConfig *config); 42 static bool listgroupMode(pxConfig *config); 43 36 44 # define MODECASE(caseName, func) \ 37 45 case caseName: \ … … 67 75 68 76 MODECASE(LAPTOOL_MODE_INACTIVEEXP, inactiveexpMode); 77 78 MODECASE(LAPTOOL_MODE_DEFINEGROUP, definegroupMode); 79 MODECASE(LAPTOOL_MODE_PENDINGGROUP, pendinggroupMode); 80 MODECASE(LAPTOOL_MODE_FILTERSFORGROUP, filtersforgroupMode); 81 MODECASE(LAPTOOL_MODE_UPDATEGROUP, updategroupMode); 82 MODECASE(LAPTOOL_MODE_REVERTGROUP, revertgroupMode); 83 MODECASE(LAPTOOL_MODE_LISTGROUP, listgroupMode); 84 69 85 default: 70 86 psAbort("invalid option (this should not happen)"); … … 900 916 return(true); 901 917 } 902 918 // --------------------------- 919 // Group level (a collection of completed lapRuns for a given lapSequence projection cell and collection of filters 920 921 static bool definegroupMode(pxConfig *config) 922 { 923 PS_ASSERT_PTR_NON_NULL(config, false); 924 925 PXOPT_LOOKUP_S64(seq_id, config->args, "-seq_id", true, false); 926 PXOPT_LOOKUP_STR(label, config->args, "-set_label", true, false); 927 928 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 929 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 930 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 931 932 // the following insures that the -filter argument has been set up properly (adapted from pxAddLabelSearchArgs) 933 psMetadataItem *item = psMetadataLookup(config->args, "-filter"); 934 psAssert (item, "-filter argument not found in config->args"); 935 psAssert (item->type == PS_DATA_METADATA_MULTI, "%s should be a multi container", "filter"); 936 psAssert (item->data.list->n, "%s should at least have a place-holder", "filter"); 937 psMetadataItem *entry = (psMetadataItem *)item->data.list->head->data; 938 psAssert (entry, "%s should at least have a place-holder", "filter"); 939 // end of checking 940 941 // Now if the ony entry is the place-holder then the user supplied no -filter arguments 942 // which are required 943 if (!entry->data.str) { 944 psError(PXTOOLS_ERR_ARGUMENTS, true, "at least one -filter is required"); 945 return false; 946 } 947 948 int nFilters = item->data.list->n; 949 950 psString query = psStringCopy("SELECT seq_id, tess_id, projection_cell,\n"); 951 952 // We construct a query joining completed lap runs with the same lapSequence.seq_id, 953 // tess_id, and projection_cell 954 955 // select the lap_ids for the various filters. These are only used for debugging. 956 psStringAppend(&query, "lap_id_%d", 0); 957 for (int i = 1; i < nFilters; i++) { 958 psStringAppend(&query, ", lap_id_%d", i); 959 } 960 961 962 // sub query for each supplied filter 963 char * lapRunForFilter = "(\nSELECT seq_id, tess_id, projection_cell, lap_id as 'lap_id_%d'\n" 964 "FROM lapRun\n" 965 "WHERE filter LIKE '%s'\n" 966 " AND lapRun.seq_id = %"PRId64"\n" 967 " AND (lapRun.state = 'done' or lapRun.state = 'full')\n" 968 " ) as lap_%d\n"; 969 970 // loop over supplied filters and flesh out the query using the format above 971 psListIterator *iter = psListIteratorAlloc (item->data.list, PS_LIST_HEAD, true); 972 psMetadataItem *filterItem = NULL; 973 int i = -1; 974 while ((filterItem = psListGetAndIncrement(iter))) { 975 ++i; 976 if (i == 0) { 977 psStringAppend(&query, "\nFROM\n"); 978 } else { 979 psStringAppend(&query, "\nJOIN\n"); 980 } 981 982 psString filter = filterItem->data.str; 983 psStringAppend(&query, lapRunForFilter, i, filter, seq_id, i); 984 985 if (i != 0) { 986 psStringAppend(&query, "USING (seq_id, tess_id, projection_cell)\n"); 987 } 988 } 989 // now join to lapGroup 990 psStringAppend(&query, "\nLEFT JOIN lapGroup USING(seq_id, tess_id, projection_cell)\n"); 991 992 // we only want projection cells which do not already of an entry 993 psStringAppend(&query, "\nWHERE lapGroup.projection_cell IS NULL\n"); 994 psStringAppend(&query, "\nORDER by projection_cell\n"); 995 996 if (limit) { 997 psString limitString = psDBGenerateLimitSQL(limit); 998 psStringAppend(&query, "\n %s", limitString); 999 psFree(limitString); 1000 } 1001 1002 if (!p_psDBRunQuery(config->dbh, query)) { 1003 psError(PS_ERR_UNKNOWN, false, "database error"); 1004 psFree(query); 1005 return false; 1006 } 1007 psFree(query); 1008 1009 psArray *output = p_psDBFetchResult(config->dbh); 1010 if (!output) { 1011 psError(PS_ERR_UNKNOWN, false, "database error"); 1012 return false; 1013 } 1014 1015 if (!psArrayLength(output)) { 1016 psTrace("laptool", PS_LOG_INFO, "no rows found"); 1017 psFree(output); 1018 return true; 1019 } 1020 1021 if (pretend) { 1022 if (!ippdbPrintMetadatas(stdout, output, "new_lapGroups", !simple)) { 1023 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1024 psFree(output); 1025 return false; 1026 } 1027 psFree(output); 1028 return true; 1029 } 1030 1031 if (!psDBTransaction(config->dbh)) { 1032 psError(PS_ERR_UNKNOWN, false, "database error"); 1033 return false; 1034 } 1035 1036 psTime *now = psTimeGetNow(PS_TIME_TAI); 1037 1038 psString last_projection_cell = NULL; 1039 for (long i = 0; i < psArrayLength(output); i++) { 1040 psMetadata *row = output->data[i]; 1041 1042 psString tess_id = psMetadataLookupStr(NULL, row, "tess_id"); 1043 psString projection_cell = psMetadataLookupStr(NULL, row, "projection_cell"); 1044 if (last_projection_cell && !strcmp(last_projection_cell, projection_cell)) { 1045 // duplicate lap runs for a filter will generate multiple rows 1046 // Since we care about projection_cells not lapRuns per se this is not problem. 1047 // Skip any duplicates. 1048 continue; 1049 } 1050 last_projection_cell = projection_cell; 1051 1052 lapGroupRow *group = lapGroupRowAlloc( 1053 seq_id, 1054 tess_id, 1055 projection_cell, 1056 "new", // state 1057 label, 1058 now, // registered 1059 0 // fault 1060 ); 1061 if (!group) { 1062 psError(PS_ERR_UNKNOWN, false, "failed to alloc lapGroup object"); 1063 psFree(output); 1064 psFree(now); 1065 return(false); 1066 } 1067 1068 1069 if (!lapGroupInsertObject(config->dbh, group)) { 1070 if (!psDBRollback(config->dbh)) { 1071 psError(PS_ERR_UNKNOWN, false, "database error"); 1072 } 1073 psError(PS_ERR_UNKNOWN, false, "database error"); 1074 psFree(output); 1075 return(true); 1076 } 1077 } 1078 1079 // point of no return 1080 if (!psDBCommit(config->dbh)) { 1081 psError(PS_ERR_UNKNOWN, false, "database error"); 1082 return false; 1083 } 1084 1085 psFree(now); 1086 psFree(output); 1087 1088 return(true); 1089 } 1090 1091 static bool pendinggroupMode(pxConfig *config) 1092 { 1093 PS_ASSERT_PTR_NON_NULL(config, false); 1094 1095 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1096 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1097 1098 psMetadata *where = psMetadataAlloc(); 1099 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 1100 pxAddLabelSearchArgs(config, where, "-label", "lapRun.label", "=="); 1101 1102 psString query = pxDataGet("laptool_pendinggroup.sql"); 1103 if (!query) { 1104 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 1105 return false; 1106 } 1107 1108 if (psListLength(where->list)) { 1109 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1110 psStringAppend(&query, " AND %s", whereClause); 1111 psFree(whereClause); 1112 } 1113 if (limit) { 1114 psString limitString = psDBGenerateLimitSQL(limit); 1115 psStringAppend(&query, "\n %s", limitString); 1116 psFree(limitString); 1117 } 1118 1119 if (!p_psDBRunQuery(config->dbh, query)) { 1120 psError(PS_ERR_UNKNOWN, false, "database error"); 1121 psFree(query); 1122 return false; 1123 } 1124 psFree(query); 1125 1126 psArray *output = p_psDBFetchResult(config->dbh); 1127 if (!output) { 1128 psErrorCode err = psErrorCodeLast(); 1129 switch (err) { 1130 case PS_ERR_DB_CLIENT: 1131 psError(PXTOOLS_ERR_SYS, false, "database error"); 1132 case PS_ERR_DB_SERVER: 1133 psError(PXTOOLS_ERR_PROG, false, "database error"); 1134 default: 1135 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1136 } 1137 1138 return false; 1139 } 1140 if (!psArrayLength(output)) { 1141 psTrace("laptool", PS_LOG_INFO, "no rows found"); 1142 psFree(output); 1143 return true; 1144 } 1145 1146 if (psArrayLength(output)) { 1147 if (!ippdbPrintMetadatas(stdout, output, "lapGroup", !simple)) { 1148 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1149 psFree(output); 1150 return false; 1151 } 1152 } 1153 1154 psFree(output); 1155 1156 return true; 1157 } 1158 static bool filtersforgroupMode(pxConfig *config) 1159 { 1160 PS_ASSERT_PTR_NON_NULL(config, false); 1161 1162 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1163 1164 psMetadata *where = psMetadataAlloc(); 1165 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 1166 PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "=="); 1167 PXOPT_COPY_STR(config->args, where, "-projection_cell", "projection_cell", "=="); 1168 1169 psString query = pxDataGet("laptool_filtersforgroup.sql"); 1170 if (!query) { 1171 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 1172 return false; 1173 } 1174 1175 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1176 psStringAppend(&query, " WHERE %s", whereClause); 1177 psFree(whereClause); 1178 1179 if (!p_psDBRunQuery(config->dbh, query)) { 1180 psError(PS_ERR_UNKNOWN, false, "database error"); 1181 psFree(query); 1182 return false; 1183 } 1184 psFree(query); 1185 1186 psArray *output = p_psDBFetchResult(config->dbh); 1187 if (!output) { 1188 psErrorCode err = psErrorCodeLast(); 1189 switch (err) { 1190 case PS_ERR_DB_CLIENT: 1191 psError(PXTOOLS_ERR_SYS, false, "database error"); 1192 case PS_ERR_DB_SERVER: 1193 psError(PXTOOLS_ERR_PROG, false, "database error"); 1194 default: 1195 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1196 } 1197 1198 return false; 1199 } 1200 if (!psArrayLength(output)) { 1201 psTrace("laptool", PS_LOG_INFO, "no rows found"); 1202 psFree(output); 1203 return true; 1204 } 1205 1206 if (psArrayLength(output)) { 1207 if (!ippdbPrintMetadatas(stdout, output, "filters", !simple)) { 1208 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1209 psFree(output); 1210 return false; 1211 } 1212 } 1213 1214 psFree(output); 1215 1216 return true; 1217 } 1218 1219 static bool updategroupMode(pxConfig *config) 1220 { 1221 PS_ASSERT_PTR_NON_NULL(config, false); 1222 1223 // check that all of the keys that define a lapGroup are supplied 1224 PXOPT_LOOKUP_S64(seq_id, config->args, "-seq_id", true, false); 1225 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); 1226 PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false); 1227 1228 psMetadata *where = psMetadataAlloc(); 1229 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 1230 PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "=="); 1231 PXOPT_COPY_STR(config->args, where, "-projection_cell", "projection_cell", "=="); 1232 1233 psMetadata *values = psMetadataAlloc(); 1234 PXOPT_COPY_STR(config->args, values, "-set_state", "state", "=="); 1235 PXOPT_COPY_STR(config->args, values, "-set_label", "label", "=="); 1236 PXOPT_COPY_S16(config->args, values, "-set_fault", "fault", "=="); 1237 1238 if (!psListLength(values->list)) { 1239 psFree(values); 1240 psFree(where); 1241 psError(PXTOOLS_ERR_ARGUMENTS, true, "must set at least one column"); 1242 return false; 1243 } 1244 1245 long rows = psDBUpdateRows(config->dbh, "lapGroup", where, values); 1246 if (rows < 1) { 1247 psFree(values); 1248 psError(PXTOOLS_ERR_SYS, true, "failed to update lapGroup for %" PRId64 " %s %s", seq_id, tess_id, projection_cell); 1249 return false; 1250 } 1251 psFree(values); 1252 1253 return(true); 1254 } 1255 1256 static bool revertgroupMode(pxConfig *config) 1257 { 1258 PS_ASSERT_PTR_NON_NULL(config, false); 1259 1260 psMetadata *where = psMetadataAlloc(); 1261 pxAddLabelSearchArgs (config, where, "-label", "label", "=="); 1262 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 1263 PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "=="); 1264 PXOPT_COPY_STR(config->args, where, "-projection_cell", "projection_cell", "=="); 1265 1266 if (!psListLength(where->list)) { 1267 psFree(where); 1268 psError(PXTOOLS_ERR_CONFIG, false, "search arguments are required"); 1269 return false; 1270 } 1271 1272 psString query = pxDataGet("laptool_revertgroup.sql"); 1273 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1274 psStringAppend(&query, " AND %s", whereClause); 1275 psFree(whereClause); 1276 psFree(where); 1277 if (!p_psDBRunQuery(config->dbh, query)) { 1278 psError(PS_ERR_UNKNOWN, false, "database error"); 1279 psFree(query); 1280 return false; 1281 } 1282 psFree(query); 1283 1284 psU64 affected = psDBAffectedRows(config->dbh); 1285 psLogMsg("laptool", PS_LOG_INFO, "Updated %" PRIu64 " lapGroups", affected); 1286 1287 return true; 1288 } 1289 1290 static bool listgroupMode(pxConfig *config) 1291 { 1292 PS_ASSERT_PTR_NON_NULL(config, false); 1293 1294 psError(PXTOOLS_ERR_SYS, true, "not yet implemented"); 1295 return false; 1296 1297 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1298 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1299 1300 psMetadata *where = psMetadataAlloc(); 1301 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 1302 PXOPT_COPY_STR(config->args, where, "-seq_name", "name", "LIKE"); 1303 1304 psString query = pxDataGet("laptool_listsequence.sql"); 1305 if (!query) { 1306 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 1307 return false; 1308 } 1309 if (psListLength(where->list)) { 1310 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1311 psStringAppend(&query, " WHERE %s", whereClause); 1312 psFree(whereClause); 1313 } 1314 1315 if (limit) { 1316 psString limitString = psDBGenerateLimitSQL(limit); 1317 psStringAppend(&query, " %s", limitString); 1318 psFree(limitString); 1319 } 1320 if (!p_psDBRunQuery(config->dbh, query)) { 1321 psError(PS_ERR_UNKNOWN, false, "database error"); 1322 psFree(query); 1323 return false; 1324 } 1325 psFree(query); 1326 1327 psArray *output = p_psDBFetchResult(config->dbh); 1328 if (!output) { 1329 psErrorCode err = psErrorCodeLast(); 1330 switch (err) { 1331 case PS_ERR_DB_CLIENT: 1332 psError(PXTOOLS_ERR_SYS, false, "database error"); 1333 case PS_ERR_DB_SERVER: 1334 psError(PXTOOLS_ERR_PROG, false, "database error"); 1335 default: 1336 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1337 } 1338 1339 return false; 1340 } 1341 if (!psArrayLength(output)) { 1342 psTrace("laptool", PS_LOG_INFO, "no rows found"); 1343 psFree(output); 1344 return true; 1345 } 1346 1347 if (psArrayLength(output)) { 1348 if (!ippdbPrintMetadatas(stdout, output, "lapSequence", !simple)) { 1349 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1350 psFree(output); 1351 return false; 1352 } 1353 } 1354 1355 psFree(output); 1356 1357 return true; 1358 } -
tags/ipp-20130307/ippTools/src/laptool.h
r32422 r35489 20 20 LAPTOOL_MODE_UPDATEEXP, 21 21 LAPTOOL_MODE_DIFFCHECK, 22 LAPTOOL_MODE_INACTIVEEXP 22 LAPTOOL_MODE_INACTIVEEXP, 23 LAPTOOL_MODE_DEFINEGROUP, 24 LAPTOOL_MODE_PENDINGGROUP, 25 LAPTOOL_MODE_FILTERSFORGROUP, 26 LAPTOOL_MODE_UPDATEGROUP, 27 LAPTOOL_MODE_REVERTGROUP, 28 LAPTOOL_MODE_LISTGROUP, 23 29 } laptoolMode; 24 30 -
tags/ipp-20130307/ippTools/src/laptoolConfig.c
r33343 r35489 97 97 ADD_OPT(S64, updaterunArgs, "-set_quick_sass_id", "set quick stack sass_id", 0); 98 98 ADD_OPT(S64, updaterunArgs, "-set_final_sass_id", "set final stack sass_id", 0); 99 100 99 101 100 // -pendingexp … … 150 149 ADD_OPT(U64, inactiveexpArgs, "-limit", "limit result set to N items", 0); 151 150 151 // -definegroup 152 psMetadata *definegroupArgs = psMetadataAlloc(); 153 ADD_OPT(S64, definegroupArgs, "-seq_id", "search by lap sequence ID (required)", 0); 154 ADD_OPT(Str, definegroupArgs, "-set_label", "set label (required)", 0); 155 156 psMetadataAddStr(definegroupArgs, PS_LIST_TAIL, 157 "-filter", PS_META_DUPLICATE_OK, 158 "search by filter (LIKE comparison, multiple OK)", NULL); 159 ADD_OPT(Bool,definegroupArgs, "-pretend", "do not actuallym modify the database", false); 160 ADD_OPT(Bool,definegroupArgs, "-simple", "use the simple output format", false); 161 ADD_OPT(U64, definegroupArgs, "-limit", "limit result set to N items", 0); 162 163 // -pendinggroup 164 psMetadata *pendinggroupArgs = psMetadataAlloc(); 165 psMetadataAddStr(pendinggroupArgs, PS_LIST_TAIL, 166 "-label", PS_META_DUPLICATE_OK, 167 "search by label (multiple OK)", NULL); 168 ADD_OPT(S64, pendinggroupArgs, "-seq_id", "search by lap sequence ID (required)", 0); 169 170 ADD_OPT(Bool,pendinggroupArgs, "-simple", "use the simple output format", false); 171 ADD_OPT(U64, pendinggroupArgs, "-limit", "limit result set to N items", 0); 172 173 // -updategroup 174 psMetadata *updategroupArgs = psMetadataAlloc(); 175 ADD_OPT(S64, updategroupArgs, "-seq_id", "search by lap sequence ID (required)", 0); 176 ADD_OPT(Str, updategroupArgs, "-tess_id", "search by tess_id (required)", 0); 177 ADD_OPT(Str, updategroupArgs, "-projection_cell", "search by projection_cell (required)", 0); 178 ADD_OPT(Str, updategroupArgs, "-set_state", "set state", 0); 179 ADD_OPT(S16, updategroupArgs, "-set_fault", "set fault code", INT16_MAX); 180 ADD_OPT(Str, updategroupArgs, "-set_label", "set label", 0); 181 182 // -revertgroup 183 psMetadata *revertgroupArgs = psMetadataAlloc(); 184 psMetadataAddStr(revertgroupArgs, PS_LIST_TAIL, 185 "-label", PS_META_DUPLICATE_OK, 186 "search by label (multiple OK)", NULL); 187 ADD_OPT(S64, revertgroupArgs, "-seq_id", "search by lap sequence ID", 0); 188 ADD_OPT(Str, revertgroupArgs, "-tess_id", "search by tess_id", 0); 189 ADD_OPT(Str, revertgroupArgs, "-projection_cell", "search by projection_cell", 0); 190 ADD_OPT(S16, revertgroupArgs, "-fault", "fault code", INT16_MAX); 191 192 // -filtersforgroup 193 psMetadata *filtersforgroupArgs = psMetadataAlloc(); 194 ADD_OPT(S64, filtersforgroupArgs, "-seq_id", "search by lap sequence ID (required)", 0); 195 ADD_OPT(Str, filtersforgroupArgs, "-tess_id", "search by tess_id (required)", 0); 196 ADD_OPT(Str, filtersforgroupArgs, "-projection_cell", "search by projection_cell (required)", 0); 197 ADD_OPT(Bool,filtersforgroupArgs, "-simple", "use the simple output format", false); 198 152 199 153 200 psMetadata *argSets = psMetadataAlloc(); … … 166 213 PXOPT_ADD_MODE("-diffcheck", "", LAPTOOL_MODE_DIFFCHECK, diffcheckArgs); 167 214 PXOPT_ADD_MODE("-inactiveexp", "", LAPTOOL_MODE_INACTIVEEXP, inactiveexpArgs); 215 PXOPT_ADD_MODE("-definegroup", "", LAPTOOL_MODE_DEFINEGROUP, definegroupArgs); 216 PXOPT_ADD_MODE("-pendinggroup", "", LAPTOOL_MODE_PENDINGGROUP, pendinggroupArgs); 217 PXOPT_ADD_MODE("-filtersforgroup", "", LAPTOOL_MODE_FILTERSFORGROUP, filtersforgroupArgs); 218 PXOPT_ADD_MODE("-updategroup", "", LAPTOOL_MODE_UPDATEGROUP, updategroupArgs); 219 PXOPT_ADD_MODE("-revertgroup", "", LAPTOOL_MODE_REVERTGROUP, revertgroupArgs); 168 220 169 221 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
tags/ipp-20130307/ippTools/src/pstamptool.c
r35293 r35489 49 49 static bool revertjobMode(pxConfig *config); 50 50 51 # if (1)52 // these are unused functions -- since they are 'static', this raises an warning53 // XXX: They actually are used54 51 static bool addprojectMode(pxConfig *config); 55 52 static bool projectMode(pxConfig *config); … … 63 60 static bool listfileMode(pxConfig *config); 64 61 static bool deletefileMode(pxConfig *config); 65 # endif66 62 67 63 # define MODECASE(caseName, func) \ … … 103 99 MODECASE(PSTAMPTOOL_MODE_STOPDEPENDENTJOB, stopdependentjobMode); 104 100 MODECASE(PSTAMPTOOL_MODE_REVERTJOB, revertjobMode); 105 # if (1)106 101 MODECASE(PSTAMPTOOL_MODE_ADDPROJECT, addprojectMode); 107 102 MODECASE(PSTAMPTOOL_MODE_MODPROJECT, modprojectMode); … … 115 110 MODECASE(PSTAMPTOOL_MODE_LISTFILE, listfileMode); 116 111 MODECASE(PSTAMPTOOL_MODE_DELETEFILE, deletefileMode); 117 # endif 112 118 113 default: 119 114 psAbort("invalid option (this should not happen)"); … … 452 447 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 453 448 PXOPT_COPY_S64(config->args, where, "-not_req_id", "req_id", "!="); 454 PXOPT_COPY_STR(config->args, where, "-name", "name", "=="); 449 PXOPT_COPY_STR(config->args, where, "-name", "name", "LIKE"); 450 PXOPT_COPY_STR(config->args, where, "-username", "username", "=="); 451 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 455 452 456 453 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 458 455 459 456 if (!psListLength(where->list)) { 460 psError(PS_ERR_UNKNOWN, true, " -req_id or -name must be supplied");457 psError(PS_ERR_UNKNOWN, true, "search paramters are required"); 461 458 return false; 462 459 } … … 490 487 if (!psArrayLength(output)) { 491 488 psTrace("pstamptool", PS_LOG_INFO, "request not found"); 492 // This causes main to exit with PS_EXIT_DATA_ERROR which the script islooking for489 // This causes main to exit with PS_EXIT_DATA_ERROR which the pstamp scripts are looking for 493 490 psError(PXTOOLS_ERR_CONFIG, true, "request not found"); 494 491 psFree(output); 495 // we return false so that the caller can determine that a request does not exist492 // we return false so that the caller can easily determine that a request does not exist 496 493 return false; 497 494 } … … 593 590 PXOPT_COPY_S32(config->args, where, "-fault", "fault", "=="); 594 591 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 595 PXOPT_COPY_STR(config->args, where, "-reqType", "reqType", "=="); 596 PXOPT_COPY_STR(config->args, where, "-name", "name", "LIKE"); 592 PXOPT_COPY_STR(config->args, where, "-reqType", "reqType", "=="); 593 PXOPT_COPY_STR(config->args, where, "-name", "name", "LIKE"); 594 PXOPT_COPY_STR(config->args, where, "-username", "username", "=="); 597 595 PXOPT_COPY_TIME(config->args, where, "-timestamp_begin", "timestamp", ">="); 598 596 PXOPT_COPY_TIME(config->args, where, "-timestamp_end", "timestamp", "<="); … … 621 619 if (outdir) { 622 620 psStringAppend(&query, ", outdir = '%s'", outdir); 621 } 622 if (username) { 623 psStringAppend(&query, ", username = '%s'", username); 623 624 } 624 625 if (clearfault) { … … 1233 1234 PXOPT_LOOKUP_BOOL(need_magic, config->args, "-need_magic", false); 1234 1235 PXOPT_LOOKUP_BOOL(no_create, config->args, "-no_create", false); 1236 PXOPT_LOOKUP_BOOL(hold, config->args, "-hold", false); 1235 1237 1236 1238 psMetadata *where = psMetadataAlloc(); … … 1240 1242 PXOPT_COPY_STR(config->args, where, "-component", "component", "=="); 1241 1243 1242 // start a transaction e raly so it will contain any row level locks1244 // start a transaction early so it will contain any row level locks 1243 1245 if (!psDBTransaction(config->dbh)) { 1244 1246 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1264 1266 psError(PS_ERR_UNKNOWN, false, "database error"); 1265 1267 psFree(query); 1268 if (!psDBRollback(config->dbh)) { 1269 psError(PS_ERR_UNKNOWN, false, "database error"); 1270 } 1266 1271 return false; 1267 1272 } … … 1271 1276 if (!output) { 1272 1277 psError(PS_ERR_UNKNOWN, false, "database error"); 1278 if (!psDBRollback(config->dbh)) { 1279 psError(PS_ERR_UNKNOWN, false, "database error"); 1280 } 1273 1281 return false; 1274 1282 } … … 1279 1287 psError(PS_ERR_UNKNOWN, false, "database error"); 1280 1288 psFree(output); 1289 if (!psDBRollback(config->dbh)) { 1290 psError(PS_ERR_UNKNOWN, false, "database error"); 1291 } 1281 1292 return false; 1282 1293 } … … 1284 1295 if (fault > 0) { 1285 1296 fprintf(stderr, "existing dependent has fault %d\n", fault); 1297 if (!psDBRollback(config->dbh)) { 1298 psError(PS_ERR_UNKNOWN, false, "database error"); 1299 } 1300 // return the fault to the client. This is used by the postage stamp parser 1286 1301 exit (fault); 1287 1302 } 1303 bool commit = false; 1304 // Check the state of the exisiting dependent. By query it is either 1305 // new or hold 1306 psString state = psMetadataLookupStr(NULL, dep, "state"); 1307 if (!hold && !strcmp(state, "hold")) { 1308 // There is a dependent for this component but it's state is hold. 1309 // This client needs one that will run. 1310 // Update the state 1311 psString updateQuery = NULL; 1312 psStringAppend(&updateQuery, "UPDATE pstampDependent SET state = 'new' " 1313 "\nWHERE stage = '%s' AND imagedb = '%s' AND stage_id = %"PRId64 " AND component = '%s'", 1314 stage, imagedb, stage_id, component); 1315 1316 if (!p_psDBRunQuery(config->dbh, updateQuery)) { 1317 psError(PS_ERR_UNKNOWN, false, "database error"); 1318 psFree(updateQuery); 1319 if (!psDBRollback(config->dbh)) { 1320 psError(PS_ERR_UNKNOWN, false, "database error"); 1321 } 1322 return false; 1323 } 1324 // set flag to commit this change 1325 commit = true; 1326 psFree(updateQuery); 1327 } 1328 // print the dep_id for the user 1288 1329 printf("%" PRId64 "\n", dep_id); 1289 1330 psFree(output); 1290 if (!psDBRollback(config->dbh)) { 1331 // now either commit the change or rollback the transaction which releases the lock 1332 if (commit) { 1333 if (!psDBCommit(config->dbh)) { 1334 // rollback 1335 if (!psDBRollback(config->dbh)) { 1336 psError(PS_ERR_UNKNOWN, false, "database error"); 1337 } 1291 1338 psError(PS_ERR_UNKNOWN, false, "database error"); 1339 return false; 1340 } 1341 } else if (!psDBRollback(config->dbh)) { 1342 psError(PS_ERR_UNKNOWN, false, "database error"); 1343 return false; 1292 1344 } 1293 1345 return true; … … 1307 1359 config->dbh, 1308 1360 0, // dep_id 1309 "new", // state1361 hold ? "hold" : "new", // state 1310 1362 stage, 1311 1363 stage_id, -
tags/ipp-20130307/ippTools/src/pstamptoolConfig.c
r35293 r35489 90 90 psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-req_id", 0, "list by req_id", 0); 91 91 psMetadataAddStr(listreqArgs, PS_LIST_TAIL, "-name", 0, "list by name", NULL); 92 psMetadataAddStr(listreqArgs, PS_LIST_TAIL, "-username", 0, "list by user name", NULL); 93 psMetadataAddStr(listreqArgs, PS_LIST_TAIL, "-state", 0, "list by state", NULL); 92 94 psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-not_req_id", 0, "req_id to not list", 0); 93 95 psMetadataAddU64(listreqArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); … … 107 109 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 108 110 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-reqType", 0, "search by reqType", NULL); 109 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-name", 0, "search by reqType (LIKE comparsion)", NULL); 111 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-name", 0, "search by reqType (LIKE comparsion)", NULL); 112 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-username", 0, "search by username", NULL); 110 113 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 111 114 psMetadataAddTime(updatereqArgs, PS_LIST_TAIL, "-timestamp_begin", 0, "search by timestamp (>=)", NULL); … … 220 223 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-need_magic", 0, "define need_magic", false); 221 224 psMetadataAddStr(getdependentArgs, PS_LIST_TAIL, "-outdir", 0, "define output directory for dependent (required)", NULL); 225 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-hold", 0, "if creating new dependent set it's state to hold", false); 222 226 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-no_create", 0, "if no matching dependent do not create one", false); 223 227 -
tags/ipp-20130307/ippTools/src/releasetool.c
r35230 r35489 702 702 PXOPT_COPY_STR(config->args, where, "-cam_data_group", "camRun.data_group", "LIKE"); 703 703 PXOPT_COPY_STR(config->args, where, "-warp_data_group", "warpRun.data_group", "LIKE"); 704 PXOPT_COPY_STR(config->args, where, "-tess_id", "warpRun.tess_id", "=="); 705 PXOPT_COPY_STR(config->args, where, "-skycell_id", "warpSkyfile.skycell_id", "=="); 706 707 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", false, false); 704 708 705 709 PXOPT_COPY_STR(config->args, where, "-surveyName", "survey.surveyName", "LIKE"); … … 715 719 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 716 720 return false; 721 } 722 723 if (skycell_id) { 724 psStringAppend(&query, "\nJOIN warpSkyfile ON warpRun.warp_id = warpSkyfile.warp_id AND warpRun.tess_id = warpSkyfile.tess_id"); 717 725 } 718 726 … … 741 749 742 750 if (priority_order) { 743 psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority ");751 psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority DESC"); 744 752 } 745 753 … … 787 795 bool includeSkycal = false; 788 796 797 PXOPT_COPY_STR(config->args, where, "-skycal_label", "skycalRun.label", "=="); 798 PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE"); 789 799 PXOPT_COPY_S64(config->args, where, "-skycal_id", "skycalRun.skycal_id", "=="); 790 PXOPT_COPY_STR(config->args, where, "-skycal_label", "skycalRun.label", "==");791 PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "==");792 800 if (psListLength(where->list)) { 793 801 includeSkycal = true; … … 795 803 796 804 PXOPT_COPY_STR(config->args, where, "-label", "stackRun.label", "=="); 797 PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", " ==");805 PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", "LIKE"); 798 806 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 799 807 … … 832 840 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 833 841 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 842 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 834 843 835 844 // find the parameters of all the exposures that we want to add to the release … … 847 856 } 848 857 858 psString joinConditions = psStringCopy(""); 859 // Finish up the selectors for the JOIN to previousRelStack 860 // join to rows with our stack_type 861 psStringAppend(&joinConditions, "\nAND previousRelStack.stack_type = '%s'", stack_type); 862 863 if (!strcmp(stack_type, "nightly")) { 864 // detect nightly stack entries that already exist for this day 865 psStringAppend(&joinConditions, "\nAND previousRelStack.mjd_obs = floor(stackSumSkyfile.mjd_obs)"); 866 } 867 868 // Add in the where conditions 849 869 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 850 psStringAppend(&query, " AND %s", whereClause);870 psStringAppend(&query, "\nAND %s", whereClause); 851 871 psFree(whereClause); 852 872 873 if (!strcmp(stack_type, "nightly")) { 874 // avoid stacks with NAN mjd_obs. These are old skycells that were lost due to system failure 875 // prior to the time that the mjd_obs was extracted from the headers and added to stackSumSkyfile 876 psStringAppend(&query, "\nAND stackSumSkyfile.mjd_obs IS NOT NULL"); 877 } 878 853 879 psFree(where); 854 880 855 if (!p_psDBRunQuery(config->dbh, query)) { 881 if (limit) { 882 psString limitString = psDBGenerateLimitSQL(limit); 883 psStringAppend(&query, " %s", limitString); 884 psFree(limitString); 885 } 886 887 if (!p_psDBRunQueryF(config->dbh, query, joinConditions)) { 856 888 psError(PS_ERR_UNKNOWN, false, "database error"); 857 889 psFree(query); 890 psFree(joinConditions); 858 891 return false; 859 892 } 860 893 psFree(query); 894 psFree(joinConditions); 861 895 862 896 psArray *output = p_psDBFetchResult(config->dbh); … … 968 1002 psMetadata *where = psMetadataAlloc(); 969 1003 1004 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 1005 PXOPT_COPY_S64(config->args, where, "-stack_id", "relStack.stack_id", "=="); 1006 PXOPT_COPY_S64(config->args, where, "-skycal_id", "relStack.skycal_id", "=="); 1007 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 970 1008 PXOPT_COPY_STR(config->args, where, "-release_name", "ippRelease.release_name", "LIKE"); 971 1009 pxAddLabelSearchArgs(config, where, "-release_state","ippRelease.state", "=="); 972 PXOPT_COPY_STR(config->args, where, "-state", "relExp.state", "=="); 973 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "LIKE"); 974 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin","rawExp.dateobs", ">="); 975 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<="); 976 PXOPT_COPY_F32(config->args, where, "-fwhm_min", "skycalResult.fwhm_major", ">="); 977 PXOPT_COPY_F32(config->args, where, "-fwhm_max", "skycalresult.fwhm_major", "<="); 978 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_ame", "=="); 979 PXOPT_COPY_S64(config->args, where, "-exp_id", "relExp.exp_id", "=="); 980 PXOPT_COPY_S64(config->args, where, "-chip_id", "relExp.chip_id", "=="); 981 PXOPT_COPY_S64(config->args, where, "-cam_id", "relExp.cam_id", "=="); 982 PXOPT_COPY_S64(config->args, where, "-warp_id", "warpRun.warp_id", "=="); 983 PXOPT_COPY_STR(config->args, where, "-chip_data_group", "chipRun.data_group", "LIKE"); 984 PXOPT_COPY_STR(config->args, where, "-cam_data_group", "camRun.data_group", "LIKE"); 985 PXOPT_COPY_STR(config->args, where, "-warp_data_group", "warpRun.data_group", "LIKE"); 1010 PXOPT_COPY_STR(config->args, where, "-state", "relStack.state", "=="); 1011 PXOPT_COPY_STR(config->args, where, "-filter", "relStack.filter", "LIKE"); 1012 PXOPT_COPY_F32(config->args, where, "-mjd_min", "stackSumSkyfile.mjd_obs", ">="); 1013 PXOPT_COPY_F32(config->args, where, "-mjd_max", "stackSumSkyfile.mjd_obs", "<="); 1014 PXOPT_COPY_STR(config->args, where, "-tess_id", "relStack.tess_id", "=="); 1015 PXOPT_COPY_STR(config->args, where, "-skycell_id", "relStack.skycell_id", "LIKE"); 1016 // PXOPT_COPY_STR(config->args, where, "-stack_type", "relStack.stack_type", "=="); 1017 PXOPT_COPY_STR(config->args, where, "-stack_data_group", "stackRun.data_group", "LIKE"); 1018 PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE"); 986 1019 987 1020 PXOPT_COPY_STR(config->args, where, "-surveyName", "survey.surveyName", "LIKE"); 988 1021 PXOPT_COPY_S32(config->args, where, "-rel_id", "relExp.rel_id", "=="); 1022 pxskycellAddWhere(config, where); 1023 1024 PXOPT_COPY_F32(config->args, where, "-fwhm_min", "IFNULL(skycalResult.fwhm_major, 999)", ">="); 1025 PXOPT_COPY_F32(config->args, where, "-fwhm_max", "IFNULL(skycalResult.fwhm_major, 0)", "<="); 989 1026 990 1027 PXOPT_LOOKUP_BOOL(priority_order, config->args, "-priority_order", false); … … 993 1030 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 994 1031 995 psString query = pxDataGet("releasetool_listrelexp.sql"); 1032 pxAddLabelSearchArgs (config, where, "-stack_type", "relStack.stack_type", "=="); 1033 1034 psString query = pxDataGet("releasetool_listrelstack.sql"); 996 1035 if (!query) { 997 1036 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 998 return false;999 }1000 1001 psString where2 = NULL;1002 if (!pxspaceAddWhere(config, &where2, "rawExp")) {1003 psError(psErrorCodeLast(), false, "pxspaceAddWhere failed");1004 1037 return false; 1005 1038 } … … 1009 1042 psStringAppend(&query, "\nWHERE %s", whereClause); 1010 1043 psFree(whereClause); 1011 } else if (where2) {1012 psStringAppend(&query, "\nWHERE ");1013 1044 } else { 1014 1045 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n"); … … 1017 1048 } 1018 1049 1019 if (where2) {1020 psStringAppend(&query, "\n%s", where2);1021 psFree(where2);1022 }1023 1024 1050 if (priority_order) { 1025 psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority");1051 psStringAppend(&query, "\nAND priority > 0 order by stack_id, priority DESC"); 1026 1052 } 1027 1053 … … 1051 1077 } 1052 1078 1053 if (!ippdbPrintMetadatas(stdout, output, "rel Exp", !simple)) {1079 if (!ippdbPrintMetadatas(stdout, output, "relStack", !simple)) { 1054 1080 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1055 1081 psFree(output); … … 1270 1296 } 1271 1297 if (!psArrayLength(exposures)) { 1298 fprintf(stderr, "no exposures found for lap_id %" PRId64 "\n", lap_id); 1299 #ifdef notdef 1300 continue; 1272 1301 psFree(now); 1273 1302 psFree(output); … … 1278 1307 } 1279 1308 return false; 1309 #endif 1280 1310 } 1281 1311 … … 1301 1331 psFree(exposures); 1302 1332 1303 // setstate of relGroup to 'new'1333 // update the state of relGroup to 'new' 1304 1334 if (!p_psDBRunQueryF(config->dbh, "UPDATE relGroup set state = 'new' WHERE group_id = %d", group_id)) { 1305 1335 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1325 1355 static bool updaterelgroupMode(pxConfig *config) 1326 1356 { 1327 psError(PS_ERR_UNKNOWN, true, "not yet implemented"); 1328 return false; 1357 PS_ASSERT_PTR_NON_NULL(config, false); 1358 1359 PXOPT_LOOKUP_S32(group_id, config->args, "-group_id", false, false); 1360 PXOPT_LOOKUP_STR(group_name, config->args, "-group_name", false, false); 1361 if (!group_id && !group_name) { 1362 psError(PXTOOLS_ERR_CONFIG, true, "either group_id or group_name is required\n"); 1363 return false; 1364 } 1365 1366 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1367 PXOPT_LOOKUP_STR(exp_list_path, config->args, "-set_exp_list_path", false, false); 1368 PXOPT_LOOKUP_STR(new_label, config->args, "-set_label", false, false); 1369 PXOPT_LOOKUP_S16(fault, config->args, "-set_fault", false, false); 1370 PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false); 1371 1372 if (!state && !exp_list_path && !new_label && !fault && !clearfault) { 1373 psError(PXTOOLS_ERR_CONFIG, true, "must set at least one column\n"); 1374 return false; 1375 } 1376 1377 if (fault && clearfault) { 1378 psError(PXTOOLS_ERR_CONFIG, true, "cannot set and clear fault at same time\n"); 1379 return false; 1380 } 1381 1382 psMetadata *where = psMetadataAlloc(); 1383 1384 PXOPT_COPY_S64(config->args, where, "-group_id", "relGroup.group_id", "=="); 1385 PXOPT_COPY_STR(config->args, where, "-group_name", "relGroup.group_name", "=="); 1386 // XXX TODO if label is enabled (for changing label or state for a block) we should 1387 // disallow setting some parameters such as exp_list_path 1388 // PXOPT_COPY_S64(config->args, where, "-label", "relGroup.label", "=="); 1389 // make sure that we have enough parameters to identify the relGroup to change 1390 if (!psListLength(where->list)){ 1391 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n"); 1392 psFree(where); 1393 return false; 1394 } 1395 1396 psString sep = ""; 1397 psString comma = ", "; 1398 psString query = psStringCopy("UPDATE relGroup SET"); 1399 if (state) { 1400 psStringAppend(&query, "%s relGroup.state = '%s'", sep, state); 1401 sep = comma; 1402 } 1403 if (exp_list_path) { 1404 psStringAppend(&query, "%s relGroup.exp_list_path = '%s'", sep, exp_list_path); 1405 sep = comma; 1406 } 1407 if (new_label) { 1408 psStringAppend(&query, "%s relGroup.label = '%s'", sep, new_label); 1409 sep = comma; 1410 } 1411 if (fault) { 1412 psStringAppend(&query, "%s relGroup.fault = %d", sep, fault); 1413 sep = comma; 1414 } 1415 if (clearfault) { 1416 psStringAppend(&query, "%s relGroup.fault = 0", sep); 1417 sep = comma; 1418 } 1419 1420 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1421 psStringAppend(&query, " WHERE %s", whereClause); 1422 psFree(whereClause); 1423 1424 if (!p_psDBRunQuery(config->dbh, query)) { 1425 psError(PS_ERR_UNKNOWN, false, "database error"); 1426 psFree(query); 1427 return false; 1428 } 1429 1430 psU64 affected = psDBAffectedRows(config->dbh); 1431 psLogMsg("releasetool", PS_LOG_INFO, "Updated %" PRIu64 " ippReleases", affected); 1432 1433 1434 psFree(query); 1435 1436 return true; 1329 1437 } 1330 1438 … … 1410 1518 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<="); 1411 1519 PXOPT_COPY_F32(config->args, where, "-fwhm_min", "skycalResult.fwhm_major", ">="); 1412 PXOPT_COPY_F32(config->args, where, "-fwhm_max", "skycal result.fwhm_major", "<=");1520 PXOPT_COPY_F32(config->args, where, "-fwhm_max", "skycalResult.fwhm_major", "<="); 1413 1521 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_ame", "=="); 1414 1522 PXOPT_COPY_S64(config->args, where, "-exp_id", "relExp.exp_id", "=="); -
tags/ipp-20130307/ippTools/src/releasetoolConfig.c
r35227 r35489 164 164 psMetadataAddStr(listrelexpArgs, PS_LIST_TAIL, "-cam_data_group", 0, "camRun.data_group (LIKE comparison)", NULL); 165 165 psMetadataAddStr(listrelexpArgs, PS_LIST_TAIL, "-warp_data_group", 0, "warpRun.data_group (LIKE comparison)", NULL); 166 psMetadataAddStr(listrelexpArgs, PS_LIST_TAIL, "-skycell_id", 0, "select by skycell", NULL); 167 psMetadataAddStr(listrelexpArgs, PS_LIST_TAIL, "-tess_id", 0, "warpRun.tess_id", NULL); 166 168 167 169 psMetadataAddStr(listrelexpArgs, PS_LIST_TAIL, "-surveyName", 0, "select by survey name (LIKE comparision)", NULL); … … 195 197 psMetadataAddF32(definerelstackArgs, PS_LIST_TAIL, "-set_zpt_stdev", 0, "define zero point stdev", NAN); 196 198 psMetadataAddF32(definerelstackArgs, PS_LIST_TAIL, "-set_fwhm_major", 0, "define fwhm_major", NAN); 197 psMetadataAddStr(definerelstackArgs, PS_LIST_TAIL, "-set_path_base", 0, "define state (required)", NULL);199 psMetadataAddStr(definerelstackArgs, PS_LIST_TAIL, "-set_path_base", 0, "define state", NULL); 198 200 psMetadataAddS16(definerelstackArgs, PS_LIST_TAIL, "-set_fault", 0, "define fault", 0); 199 201 200 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false);202 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 201 203 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 204 psMetadataAddU64(definerelstackArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 205 206 // -listrelstack 207 psMetadata *listrelstackArgs = psMetadataAlloc(); 208 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-relstack_id", 0, "select by released exposure ID", 0); 209 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-stack_id", 0, "select by stack ID", 0); 210 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-skycal_id", 0, "select by skycal ID", 0); 211 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-release_name", 0, "select by release name (LIKE comparision)", NULL); 212 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-release_state", PS_META_DUPLICATE_OK, "select by release state", NULL); 213 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-state", 0, "select by released stack state", NULL); 214 215 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-filter", 0, "select by filter name (LIKE comparison)", NULL); 216 // psMetadataAddTime(listrelstackArgs, PS_LIST_TAIL, "-dateobs_begin", 0,"search for exposures by time (>=)", NULL); 217 // psMetadataAddTime(listrelstackArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 218 219 pxskycellAddArguments(listrelstackArgs); 220 221 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-fwhm_min", 0, "search by measured seeing (>=)", NAN); 222 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-fwhm_max", 0, "search by seeing (<=)", NAN); 223 224 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-mjd_min", 0, "search by MJD seeing (>=)", NAN); 225 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-mjd_max", 0, "search by MJD (<=)", NAN); 226 227 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-tess_id", 0, "select by tess_id", NULL); 228 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-skycell_id", 0, "select by skycell_id (LIKE comparision)", NULL); 229 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-stack_type", PS_META_DUPLICATE_OK, "select by stack_type", NULL); 230 231 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-stack_data_group", 0, "select by stackRun.data_group (LIKE comparison)", NULL); 232 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-skycal_data_group", 0, "select by skycalRun.data_group (LIKE comparison)", NULL); 233 234 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-surveyName", 0, "select by survey name (LIKE comparision)", NULL); 235 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-rel_id", 0, "select by release ID", 0); 236 237 psMetadataAddBool(listrelstackArgs, PS_LIST_TAIL, "-priority_order", 0, "order by release priority", false); 238 239 psMetadataAddU64(listrelstackArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 240 psMetadataAddBool(listrelstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 241 202 242 203 243 // -definerelgroup … … 217 257 // parameters of the relGroup 218 258 psMetadataAddStr(definerelgroupArgs, PS_LIST_TAIL, "-set_group_type", 0, "define group_type (required)", NULL); 219 psMetadataAddStr(definerelgroupArgs, PS_LIST_TAIL, "-set_group_name", 0, "define group_name (required)", NULL);259 psMetadataAddStr(definerelgroupArgs, PS_LIST_TAIL, "-set_group_name", 0, "define group_name", NULL); 220 260 psMetadataAddStr(definerelgroupArgs, PS_LIST_TAIL, "-set_label", 0, "define relgroup label (required)", NULL); 221 261 psMetadataAddStr(definerelgroupArgs, PS_LIST_TAIL, "-set_state", 0, "define state", NULL); … … 240 280 psMetadata *updaterelgroupArgs = psMetadataAlloc(); 241 281 242 // set the target release243 psMetadataAddS 32(updaterelgroupArgs, PS_LIST_TAIL, "-group_id", 0, "select by group ID (required)", 0);282 psMetadataAddS32(updaterelgroupArgs, PS_LIST_TAIL, "-group_id", 0, "select by group ID", 0); 283 psMetadataAddStr(updaterelgroupArgs, PS_LIST_TAIL, "-group_name", 0, "select by group name", 0); 244 284 245 285 // parameters of the relGroup … … 273 313 274 314 PXOPT_ADD_MODE("-definerelstack", "define a released stack", RELEASETOOL_MODE_DEFINERELSTACK, definerelstackArgs); 315 PXOPT_ADD_MODE("-listrelstack", "list released stacks", RELEASETOOL_MODE_LISTRELSTACK, listrelstackArgs); 275 316 276 317 PXOPT_ADD_MODE("-definerelgroup", "define a group of exposures", RELEASETOOL_MODE_DEFINERELGROUP, definerelgroupArgs); -
tags/ipp-20130307/pstamp
- Property svn:mergeinfo set to
-
tags/ipp-20130307/pstamp/scripts
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/pstamp/scripts (added) merged: 35350,35412
- Property svn:mergeinfo changed
-
tags/ipp-20130307/pstamp/scripts/psmkreq
r34611 r35489 1 1 #!/bin/env perl 2 2 ### 3 ### ps tamprequest3 ### psmkreq 4 4 ### 5 ### Program to make a postage stamp request table for a set of coordinates 5 ### Program to make a postage stamp request table for a set of coordinates using supplied command 6 ### line options and defaults 6 7 ### 7 8 … … 28 29 my ($ra, $dec, $x, $y, $list, $output, $req_name, $req_name_base); 29 30 30 my ($image, $mask, $variance, $cmf, $psf, $backmdl, $inverse); 31 my ($unconvolved, $use_imfile_id, $no_wait); 31 my ($image, $mask, $variance, $jpeg, $cmf, $psf, $backmdl, $inverse); 32 my ($convolved, $unconvolved, $uncompressed, $use_imfile_id, $no_wait); 33 34 # new header keywords for version 2 35 my $action = 'PROCESS'; 36 my $email = 'null'; 32 37 33 38 my $default_size = 100; … … 52 57 my $comment; 53 58 59 # new request specification columns for version 2 60 my $survey_name ='null'; 61 my $release_name = 'null'; 62 my $run_type ='null'; 63 my $fwhm_min = 0; 64 my $fwhm_max = 0; 65 66 54 67 my $missing_tools; 55 68 my $pstamp_request_file = can_run('pstamp_request_file') or (warn "Can't find required program pstamp_request_file" and $missing_tools = 1); … … 62 75 GetOptions( 63 76 'list=s' => \$list, # list of coordinates if undef ra and dec or x and y are required 64 'ra=s' => \$ra, #77 'ra=s' => \$ra, 65 78 'dec=s' => \$dec, 66 79 'x=s' => \$x, … … 87 100 'comment=s' => \$comment, 88 101 102 'survey=s' => \$survey_name, 103 'release=s' => \$release_name, 104 'run_type=s' => \$run_type, 105 'fwhm_min=s' => \$fwhm_min, 106 'fwhm_max=s' => \$fwhm_max, 107 89 108 'option_mask=i' => \$option_mask, 90 109 'image' => \$image, 91 110 'mask' => \$mask, 111 'jpeg' => \$jpeg, 92 112 'variance' => \$variance, 93 113 'cmf' => \$cmf, … … 96 116 'inverse' => \$inverse, 97 117 'unconvolved' => \$unconvolved, 118 'convolved' => \$convolved, 119 'uncompressed' => \$uncompressed, 98 120 'use_imfile_id' => \$use_imfile_id, 99 121 'do_not_wait' => \$no_wait, 122 123 'action=s' => \$action, 124 'email=s' => \$email, 100 125 101 126 'verbose' => \$verbose, … … 156 181 } 157 182 183 if ($stage eq 'stack') { 184 # default is to do convolved stack 185 unless (defined $option_mask || $convolved) { 186 $unconvolved = 1; 187 } 188 } 189 158 190 checkFilter($filter, 'null', $filter) if $filter; 159 191 checkMJD($mjd_min, 0, "") if $mjd_min; … … 167 199 $option_mask |= $PSTAMP_SELECT_MASK if $mask; 168 200 $option_mask |= $PSTAMP_SELECT_VARIANCE if $variance; 201 $option_mask |= $PSTAMP_SELECT_JPEG if $jpeg; 202 203 # if no image was requested make a stamp of the image 169 204 $option_mask = $PSTAMP_SELECT_IMAGE if $option_mask == 0; 170 205 171 # if no image was requested make a stamp of the image172 206 173 207 $option_mask |= $PSTAMP_SELECT_CMF if $cmf; … … 207 241 } else { 208 242 $rows = []; 209 push @$rows, buildRow("", $comment, $x, $y, $filter, $mjd_min, $mjd_max);243 push @$rows, buildRow("", $comment, 1, $x, $y, $filter, $mjd_min, $mjd_max); 210 244 } 211 245 212 246 my ($tdf, $table_def_name) = tempfile ("/tmp/tabledef.XXXX", UNLINK => !$save_temps); 213 print $tdf "$req_name 1\n"; 247 my $line = "$req_name 2 $action $email"; 248 print "$line\n" if $verbose; 249 print $tdf "$line\n"; 214 250 my $rownum = 0; 215 251 foreach my $row (@$rows) { 216 252 $rownum++; 217 253 my $line = "$rownum $row->{ra}\t$row->{dec}\t$width $height" 218 . " $coord_mask $job_type $option_mask $project $ req_type"254 . " $coord_mask $job_type $option_mask $project $survey_name $release_name $req_type" 219 255 . " $stage $id $tess_id $component $data_group" 220 . " $row->{filter} $row->{mjd_min} $row->{mjd_max} ";256 . " $row->{filter} $row->{mjd_min} $row->{mjd_max} $run_type $fwhm_min $fwhm_max"; 221 257 222 258 if ($row->{comment} and $row->{comment} ne '') { … … 235 271 $command .= " --output $output" if $output; 236 272 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 237 run(command => $command, verbose => 0);273 run(command => $command, verbose => $verbose); 238 274 unless ($success) { 239 275 print STDERR @$stderr_buf; … … 274 310 275 311 my $row = {}; 276 $row->{ra} = checkRA($vals[0], $linenumber); 277 $row->{dec} = checkDEC($vals[1], $linenumber); 278 $row->{filter} = checkFilter($vals[2], $filter, $linenumber); 279 $row->{mjd_min} = checkMJD($vals[3], $mjd_min, $linenumber);; 280 $row->{mjd_max} = checkMJD($vals[4], $mjd_max, $linenumber);; 312 $row->{rownum} = checkRownum($vals[0], $linenumber); 313 $row->{ra} = checkRA($vals[1], $linenumber); 314 $row->{dec} = checkDEC($vals[2], $linenumber); 315 $row->{filter} = checkFilter($vals[3], $filter, $linenumber); 316 $row->{mjd_min} = checkMJD($vals[4], $mjd_min, $linenumber);; 317 $row->{mjd_max} = checkMJD($vals[5], $mjd_max, $linenumber);; 281 318 $row->{comment} = $comment; 282 319 … … 305 342 my $linenumber = shift; 306 343 307 my $result;344 my $result; 308 345 if ($c =~ /\:/) { 309 346 # sexagesmial format not valid for pixel coordinates … … 329 366 } 330 367 368 sub checkRownum { 369 my $rownum = shift; 370 my $linenumber = shift; 371 die "rownum can not be null at $linenumber\n" unless defined $rownum; 372 373 # XXX: For now just check that rownum is defined and a single word 374 # extend this. Should we require a number? 375 my @words = split " ", $rownum; 376 die "$rownum is not a vaild rownum at $linenumber\n" unless (scalar @words) == 1; 377 } 378 331 379 sub checkRA { 332 380 my $ra = shift; … … 335 383 336 384 if ($ra =~ /\:/) { 385 # assume RA is in hours:minutes:seconds 337 386 return $checked * 360. / 24.; 338 387 } else { -
tags/ipp-20130307/pstamp/scripts/pstamp_finish.pl
r34447 r35489 107 107 my ($header, $rows) = read_request_file($req_file); 108 108 109 my $action = $header->{ACTION}; 110 111 if (!$header or (($action eq 'PROCESS') and !$rows)) { 109 if (!$header or !$rows) { 112 110 # Since a request got queued, the request file must have been readable at some point 113 111 my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR); … … 128 126 129 127 my $request_fault = 0; 130 if ($action eq 'PROCESS'){128 { 131 129 # The results table definition file 132 130 my ($tdf, $table_def_name) = tempfile ("$outdir/tabledef.XXXX", UNLINK => !$save_temps); … … 238 236 } else { 239 237 my_die("No reglist for successful job: $job_id", $req_id, $PS_EXIT_PROG_ERROR) 240 if $ fault eq $PSTAMP_SUCCESS;238 if $job->{state} eq 'stop' and $fault eq $PSTAMP_SUCCESS; 241 239 print STDERR "no reglist file for job $job_id\n" if $verbose; 242 240 print $tdf "$rownum|$fault|$error_string|0|$job_id|"; … … 273 271 } 274 272 } 275 } elsif ($action ne 'LIST') {276 my_die("Unexpected action $action found", $req_id, $PS_EXIT_PROG_ERROR);277 } else {278 # pstampparse did all of the work279 273 } 280 274 -
tags/ipp-20130307/pstamp/scripts/pstamp_job_run.pl
r33512 r35489 113 113 114 114 if ($stage eq "raw") { 115 # zap options that don't apply to raw stage 115 116 $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 116 117 } … … 136 137 $argString .= " -astrom $params->{astrom}"; 137 138 push @file_list, $params->{astrom}; 139 } 140 141 if ($options & $PSTAMP_SELECT_SOURCES) { 142 # Extract sources from astrometry file if provided. This will be the smf for chip stage 143 # or the skycal cmf for stacks 144 if ($params->{astrom}) { 145 $argString .= " -write_cmf"; 146 if ($stage eq 'stack') { 147 # Set psphot recipe to STACKPHOT so that the extended source paramters will 148 # be copied from the cmf file. 149 $argString .= " -recipe PSPHOT STACKPHOT" 150 } 151 } elsif ($params->{cmf}) { 152 $argString .= " -write_cmf"; 153 push @file_list, $params->{cmf}; 154 } else { 155 print "Could not find suitable sources file will not write cmf\n"; 156 } 138 157 } 139 158 … … 254 273 $PSTAMP_SELECT_MASK => "mk.fits", 255 274 $PSTAMP_SELECT_VARIANCE => "wt.fits", 275 $PSTAMP_SELECT_SOURCES => "cmf", 256 276 $PSTAMP_SELECT_JPEG => "jpg"); 257 277 258 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG );278 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES); 259 279 260 280 foreach my $key (keys (%extensions)) { … … 400 420 my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL); 401 421 my $cmf_file; 402 if ($stage ne 'chip') {403 # we don't ship chip stage cmf files because they may not be censored404 $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF);405 }422 # if ($stage ne 'chip') { 423 # # we don't ship chip stage cmf files because they may not be censored 424 # $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF); 425 # } 406 426 407 427 my $outdir = dirname($output_base); -
tags/ipp-20130307/pstamp/scripts/pstamp_parser_run.pl
r34232 r35489 158 158 my $request_fault = $PSTAMP_INVALID_REQUEST; 159 159 160 # default action is to process the request after parsing. This can be overridden by 161 # PREVIEW mode for pstamp requests 162 my $action = 'PROCESS'; 163 160 164 if (-r $uri) { 161 165 # run the appropriate parse command to parse the queue the jobs for this request 162 166 # first check the extension header to find the EXTNAME 163 $request_type = find_request_type($uri );167 $request_type = find_request_type($uri, \$action); 164 168 165 169 if ($request_type) { … … 240 244 241 245 if ($success) { 242 $newState = 'run'; 246 # XXX: This bit of the postage stamp request API has slipped in here because we need to control 247 # the new state of the request 248 if ($action eq 'PROCESS') { 249 $newState = 'run'; 250 } elsif ($action eq 'PREVIEW') { 251 $newState = 'parsed'; 252 } else { 253 print STDERR "WARNING Ignoring unexpected value for ACTION found in request header: $action\n"; 254 } 243 255 } else { 244 256 $fault = $error_code >> 8; … … 275 287 # find the EXTNAME in the input fits table 276 288 my $file_name = shift; 277 my $out = `echo $file_name | fields -x 0 EXTNAME`; 289 my $r_action = shift; 290 291 my $out = `echo $file_name | fields -x 0 EXTNAME ACTION`; 278 292 279 293 if ($out) { 280 294 # output from fields is filename value 281 my ($dummy, $extname) = split " ", $out; 295 my ($dummy, $extname, $action) = split " ", $out; 296 297 # Set the action if it is defined in the request header 298 # XXX:consider doing this only if extname is PS1_PS_REQUSET 299 $$r_action = $action if ($action); 282 300 283 301 return $extname; -
tags/ipp-20130307/pstamp/scripts/pstamp_request_file
r34447 r35489 18 18 $output, # Name of output table 19 19 $req_name, 20 $email, 20 21 $help 21 22 ); … … 25 26 'output|o=s' => \$output, 26 27 'req_name|r=s' => \$req_name, 27 'help|h' => \$help, 28 'email=s' => \$email, 29 'help|h' => \$help, 28 30 ) or pod2usage( 2 ); 29 31 … … 54 56 value => undef 55 57 }, 56 { name => 'USERNAME',57 writetype => TSTRING,58 comment => 'username for request (optional)',59 value => undef60 },58 # { name => 'USERNAME', 59 # writetype => TSTRING, 60 # comment => 'username for request (optional)', 61 # value => undef 62 # }, 61 63 { name => 'EMAIL', 62 64 writetype => TSTRING, … … 65 67 }, 66 68 ]; 69 70 my $email_column_num = 3; 67 71 68 72 # Specification of columns to write … … 97 101 { name => 'MJD_MIN', type => 'D', writetype => TDOUBLE }, 98 102 { name => 'MJD_MAX', type => 'D', writetype => TDOUBLE }, 103 # new in version 2 99 104 { name => 'RUN_TYPE', type => '16A', writetype => TSTRING }, 105 { name => 'FWHM_MIN', type => 'D', writetype => TDOUBLE }, 106 { name => 'FWHM_MAX', type => 'D', writetype => TDOUBLE }, 100 107 101 108 { name => 'COMMENT ', type => '64A', writetype => TSTRING }, … … 162 169 $req_name = $header->[0]->{value}; 163 170 } 171 if ($email) { 172 $header->[$email_column_num]->{value} = $email; 173 } 174 164 175 165 176 die "no request name defined" unless defined $req_name; … … 299 310 300 311 $$r_extver = $vals[1]; 301 if ($ extver > 1) {312 if ($$r_extver > 1) { 302 313 die "number of header columns in input $nvals does not equal expected number of header words $nhead" 303 314 if (@vals != @$header); … … 323 334 if ($$r_extver == 1) { 324 335 # pop off the colData arrays to account for the unused columns 336 pop @colData; 337 pop @colData; 325 338 pop @colData; 326 339 pop @colData; … … 346 359 } 347 360 # trim leading whitespace from comment 348 $comment =~ s/^\s+// ;361 $comment =~ s/^\s+// if $comment; 349 362 if ($comment) { 350 363 if ($comment =~ /#/) { -
tags/ipp-20130307/pstamp/scripts/pstamp_webrequest.pl
r35485 r35489 71 71 } 72 72 73 # make a request file73 # make the request file in a sub directory of the current directory 74 74 my $cur_dir = getcwd(); 75 75 76 76 #print STDERR "cur_dir is $cur_dir\n"; 77 77 78 # put file in directory for the current date 78 79 my $datestr = strftime "%Y/%m/%d", gmtime; 79 80 my $datedir = "$cur_dir/webreq/$datestr"; -
tags/ipp-20130307/pstamp/scripts/pstampparse.pl
r34447 r35489 27 27 my $outdir; 28 28 my $product; 29 my $label ;29 my $label = ""; 30 30 my $save_temps; 31 31 my $no_update; … … 57 57 die "outdir is required" if !$outdir; 58 58 die "product is required" if !$product; 59 } else { 60 $req_id = 0; 61 $outdir = "nowhere"; 62 $product = "dummy"; 59 63 } 60 64 … … 83 87 $pstamptool .= " -dbserver $dbserver" if $dbserver; 84 88 85 # list_job is a deugging mode 86 $no_update = 1 if $mode eq "list_job"; 89 # If $mode is not queue_job we are using a debugging mode 90 # do not update the database 91 $no_update = 1 if $mode ne "queue_job"; 87 92 88 93 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 89 94 90 95 # 91 # get the datafrom the extension header96 # Read the keywords from the extension header 92 97 # 93 98 my $fields_output; 94 99 { 95 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION USEREMAIL";100 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL"; 96 101 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 97 102 run(command => $command, verbose => $verbose); 98 # fields doesn't return zero when it succeeds 99 #unless ($success) { 100 # print STDERR @$stderr_buf; 101 #} 103 104 # note fields doesn't return zero when it succeeds. 102 105 $fields_output = join "", @$stdout_buf; 103 106 } 104 my (undef, $extname, $extver, $req_name, $action, $ username, $email) = split " ", $fields_output;107 my (undef, $extname, $extver, $req_name, $action, $email) = split " ", $fields_output; 105 108 106 109 # make sure the file contains what we are expecting 107 # This program shouldn't have been run if the request file is bogus. 108 # No need to notify the client 109 my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST"; 110 my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR) if (!$req_name); 111 my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2"); 112 110 # pstamp_parser_run.pl would not have run this program unless the request file was ok 111 my_die("$request_file_name does not contain EXTNAME\n", $PS_EXIT_PROG_ERROR) if !$extname; 112 my_die("$request_file_name is not a PS1_PS_REQUEST\n", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST"; 113 my_die("REQ_NAME not found in $request_file_name\n", $PS_EXIT_PROG_ERROR) if (!$req_name); 114 my_die("wrong EXTVER $extver found in $request_file_name\n", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2"); 115 116 if ($extver >= 2) { 117 # We have a version 2 file. Require that the new keywords be supplied. 118 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless defined $action; 119 120 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 121 122 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless $email; 123 # XXX check for "valid" $email 124 } else { 125 # for version 1 file the action is process and email is not used 126 $action = 'PROCESS'; 127 $email = 'null'; 128 } 129 130 print "Request Header Keywords EXTVER: $extver REQ_NAME: $req_name ACTION: $action EMAIL: $email\n"; 113 131 114 132 # check for duplicate request name … … 161 179 # the output data store's product name 162 180 my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name"; 181 $command .= " -set_username $email" if $email ne 'null'; 163 182 $command .= " -set_outProduct $product"; 164 183 $command .= " -set_label $label" if $label_changed; … … 174 193 175 194 # 176 # now convert the request table to an array of metadata config docs195 # now convert the request table to an array of metadatas 177 196 # 178 197 … … 191 210 my $dtime_request_file = gettimeofday() - $start_request_file; 192 211 print "Time to read and parse request file: $dtime_request_file\n"; 193 194 } 195 196 # 197 # Loop over rows in the request file collecting consecutive rows that have the "same images of interest" 198 # in the sense that their selection parameters will yield the same "Runs". 199 # Process the groups of rows together to reduce lookup time and to potentially make multiple 200 # stamps from the same ppstamp process. 201 # 202 my @rowList; 212 } 213 214 my $nRows = scalar @$rows; 215 print "\n$nRows rows read from request file\n"; 216 217 203 218 my $num_jobs = 0; 204 219 my $imageList; 205 220 my $stage; 206 my $need_magic;207 221 foreach my $row (@$rows) { 208 # santiy check the paramaters 222 223 if ($label eq 'WEB.UP' and ($nRows > 500 or $num_jobs > 500) and $req_id and !$no_update) { 224 # this is a big request and it came from the upload page and doesn't have a specific label assigned 225 # change it to the generic one that has lower with lower priority 226 $label = 'WEB.BIG'; 227 print "\nChanging label for big WEB.UP request to $label\n"; 228 229 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label"; 230 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 231 run(command => $command, verbose => $verbose); 232 unless ($success) { 233 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 234 } 235 } 236 237 # validate the paramaters 209 238 if (!checkRow($row)) { 210 239 # when it enconters an error checkRow adds a fake job with an appropriate error code to the database … … 216 245 $row->{error_code} = 0; 217 246 218 if (scalar @rowList == 0) { 219 push @rowList, $row; 220 next; 221 } 222 223 my $firstRow = $rowList[0]; 224 if (same_images_of_interest($firstRow, $row)) { 225 # add this row to the list and move on 226 push @rowList, $row; 227 next; 228 } 229 230 # the images of interest for this new row doesn't match the list. 231 # process the list ... 232 $num_jobs += processRows($action, \@rowList); 233 234 # and reset the list to contain just the new row 235 @rowList = ($row); 236 } 237 238 # out of rows process the list 239 if (scalar @rowList > 0) { 240 $num_jobs += processRows($action, \@rowList); 247 $num_jobs += processRow($action, $row); 241 248 } 242 249 … … 252 259 my $row = shift; 253 260 261 # check validity of the paramters in a request specification 254 262 # If we encounter an error for a particular row add a job with the proper fault code. 263 # also adjust some paramterers like filter and set defaults for some others 255 264 256 265 my $stage = $row->{IMG_TYPE}; … … 284 293 } 285 294 286 287 295 my $component = $row->{COMPONENT}; 288 296 if (!defined $component or (lc($component) eq "null") or (lc($component) eq "all")) { … … 314 322 return 0; 315 323 } 324 325 my $fwhm_min = $row->{FWHM_MIN}; 326 if (!defined $fwhm_min) { 327 $row->{FWHM_MIN} = 0; 328 } elsif (!validNumber($fwhm_min)) { 329 print STDERR "$fwhm_min is not a valid FWHM_MIN\n"; 330 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 331 return 0; 332 } 333 my $fwhm_max = $row->{FWHM_MAX}; 334 if (!defined $fwhm_max) { 335 $row->{FWHM_MAX} = 0; 336 } elsif (!validNumber($fwhm_max)) { 337 print STDERR "$fwhm_max is not a valid FWHM_MAX\n"; 338 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 339 return 0; 340 } 341 316 342 my $data_group = $row->{DATA_GROUP}; 317 343 if (!defined $data_group) { … … 334 360 335 361 my $wholefile = 0; 336 if (!$skycenter && $row->{CENTER_X} == 0 && $row->{CENTER_Y} == 0) { 362 if (($row->{WIDTH} == 0 && $row->{HEIGHT} == 0) || 363 (!$skycenter && $row->{CENTER_X} == 0 && $row->{CENTER_Y} == 0)) { 337 364 # Secret code for returning the whole file 338 365 $wholefile = 1; … … 362 389 return 0; 363 390 } 364 365 # $mode list_uri is a debugging mode (it may used by the http interface)366 # if this happens just croak367 # my_die("job_type is list_uri but mode is $mode", $PS_EXIT_PROG_ERROR) if ($job_type eq "list_uri") and ($mode ne "list_uri");368 369 391 370 392 if ($req_type eq "bycoord") { … … 384 406 } 385 407 408 386 409 return 1; 387 410 } … … 392 415 393 416 $num_jobs = 1; 417 return $num_jobs; 418 } 419 420 sub processRow { 421 my $action = shift; 422 my $row = shift; 423 424 my $num_jobs = 0; 425 426 my $project = $row->{PROJECT}; 427 428 # note: resolve_project avoids running pstamptool every time by remembering the 429 # last project resolved 430 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 431 if (!$proj_hash) { 432 insertFakeJobForRow($row, 1, $PSTAMP_UNKNOWN_PROJECT); 433 $num_jobs++; 434 return $num_jobs; 435 } 436 my $image_db = $proj_hash->{dbname}; 437 my $camera = $proj_hash->{camera}; 438 439 my $req_type = $row->{REQ_TYPE}; 440 my $rownum = $row->{ROWNUM}; 441 442 # Since user can get unmagicked data "by coordinate" requests can go back in time 443 # to dredge unusable data from the "dark days"... 444 if ($req_type eq 'bycoord' and $row->{IMG_TYPE} ne 'stack' and $row->{MJD_MIN} == 0) { 445 # ... so unless the user sets mjd_min clamp it to 2009-04-01 446 # XXX: This value should live in the pstampProject table not be hardcoded here 447 $row->{MJD_MIN} = 54922; 448 } 449 450 if (($req_type eq 'byskycell') or ($req_type eq 'bycoord')) { 451 # avoid error from print below if $id isn't needed 452 $row->{ID} = "" if !$row->{ID}; 453 } 454 455 # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this 456 # request specification. An array reference is returned. 457 my $start_locate = gettimeofday(); 458 459 print "\nCalling new_locate_images for row: $rownum\n"; 460 461 $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose); 462 463 my $dtime_locate = gettimeofday() - $start_locate; 464 print "Time to locate_images for row $rownum $dtime_locate\n"; 465 466 my @rowList = ($row); 467 $num_jobs += queueJobs($action, \@rowList, $imageList); 468 469 # if this row slipped through without a job being added add one. 470 if ($row->{job_num} == 0) { 471 print "row $row->{ROWNUM} produced no jobs\n"; 472 print STDERR "row $row->{ROWNUM} produced no jobs\n"; 473 my $error_code = $row->{error_code}; 474 $error_code = $PSTAMP_NO_IMAGE_MATCH if !$error_code; 475 insertFakeJobForRow($row, ++$row->{job_num}, $error_code); 476 } 477 394 478 return $num_jobs; 395 479 } … … 401 485 402 486 if ($action eq 'LIST') { 487 # LIST is not allowed by caller. Can't get here. 403 488 return list_targets($rowList); 404 489 } … … 420 505 } 421 506 my $req_type = $row->{REQ_TYPE}; 422 $stage= $row->{IMG_TYPE};507 my $stage = $row->{IMG_TYPE}; 423 508 my $id = $row->{ID}; 424 509 my $component = $row->{COMPONENT}; … … 436 521 my $image_db = $proj_hash->{dbname}; 437 522 my $camera = $proj_hash->{camera}; 438 $need_magic = $proj_hash->{need_magic};523 my $need_magic = $proj_hash->{need_magic}; 439 524 # Since user can get unmagicked data "by coordinate" requests can go back in time 440 525 # to dredge unusable data from the "dark days"... … … 496 581 # information required is contained there 497 582 498 $imageList = locate_images($ipprc, $image_db, \@rowList, $req_type, $stage, $id, $tess_id, $component,583 $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component, 499 584 $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose); 500 585 … … 506 591 $row->{need_magic} = $need_magic; 507 592 508 $num_jobs += queueJobs($ mode, \@rowList, $imageList);593 $num_jobs += queueJobs($action, $rowList, $imageList); 509 594 510 595 # if a row slipped through with no jobs add a faulted one 511 foreach my $row (@ rowList) {596 foreach my $row (@$rowList) { 512 597 if ($row->{job_num} == 0) { 513 598 print "row $row->{ROWNUM} produced no jobs\n"; … … 528 613 my $image = shift; 529 614 my $need_magic = shift; 530 my $ mode= shift;615 my $action = shift; 531 616 532 617 my $rownum = $row->{ROWNUM}; … … 544 629 my $h = $row->{HEIGHT}; 545 630 my $coord_mask = $row->{COORD_MASK}; 631 546 632 my $wholeFile = 0; 547 if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) { 548 # Center of 0, 0 in pixel coordinates is interpreted to mean 549 # return the entire file 550 if ($x == 0 && $y == 0) { 551 $roi_string = "-wholefile"; 552 $wholeFile = 1; 633 # For historical reasons there are two ways to specify that the entire file be returned 634 # rather than a postage stamp ... 635 if ($w == 0 and $h == 0) { 636 # ... The right way: width and height both zero ... 637 $wholeFile = 1; 638 } else { 639 if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) { 640 if ($x == 0 && $y == 0) { 641 # ... and pixel coordinate center of 0, 0 642 # I made this one up without thinking through the API clearly. 643 # allowing width and height to do it works much better 644 $wholeFile = 1; 645 } else { 646 $roi_string = "-pixcenter $x $y"; 647 } 553 648 } else { 554 $roi_string = "-pixcenter $x $y"; 555 } 649 $roi_string = "-skycenter $x $y"; 650 } 651 } 652 653 if ($wholeFile) { 654 $roi_string = "-wholefile"; 655 } elsif ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) { 656 $roi_string .= " -pixrange $w $h"; 556 657 } else { 557 $roi_string = "-skycenter $x $y";558 }559 if (!$wholeFile) {560 if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) {561 $roi_string .= " -pixrange $w $h";562 } else {563 658 $roi_string .= " -arcrange $w $h"; 564 }565 659 } 566 660 … … 611 705 write_params($output_base, $image); 612 706 613 my $newState = "run";707 my $newState = $action eq 'PROCESS' ? "run" : "parsed"; 614 708 my $fault = 0; 615 709 my $dep_id; 616 710 617 queueUpdatesIfNeeded($ stage, $image, $option_mask, \$newState, \$fault, \$dep_id);711 queueUpdatesIfNeeded($action, $stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 618 712 619 713 my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}" … … 644 738 sub queueJobs 645 739 { 646 my $ mode= shift;740 my $action = shift; 647 741 my $rowList = shift; 648 742 my $imageList = shift; 649 743 650 my $firstRow = $rowList [0];744 my $firstRow = $rowList->[0]; 651 745 my $stage = $firstRow->{IMG_TYPE}; 652 746 my $job_type = $firstRow->{JOB_TYPE}; … … 656 750 657 751 if ($mode eq "list_uri") { 752 $num_jobs = $imageList ? scalar @$imageList : 0; 753 print "List of $num_jobs Images selected for row: $firstRow->{ROWNUM}\n"; 658 754 foreach my $image (@$imageList) { 659 755 print "$image->{image}\n"; 756 ++$firstRow->{job_num}; 660 757 } 661 758 } elsif ($job_type eq "get_image") { … … 664 761 my_die( "error: unexpected number of rows for get_image request: $n", $PS_EXIT_PROG_ERROR) if $n != 1; 665 762 666 $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $ mode);763 $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $action); 667 764 668 765 } else { … … 692 789 my $row = $rowList->[$i]; 693 790 694 $num_jobs += queueJobForImage($row, $stage, $image, $need_magic, $ mode);791 $num_jobs += queueJobForImage($row, $stage, $image, $need_magic, $action); 695 792 } 696 793 } … … 706 803 my $stage = shift; 707 804 my $need_magic = shift; 708 my $ mode= shift;805 my $action = shift; 709 806 710 807 my $num_jobs = 0; … … 753 850 write_params($output_base, $image); 754 851 755 my $newState = "run";852 my $newState = $action eq 'PROCESS' ? "run" : "parsed"; 756 853 my $fault = 0; 757 854 my $dep_id; 758 855 759 queueUpdatesIfNeeded($ stage, $image, $option_mask, \$newState, \$fault, \$dep_id);856 queueUpdatesIfNeeded($action, $stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 760 857 761 858 $num_jobs++; … … 899 996 sub get_dependent 900 997 { 901 my ($ r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_;998 my ($action, $r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_; 902 999 903 1000 # chipRun's can be in full state if destreaking is necessary … … 918 1015 my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb -component $component -outdir $outdir"; 919 1016 $command .= " -need_magic" if $need_magic; 920 921 # compute rlabel for the run. 922 # XXX: This bit of policy shouldn't be buried so deeply in the code 923 # For now use one that implies 'postage stamp server' 'update' 'request_label" 924 my $rlabel = "ps_ud_" . $label if $label; 925 $command .= " -rlabel $rlabel" if $rlabel; 1017 $command .= ' -hold' if $action eq 'PREVIEW'; 1018 1019 if ($label) { 1020 # compute rlabel for the run. 1021 # XXX: This bit of policy shouldn't be buried so deeply in the code 1022 # For now use one that implies 'postage stamp server' 'update' 'request_label" 1023 my $rlabel = "ps_ud_" . $label; 1024 $command .= " -rlabel $rlabel"; 1025 } 926 1026 927 1027 if (!$no_update) { … … 931 1031 my $fault = $error_code >> 8; 932 1032 print STDERR "$command failed with fault $fault\n"; 933 if ($fault < 10) {1033 if ($fault < $PSTAMP_FIRST_ERROR_CODE) { 934 1034 # pstamptool returns an error if an existing depenent is faulted 935 # Set the object to not available even if the fault < 101035 # Set the object to not available even if the fault < $PSTAMP_FIRST_ERROR_CODE 936 1036 # which is nominally a recoverable error in order to keep 937 1037 # the request from faulting (which can be very expensive if … … 939 1039 $fault = $PSTAMP_NOT_AVAILABLE 940 1040 } 941 if ($fault >= 10) {1041 if ($fault >= $PSTAMP_FIRST_ERROR_CODE) { 942 1042 $$r_dep_id = 0; 943 1043 $$r_fault = $fault; … … 967 1067 968 1068 sub queueUpdatesIfNeeded { 1069 my $action = shift; 969 1070 my $stage = shift; 970 1071 my $image = shift; … … 973 1074 my $r_fault = shift; 974 1075 my $r_dep_id = shift; 1076 1077 my $need_magic = 0; 975 1078 976 1079 if ($stage ne 'raw') { … … 1016 1119 # set up to queue an update run 1017 1120 my $require_magic = ($need_magic or $image->{magicked}); 1018 get_dependent( \$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb},1121 get_dependent($action, \$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb}, 1019 1122 $run_state, $stage, $image->{stage_id}, $image->{component}, $require_magic ); 1020 1123 } … … 1070 1173 my $fault = shift; 1071 1174 1072 carp$msg;1175 print STDERR $msg; 1073 1176 1074 1177 # we don't fault the request here pstamp_parser_run.pl handles that if necessary -
tags/ipp-20130307/pstamp/src/ppstampParseCamera.c
r34596 r35489 95 95 } 96 96 97 98 // XXX: create a filerule for PPSTAMP.ASTROM99 97 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 100 98 if (!status) { … … 103 101 } 104 102 if (astrom) { 105 psLogMsg ("ppstamp", 3, " using supplied astrometry\n");103 psLogMsg ("ppstamp", 3, "Using supplied astrometry.\n"); 106 104 } else { 107 psLogMsg ("ppstamp", 3, " using header astrometry\n");105 psLogMsg ("ppstamp", 3, "Using header astrometry.\n"); 108 106 } 109 110 #ifdef notyet111 // add recipe options supplied on command line112 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, RECIPE_NAME);113 #endif114 107 115 108 // Set up the output target … … 138 131 } 139 132 } else { 140 psLogMsg ("ppstamp", PS_LOG_INFO, "output sources file requested but no input supplied. Will try the supplied astrometry file.\n"); 133 psLogMsg ("ppstamp", PS_LOG_INFO, "Output sources file requested but no -sources supplied.\n"); 134 psLogMsg ("ppstamp", PS_LOG_INFO, "Will use the sources in the supplied astrometry file.\n"); 141 135 } 142 136 -
tags/ipp-20130307/pstamp/src/pstampdump.c
r27259 r35489 94 94 if (!strcmp(extname, "PS1_PS_REQUEST")) { 95 95 psString extver = psMetadataLookupStr(NULL, header, "EXTVER"); 96 psString action = psMetadataLookupStr(NULL, header, "ACTION"); 97 psString email = psMetadataLookupStr(NULL, header, "EMAIL"); 96 98 if (!extver) { 97 99 // work around bug in MOPS request files … … 105 107 } 106 108 } 107 printf("%s %s %s\n", extname, extver, req_name); 109 if (!strcmp(extver, "1")) { 110 printf("%s %s %s\n", extname, extver, req_name); 111 } else { 112 if (!action) { 113 psErrorStackPrint(stderr, "failed to find action in fits header of: %s\n", fileName); 114 return PS_EXIT_DATA_ERROR; 115 } 116 if (!email) { 117 psErrorStackPrint(stderr, "failed to find action in fits header of: %s\n", email); 118 return PS_EXIT_DATA_ERROR; 119 } 120 printf("%s %s %s %s %s\n", extname, extver, req_name, action, email); 121 } 108 122 } else if (!strcmp(extname, "PS1_PS_RESULTS")) { 109 123 psS64 req_id = psMetadataLookupS64(NULL, header, "REQ_ID");
Note:
See TracChangeset
for help on using the changeset viewer.
