IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25067


Ignore:
Timestamp:
Aug 13, 2009, 2:34:52 PM (17 years ago)
Author:
bills
Message:

resolve project first and fault if not defined
fix some indentation
if first row in a list has no component defined, allow them to match
subsequent rows that have a component defined but are otherwise
the same

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r25058 r25067  
    146146    # parameters that select the images of interest
    147147    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 croak
    182     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");
    183148
    184149    # note: resolve_project avoids running pstamptool every time by remembering the
     
    191156        next;
    192157    }
     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
    193194
    194195    my $image_db   = $proj_hash->{dbname};
     
    197198
    198199    # collect rows with the same images of interest in a list so that they
    199     # can be processed optimially
     200    # can be looked up together
    200201    if (@rowList) {
    201202        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
    204207            push @rowList, $row;
    205             # On to the next row
     208
    206209            next;
     210
    207211        } 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
    209214            $num_jobs += queueJobs($mode, \@rowList, $imageList);
    210215            @rowList = ();
     
    212217    }
    213218
     219    # look up images for the current row
    214220    if ($req_type eq "bycoord") {
    215221        if (!$skycenter) {
     
    224230        next;
    225231    } else {
    226             # Call PS::IPP::PStamp::Job's locate_images subroutine to get the parameters for this
    227             # 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,
    230236                $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
    231         }
    232 
    233237        if (!$imageList or !@$imageList) {
    234238            print STDERR "no matching images found for row $rownum\n" if $verbose;
     
    241245    if (@rowList) {
    242246        $num_jobs += queueJobs($mode, \@rowList, $imageList);
     247    }
    243248}
    244249
     
    247252    insertFakeJobForRow(undef, 1, 41);
    248253}
     254
     255# PAU
     256
    249257exit 0;
    250258
     
    500508    my $fault = shift;
    501509
    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";
    504521    $command .= " -dbname $dbname" if $dbname;
    505522    $command .= " -dbserver $dbserver" if $dbserver;
     
    581598        return 0 if !defined $r2->{COMPONENT} or ($r1->{COMPONENT} ne $r2->{COMPONENT});
    582599    } 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;
    584603    }
    585604
Note: See TracChangeset for help on using the changeset viewer.