Changeset 35384
- Timestamp:
- Apr 9, 2013, 2:08:27 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (25 diffs)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (2 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r35315 r35384 15 15 our @EXPORT_OK = qw( 16 16 locate_images 17 new_locate_images 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 … … 56 57 my $rowList = shift; # required 57 58 my $req_type = shift; # required 58 my $ img_type = shift; # required59 my $stage = shift; # required 59 60 my $id = shift; # required unless req_type eq bycoord or byskycell 60 61 my $tess_id = shift; … … 78 79 ($req_type ne "byskycell"); 79 80 80 $default_data_groups = load_data_groups($verbose); 81 if (!$default_data_groups) { 82 $default_data_groups = load_data_groups($verbose); 83 } 81 84 82 85 my $dateobs_begin; … … 104 107 my $x = $row->{CENTER_X}; 105 108 my $y = $row->{CENTER_Y}; 106 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);109 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); 107 110 return $results; 108 111 } 109 112 110 if (($req_type eq "byid") and ($ img_type eq "diff")) {113 if (($req_type eq "byid") and ($stage eq "diff")) { 111 114 # lookups of all of the information for diff images requires a two level lookup to 112 115 # get the exposure information. Switching the req_type allows us to keep that code 113 116 # in one place 114 117 $req_type = "bydiff"; 115 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $ img_type, $verbose);118 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $stage, $verbose); 116 119 return $results; 117 120 } … … 120 123 # for bydiff reuqests we go look up the diffRun to obtain exp_id, chip_id, warp_id, stack_id, or 121 124 # the image from the diffRun 122 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $ img_type, $verbose);125 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $stage, $verbose); 123 126 if (!$results) { 124 127 return undef; 125 128 } 126 if ($ img_type eq "diff") {129 if ($stage eq "diff") { 127 130 # lookup_diff has done all of the work 128 131 return $results; … … 130 133 131 134 my $image = $results->[0]; 132 if ($ img_type eq "raw") {135 if ($stage eq "raw") { 133 136 $req_type = "byid"; 134 137 $id = $image->{exp_id}; 135 138 return undef if !$id; 136 139 # fall through and lookup byid 137 } elsif ($ img_type eq "chip") {140 } elsif ($stage eq "chip") { 138 141 $req_type = "byid"; 139 142 $id = $image->{chip_id}; 140 143 return undef if !$id; 141 144 # fall through and lookup byid 142 } elsif ($ img_type eq "warp") {145 } elsif ($stage eq "warp") { 143 146 $req_type = "byid"; 144 147 $id = $image->{warp_id}; … … 146 149 return undef if !$id; 147 150 # fall through and lookup by warp_id 148 } elsif ($ img_type eq "stack") {151 } elsif ($stage eq "stack") { 149 152 $req_type = "byid"; 150 153 $id = $image->{stack_id}; … … 153 156 } else { 154 157 # This is checked this elsewhere? 155 print STDERR "Error: $ img_type is an unknown image type\n";158 print STDERR "Error: $stage is an unknown image type\n"; 156 159 return undef; 157 160 } 158 161 } elsif ($req_type eq "byskycell") { 159 if (($ img_type eq "raw") or ($img_type eq "chip")) {162 if (($stage eq "raw") or ($stage eq "chip")) { 160 163 print STDERR "REQ_TYPE byskycell not supported for IMG_TYPE raw or chip\n"; 161 164 return undef; … … 167 170 } 168 171 169 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $ img_type, $id, $tess_id, $component,172 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 170 173 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 174 175 return $results; 176 } 177 178 sub new_locate_images { 179 my $ipprc = shift; 180 my $imagedb = shift; 181 my $camera = shift; 182 my $row = shift; 183 my $verbose = shift; 184 185 my $req_type = $row->{REQ_TYPE}; 186 187 # we die in response to bad data in request files 188 # The caller is responsible for updating the database 189 # pstampparse.pl error checks now so this shouldn't happen 190 &my_die("Unknown req_type: $req_type", $PS_EXIT_PROG_ERROR) 191 if ($req_type ne "byid") and 192 ($req_type ne "byexp") and 193 ($req_type ne "bycoord") and 194 ($req_type ne "bydiff") and 195 ($req_type ne "byskycell"); 196 197 if (!$default_data_groups) { 198 $default_data_groups = load_data_groups($verbose); 199 } 200 201 my $stage = $row->{IMG_TYPE}; 202 my $id = $row->{ID}; 203 my $component = $row->{COMPONENT}; 204 my $tess_id = $row->{TESS_ID}; 205 206 my $filter = $row->{REQFILT}; 207 my $mjd_min = $row->{MJD_MIN}; 208 my $mjd_max = $row->{MJD_MAX}; 209 my $data_group = $row->{DATA_GROUP}; 210 211 my $rownum = $row->{ROWNUM}; 212 my $job_type = $row->{JOB_TYPE}; 213 my $option_mask= $row->{OPTION_MASK}; 214 215 my $dateobs_begin; 216 my $dateobs_end; 217 if (!iszero($mjd_min)) { 218 $dateobs_begin = mjd_to_dateobs($mjd_min); 219 } 220 if (!iszero($mjd_max)) { 221 $dateobs_end = mjd_to_dateobs($mjd_max); 222 } 223 if (isnull($tess_id)) { 224 $tess_id = undef; 225 } 226 if (isnull($data_group)) { 227 $data_group = undef; 228 } 229 if (isnull($filter)) { 230 $filter = undef; 231 } 232 233 234 235 if ($req_type eq "bycoord") { 236 my $x = $row->{CENTER_X}; 237 my $y = $row->{CENTER_Y}; 238 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); 239 return $results; 240 } 241 242 # for compatability with the lower level functions 243 my $rowList = [$row]; 244 245 if (($req_type eq "byid") and ($stage eq "diff")) { 246 # lookups of all of the information for diff images requires a two level lookup to 247 # get the exposure information. Switching the req_type allows us to keep that code 248 # in one place 249 $req_type = "bydiff"; 250 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 1, $option_mask, $stage, $verbose); 251 return $results; 252 } 253 254 if ($req_type eq "bydiff") { 255 # for bydiff reuqests we go look up the diffRun to obtain exp_id, chip_id, warp_id, stack_id, or 256 # the image from the diffRun 257 my $results = lookup_diff($ipprc, $rowList, $imagedb, $id, $component, 0, $option_mask, $stage, $verbose); 258 if (!$results) { 259 return undef; 260 } 261 if ($stage eq "diff") { 262 # lookup_diff has done all of the work 263 return $results; 264 } 265 266 my $image = $results->[0]; 267 if ($stage eq "raw") { 268 $req_type = "byid"; 269 $id = $image->{exp_id}; 270 return undef if !$id; 271 # fall through and lookup byid 272 } elsif ($stage eq "chip") { 273 $req_type = "byid"; 274 $id = $image->{chip_id}; 275 return undef if !$id; 276 # fall through and lookup byid 277 } elsif ($stage eq "warp") { 278 $req_type = "byid"; 279 $id = $image->{warp_id}; 280 $component = $image->{skycell_id}; 281 return undef if !$id; 282 # fall through and lookup by warp_id 283 } elsif ($stage eq "stack") { 284 $req_type = "byid"; 285 $id = $image->{stack_id}; 286 return undef if !$id; 287 # fall though and lookup by stack_id 288 } else { 289 # This is checked this elsewhere? 290 print STDERR "Error: $stage is an unknown image type\n"; 291 return undef; 292 } 293 } elsif ($req_type eq "byskycell") { 294 if (($stage eq "raw") or ($stage eq "chip")) { 295 print STDERR "REQ_TYPE byskycell not supported for IMG_TYPE raw or chip\n"; 296 return undef; 297 } 298 if (!$tess_id or !$component) { 299 print STDERR "component and tess_id are required for REQ_TYPE byskycell\n"; 300 return undef; 301 } 302 } 303 304 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 305 0, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 171 306 172 307 return $results; … … 505 640 my $byid = shift; 506 641 my $option_mask = shift; 507 my $ img_type = shift;642 my $stage = shift; 508 643 my $verbose = shift; 509 644 … … 573 708 # we have a stack - stack diff (well it might be stack - warp....) 574 709 # but at any rate we only handle image type diff and stack 575 if (($ img_type ne "diff") and ($img_type ne "stack")) {576 print STDERR "lookup_diff: cannot lookup IMG_TYPE $ img_type bydiff from a stack stack diff run\n";710 if (($stage ne "diff") and ($stage ne "stack")) { 711 print STDERR "lookup_diff: cannot lookup IMG_TYPE $stage bydiff from a stack stack diff run\n"; 577 712 setErrorCodes($rowList, $PSTAMP_INVALID_REQUEST); 578 713 # all images will be the same so we can stop … … 625 760 } 626 761 627 if ($ img_type eq "diff") {762 if ($stage eq "diff") { 628 763 my @imageList = ($image); 629 764 … … 656 791 sub lookup_bycoord { 657 792 my $ipprc = shift; 658 my $row List= shift;793 my $row = shift; 659 794 my $imagedb = shift; 660 my $ img_type= shift;795 my $stage = shift; 661 796 my $tess_id = shift; 662 797 my $component = shift; … … 673 808 my $verbose = shift; 674 809 810 my ($release_name, $survey) = get_release($row); 811 812 my $rowList = [$row]; 813 675 814 my $results = (); 676 if (($ img_type eq "raw") or ($img_type eq "chip")) {677 678 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $ img_type,679 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose );815 if (($stage eq "raw") or ($stage eq "chip")) { 816 817 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $stage, 818 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose, $release_name, $survey, $row->{FWHM_MIN}, $row->{FWHM_MAX}); 680 819 681 820 if (!$chips or scalar @$chips == 0) { … … 684 823 foreach my $chip (@$chips) { 685 824 next if $component and ($chip->{component} ne $component); 686 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $ img_type, $chip->{id},825 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $stage, $chip->{id}, 687 826 $tess_id, $chip->{component}, $need_magic, 688 827 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); … … 695 834 } else { 696 835 # this should have been checked elsewhere 697 die "unexpected image type $ img_type" if ($img_type ne "warp")698 and ($ img_type ne "stack") and ($img_type ne "diff");836 die "unexpected image type $stage" if ($stage ne "warp") 837 and ($stage ne "stack") and ($stage ne "diff"); 699 838 700 839 my $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); … … 704 843 } else { 705 844 foreach my $skycell (@$skycells) { 706 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $ img_type, undef,845 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $stage, undef, 707 846 $skycell->{tess_id}, $skycell->{component}, $need_magic, 708 847 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); … … 722 861 723 862 sub lookup_by_cam_id_and_coords { 724 my $ipprc = shift;725 my $imagedb = shift;726 my $ img_type= shift;727 my $ra = shift;728 my $dec = shift;729 my $need_magic = shift;863 my $ipprc = shift; 864 my $imagedb = shift; 865 my $stage = shift; 866 my $ra = shift; 867 my $dec = shift; 868 my $need_magic = shift; 730 869 my $dateobs_begin = shift; 731 870 my $dateobs_end = shift; … … 733 872 my $data_group = shift; 734 873 my $verbose = shift; 735 736 my $camruns; 737 738 { 739 my $search_radius = 1.6; # XXX: this should be camera specific 740 874 my $release_name = shift; 875 my $survey = shift; 876 my $fwhm_min = shift; 877 my $fwhm_max = shift; 878 879 my $search_radius = 1.6; # XXX: this should be camera specific 880 881 my $command; 882 my $using_camtool = 0; 883 if ($release_name or $survey) { 884 my $command = "$releasetool -dbname $imagedb -listrelexp"; 885 if ($survey) { 886 $command .= " -survey_name $survey"; 887 } 888 if ($release_name) { 889 $command .= " -release_name $release_name"; 890 } else { 891 $command .= " -priority_order"; 892 } 893 if ($fwhm_min != 0) { 894 $command .= " -fwhm_min $fwhm_min"; 895 } 896 if ($fwhm_max != 0) { 897 $command .= " -fwhm_max $fwhm_max"; 898 } 899 } else { 900 $using_camtool = 1; 741 901 my $command = "$camtool -dbname $imagedb -processedexp -pstamp_order"; 742 $command .= " -ra $ra -decl $dec -radius $search_radius";743 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin;744 $command .= " -dateobs_end $dateobs_end" if $dateobs_end ;745 $command .= " -filter $filter" if $filter;746 902 # NOTE: we are applying the data_group to the camera run. 747 903 # If we're looking for chip stage images there is no guarentee that … … 755 911 } 756 912 $command .= " -destreaked" if $need_magic; 757 758 # run the tool and parse the output 759 $camruns = runToolAndParse($command, $verbose); 760 } 761 if (!$camruns) { 913 } 914 $command .= " -ra $ra -decl $dec -radius $search_radius"; 915 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin; 916 $command .= " -dateobs_end $dateobs_end" if $dateobs_end ; 917 $command .= " -filter $filter" if $filter; 918 919 # run the tool and parse the output 920 my $results = runToolAndParse($command, $verbose); 921 if (!$results) { 762 922 return undef; 763 923 } 764 924 my $components; 765 925 my $last_exp_id = 0; 766 foreach my $camRun (@$camruns) { 767 my $cam_id = $camRun->{cam_id}; 768 my $exp_id = $camRun->{exp_id}; 769 926 foreach my $result (@$results) { 927 my $cam_id = $result->{cam_id}; 928 my $exp_id = $result->{exp_id}; 929 930 # go on if we already have a result for this exposure 770 931 next if $exp_id eq $last_exp_id; 771 932 772 next if $camRun->{quality}; 773 next if $camRun->{fault}; 774 775 updateCamRunCache($camRun); 933 next if $result->{quality}; 934 935 if ($using_camtool) { 936 next if $result->{fault}; 937 updateCamRunCache($result); 938 } 776 939 777 940 $last_exp_id = $exp_id; 778 941 779 942 # XXX Use file rule 780 my $astrom = $ camRun->{path_base} . ".smf";943 my $astrom = $result->{path_base} . ".smf"; 781 944 my $astrom_resolved = $ipprc->file_resolve($astrom); 782 945 next if !$astrom_resolved; … … 832 995 } 833 996 834 print "cam_id $cam_id exp_id $ camRun->{exp_id} chip_id $camRun->{chip_id} $class_id\n";997 print "cam_id $cam_id exp_id $result->{exp_id} chip_id $result->{chip_id} $class_id\n"; 835 998 836 999 # build the hash to return … … 840 1003 # problem 841 1004 my $comp = { 842 exp_id => $ camRun->{exp_id},843 exp_name => $ camRun->{exp_name},844 chip_id => $ camRun->{chip_id},845 cam_id => $ camRun->{cam_id},1005 exp_id => $result->{exp_id}, 1006 exp_name => $result->{exp_name}, 1007 chip_id => $result->{chip_id}, 1008 cam_id => $result->{cam_id}, 846 1009 class_id => $class_id, 847 1010 component => $class_id 848 1011 }; 849 if ($ img_type eq "chip") {850 $comp->{id} = $ camRun->{chip_id};851 $comp->{state} = $ camRun->{chip_state};852 $comp->{magicked} = $camRun->{chip_magicked};853 } else { 854 $comp->{id} = $ camRun->{exp_id};1012 if ($stage eq "chip") { 1013 $comp->{id} = $result->{chip_id}; 1014 $comp->{state} = $result->{chip_state}; 1015 $comp->{magicked} = 0; 1016 } else { 1017 $comp->{id} = $result->{exp_id}; 855 1018 $comp->{state} = 'full'; 856 $comp->{magicked} = $ camRun->{raw_magicked};1019 $comp->{magicked} = $0; 857 1020 } 858 1021 push @$components, $comp; … … 1407 1570 $dvoImagesAtCoords = can_run('dvoImagesAtCoords') or (warn "Can't find dvoImagesAtCoords" 1408 1571 and $missing_tools = 1); 1572 $releasetool = can_run('releasetool') or (warn "Can't find releasetool" 1573 and $missing_tools = 1); 1409 1574 $whichimage = can_run('whichimage') or (warn "Can't find whichimage" and $missing_tools = 1); 1410 1575 $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); … … 1462 1627 } 1463 1628 1629 sub get_release { 1630 my $row = shift; 1631 1632 my $survey; 1633 my $release_name = $row->{IPP_RELEASE}; 1634 if (!isnull($release_name)) { 1635 # no release check for survey 1636 $survey = $row->{SURVEY_NAME}; 1637 } 1638 1639 return ($release_name, $survey); 1640 } 1641 1464 1642 sub my_die 1465 1643 { -
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r35364 r35384 52 52 $PSTAMP_NO_OVERLAP 53 53 $PSTAMP_NOT_AUTHORIZED 54 $PSTAMP_UNKNOWN_PROJECT 54 55 ); 55 56 our %EXPORT_TAGS = (standard => [@EXPORT_OK]); … … 101 102 our $PSTAMP_NO_OVERLAP = 28; 102 103 our $PSTAMP_NOT_AUTHORIZED = 29; 104 our $PSTAMP_UNKNOWN_PROJECT = 22; 103 105 104 106 -
trunk/pstamp/scripts/pstampparse.pl
r35380 r35384 211 211 print "\n$nRows rows read from request file\n"; 212 212 213 # If this is a big request and it came from the upload page and doesn't have a specific label assigned 214 # change it to the generic one that has lower with lower priority 215 216 # 217 # Loop over rows in the request file collecting consecutive rows that have the "same images of interest" 218 # in the sense that their selection parameters will yield the same target "Runs". 219 # Process the groups of rows together to reduce lookup time and to potentially make multiple 220 # stamps from the same ppstamp process. 221 222 my @rowList; 213 223 214 my $num_jobs = 0; 224 215 my $imageList; 225 216 my $stage; 226 my $need_magic;227 217 foreach my $row (@$rows) { 218 228 219 if ($label eq 'WEB.UP' and ($nRows > 500 or $num_jobs > 500) and $req_id and !$no_update) { 220 # this is a big request and it came from the upload page and doesn't have a specific label assigned 221 # change it to the generic one that has lower with lower priority 229 222 $label = 'WEB.BIG'; 230 223 print "\nChanging label for big WEB.UP request to $label\n"; … … 237 230 } 238 231 } 239 # sanity check the paramaters 232 233 # validate the paramaters 240 234 if (!checkRow($row)) { 241 235 # when it enconters an error checkRow adds a fake job with an appropriate error code to the database … … 247 241 $row->{error_code} = 0; 248 242 249 if (scalar @rowList == 0) { 250 push @rowList, $row; 251 next; 252 } 253 254 my $firstRow = $rowList[0]; 255 if (same_images_of_interest($firstRow, $row)) { 256 # add this row to the list and move on 257 push @rowList, $row; 258 next; 259 } 260 261 # the images of interest for this new row doesn't match the list. 262 # process the list ... 263 $num_jobs += processRows($action, \@rowList); 264 265 # and reset the list to contain just the new row 266 @rowList = ($row); 267 } 268 269 # out of rows process the list 270 if (scalar @rowList > 0) { 271 $num_jobs += processRows($action, \@rowList); 243 $num_jobs += processRow($action, $row); 272 244 } 273 245 … … 283 255 my $row = shift; 284 256 257 # check validity of the paramters in a request specification 285 258 # If we encounter an error for a particular row add a job with the proper fault code. 259 # also adjust some paramterers like filter and set defaults for some others 286 260 287 261 my $stage = $row->{IMG_TYPE}; … … 315 289 } 316 290 317 318 291 my $component = $row->{COMPONENT}; 319 292 if (!defined $component or (lc($component) eq "null") or (lc($component) eq "all")) { … … 345 318 return 0; 346 319 } 320 321 my $fwhm_min = $row->{FWHM_MIN}; 322 if (!defined $fwhm_min) { 323 $row->{FWHM_MIN} = 0; 324 } elsif (!validNumber($fwhm_min)) { 325 print STDERR "$fwhm_min is not a valid FWHM_MIN\n"; 326 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 327 return 0; 328 } 329 my $fwhm_max = $row->{FWHM_MAX}; 330 if (!defined $fwhm_max) { 331 $row->{FWHM_MAX} = 0; 332 } elsif (!validNumber($fwhm_max)) { 333 print STDERR "$fwhm_max is not a valid FWHM_MAX\n"; 334 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 335 return 0; 336 } 337 347 338 my $data_group = $row->{DATA_GROUP}; 348 339 if (!defined $data_group) { … … 410 401 } 411 402 403 412 404 return 1; 413 405 } … … 418 410 419 411 $num_jobs = 1; 412 return $num_jobs; 413 } 414 415 sub processRow { 416 my $action = shift; 417 my $row = shift; 418 419 my $num_jobs = 0; 420 421 my $project = $row->{PROJECT}; 422 423 # note: resolve_project avoids running pstamptool every time by remembering the 424 # last project resolved 425 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 426 if (!$proj_hash) { 427 insertFakeJobForRow($row, 1, $PSTAMP_UNKNOWN_PROJECT); 428 $num_jobs++; 429 return $num_jobs; 430 } 431 my $image_db = $proj_hash->{dbname}; 432 my $camera = $proj_hash->{camera}; 433 434 my $req_type = $row->{REQ_TYPE}; 435 my $rownum = $row->{ROWNUM}; 436 437 # Since user can get unmagicked data "by coordinate" requests can go back in time 438 # to dredge unusable data from the "dark days"... 439 if ($req_type eq 'bycoord' and $row->{MJD_MIN} == 0) { 440 # ... so unless the user sets mjd_min clamp it to 2009-04-01 441 # XXX: This value should live in the pstampProject table not be hardcoded here 442 $row->{MJD_MIN} = 54922; 443 } 444 445 if (($req_type eq 'byskycell') or ($req_type eq 'bycoord')) { 446 # avoid error from print below if $id isn't needed 447 $row->{ID} = "" if !$row->{ID}; 448 } 449 450 # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this 451 # request specification. An array reference is returned. 452 my $start_locate = gettimeofday(); 453 454 print "\nCalling new_locate_images for row: $rownum\n"; 455 456 $imageList = new_locate_images($ipprc, $image_db, $camera, $row, $verbose); 457 458 my $dtime_locate = gettimeofday() - $start_locate; 459 print "Time to locate_images for row $rownum $dtime_locate\n"; 460 461 my @rowList = ($row); 462 $num_jobs += queueJobs($action, \@rowList, $imageList); 463 464 # if this row slipped through without a job being added add one. 465 if ($row->{job_num} == 0) { 466 print "row $row->{ROWNUM} produced no jobs\n"; 467 print STDERR "row $row->{ROWNUM} produced no jobs\n"; 468 my $error_code = $row->{error_code}; 469 $error_code = $PSTAMP_NO_IMAGE_MATCH if !$error_code; 470 insertFakeJobForRow($row, ++$row->{job_num}, $error_code); 471 } 472 420 473 return $num_jobs; 421 474 } … … 447 500 } 448 501 my $req_type = $row->{REQ_TYPE}; 449 $stage= $row->{IMG_TYPE};502 my $stage = $row->{IMG_TYPE}; 450 503 my $id = $row->{ID}; 451 504 my $component = $row->{COMPONENT}; … … 463 516 my $image_db = $proj_hash->{dbname}; 464 517 my $camera = $proj_hash->{camera}; 465 $need_magic = $proj_hash->{need_magic};518 my $need_magic = $proj_hash->{need_magic}; 466 519 # Since user can get unmagicked data "by coordinate" requests can go back in time 467 520 # to dredge unusable data from the "dark days"... … … 523 576 # information required is contained there 524 577 525 $imageList = locate_images($ipprc, $image_db, \@rowList, $req_type, $stage, $id, $tess_id, $component,578 $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component, 526 579 $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose); 527 580 … … 533 586 $row->{need_magic} = $need_magic; 534 587 535 $num_jobs += queueJobs($action, \@rowList, $imageList);588 $num_jobs += queueJobs($action, $rowList, $imageList); 536 589 537 590 # if a row slipped through with no jobs add a faulted one 538 foreach my $row (@ rowList) {591 foreach my $row (@$rowList) { 539 592 if ($row->{job_num} == 0) { 540 593 print "row $row->{ROWNUM} produced no jobs\n"; … … 675 728 my $imageList = shift; 676 729 677 my $firstRow = $rowList [0];730 my $firstRow = $rowList->[0]; 678 731 my $stage = $firstRow->{IMG_TYPE}; 679 732 my $job_type = $firstRow->{JOB_TYPE}; … … 1004 1057 my $r_fault = shift; 1005 1058 my $r_dep_id = shift; 1059 1060 my $need_magic = 0; 1006 1061 1007 1062 if ($stage ne 'raw') {
Note:
See TracChangeset
for help on using the changeset viewer.
