Changeset 25067
- Timestamp:
- Aug 13, 2009, 2:34:52 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstampparse.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstampparse.pl
r25058 r25067 146 146 # parameters that select the images of interest 147 147 my $project = $row->{PROJECT}; 148 my $req_type = $row->{REQ_TYPE};149 $stage = $row->{IMG_TYPE};150 my $id = $row->{ID};151 my $component = $row->{COMPONENT};152 153 my $filter = $row->{REQFILT};154 my $mjd_min = $row->{MJD_MIN};155 my $mjd_max = $row->{MJD_MAX};156 157 my $option_mask= $row->{OPTION_MASK};158 159 my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);160 161 my $search_component = (!defined($component) or ($component eq "null")) ? "" : $component;162 163 if (!$skycenter and !$search_component) {164 print STDERR "COMPONENT must be specified for pixel coordinate ROI\n" if $verbose;165 insertFakeJobForRow($row, 1, 45);166 $num_jobs++;167 next;168 }169 170 $search_component = "" if $search_component eq "all";171 172 if (($job_type eq "stamp") and ! validROI($row)) {173 print STDERR "invalid ROI for row $rownum\n" if $verbose;174 insertFakeJobForRow($row, 1, 46);175 $num_jobs++;176 next;177 }178 179 180 # $mode list_uri is a debugging mode (it may used by the http interface)181 # if this happens just croak182 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");183 148 184 149 # note: resolve_project avoids running pstamptool every time by remembering the … … 191 156 next; 192 157 } 158 my $req_type = $row->{REQ_TYPE}; 159 $stage = $row->{IMG_TYPE}; 160 my $id = $row->{ID}; 161 my $component = $row->{COMPONENT}; 162 163 my $filter = $row->{REQFILT}; 164 my $mjd_min = $row->{MJD_MIN}; 165 my $mjd_max = $row->{MJD_MAX}; 166 167 my $option_mask= $row->{OPTION_MASK}; 168 169 my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS); 170 171 my $search_component = (!defined($component) or ($component eq "null")) ? "" : $component; 172 173 if (!$skycenter and !$search_component) { 174 print STDERR "COMPONENT must be specified for pixel coordinate ROI\n" if $verbose; 175 insertFakeJobForRow($row, 1, 45); 176 $num_jobs++; 177 next; 178 } 179 180 $search_component = "" if $search_component eq "all"; 181 182 if (($job_type eq "stamp") and ! validROI($row)) { 183 print STDERR "invalid ROI for row $rownum\n" if $verbose; 184 insertFakeJobForRow($row, 1, 46); 185 $num_jobs++; 186 next; 187 } 188 189 190 # $mode list_uri is a debugging mode (it may used by the http interface) 191 # if this happens just croak 192 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"); 193 193 194 194 195 my $image_db = $proj_hash->{dbname}; … … 197 198 198 199 # collect rows with the same images of interest in a list so that they 199 # can be processed optimially200 # can be looked up together 200 201 if (@rowList) { 201 202 my $firstRow = $rowList[0]; 202 # if ($skycenter and same_images_of_interest($row, $firstRow)) { 203 if (same_images_of_interest($row, $firstRow)) { 203 # note order of these parameters matters 204 if (same_images_of_interest($firstRow, $row)) { 205 206 # add this row to the list and move on 204 207 push @rowList, $row; 205 # On to the next row 208 206 209 next; 210 207 211 } else { 208 # queue the jobs for this set of rows 212 # this row has different selectors 213 # queue the jobs for the ones we've collected 209 214 $num_jobs += queueJobs($mode, \@rowList, $imageList); 210 215 @rowList = (); … … 212 217 } 213 218 219 # look up images for the current row 214 220 if ($req_type eq "bycoord") { 215 221 if (!$skycenter) { … … 224 230 next; 225 231 } else { 226 # Call PS::IPP::PStamp::Job's locate_images subroutine to get the parameters for this227 # request specification. An array reference is returned.228 my ($x, $y);229 $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $search_component,232 # Call PS::IPP::PStamp::Job's locate_images subroutine to get the parameters for this 233 # request specification. An array reference is returned. 234 my ($x, $y); 235 $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $search_component, 230 236 $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose); 231 }232 233 237 if (!$imageList or !@$imageList) { 234 238 print STDERR "no matching images found for row $rownum\n" if $verbose; … … 241 245 if (@rowList) { 242 246 $num_jobs += queueJobs($mode, \@rowList, $imageList); 247 } 243 248 } 244 249 … … 247 252 insertFakeJobForRow(undef, 1, 41); 248 253 } 254 255 # PAU 256 249 257 exit 0; 250 258 … … 500 508 my $fault = shift; 501 509 502 my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}" 503 . " -rownum $row->{ROWNUM} -state stop -fault $fault"; 510 my ($job_type, $rownum); 511 if ($row) { 512 $job_type = $row->{JOB_TYPE}; 513 $rownum = $row->{ROWNUM}; 514 } else { 515 $job_type = "none"; 516 $rownum = 0; 517 } 518 519 my $command = "$pstamptool -addjob -req_id $req_id -job_type $job_type" 520 . " -rownum $rownum -state stop -fault $fault"; 504 521 $command .= " -dbname $dbname" if $dbname; 505 522 $command .= " -dbserver $dbserver" if $dbserver; … … 581 598 return 0 if !defined $r2->{COMPONENT} or ($r1->{COMPONENT} ne $r2->{COMPONENT}); 582 599 } elsif (defined($r2->{COMPONENT})) { 583 return 0; 600 # if first row has no component all of the images will be retrieved, so 601 # the fact that this row has a component is ok. Fall through to return 1 602 # return 0; 584 603 } 585 604
Note:
See TracChangeset
for help on using the changeset viewer.
