IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35380


Ignore:
Timestamp:
Apr 9, 2013, 11:36:27 AM (13 years ago)
Author:
bills
Message:

if request with WEB.UP label has more than 500 rows or generates
more than 500 jobs, set label to WEB.BIG

File:
1 edited

Legend:

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

    r35364 r35380  
    189189
    190190#
    191 # now convert the request table to an array of metadata config docs
     191# now convert the request table to an array of metadatas
    192192#
    193193
     
    206206    my $dtime_request_file = gettimeofday() - $start_request_file;
    207207    print "Time to read and parse request file: $dtime_request_file\n";
    208 
    209 }
     208}
     209
     210my $nRows = scalar @$rows;
     211print "\n$nRows rows read from request file\n";
     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
    210215
    211216#
    212217# Loop over rows in the request file collecting consecutive rows that have the "same images of interest"
    213 # in the sense that their selection parameters will yield the same "Runs".
     218# in the sense that their selection parameters will yield the same target "Runs".
    214219# Process the groups of rows together to reduce lookup time and to potentially make multiple
    215220# stamps from the same ppstamp process.
    216 #
     221
    217222my @rowList;
    218223my $num_jobs = 0;
     
    221226my $need_magic;
    222227foreach my $row (@$rows) {
    223     # santiy check the paramaters
     228    if ($label eq 'WEB.UP' and ($nRows > 500 or $num_jobs > 500) and $req_id and !$no_update) {
     229        $label = 'WEB.BIG';
     230        print "\nChanging label for big WEB.UP request to $label\n";
     231
     232        my $command = "$pstamptool -updatereq -req_id $req_id  -set_label $label";
     233        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     234            run(command => $command, verbose => $verbose);
     235        unless ($success) {
     236            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     237        }
     238    }
     239    # sanity check the paramaters
    224240    if (!checkRow($row)) {
    225241        # when it enconters an error checkRow adds a fake job with an appropriate error code to the database
     
    931947    $command .= ' -hold' if $action eq 'PREVIEW';
    932948
    933     # compute rlabel for the run.
    934     # XXX: This bit of policy shouldn't be buried so deeply in the code
    935     # For now use one that implies 'postage stamp server' 'update' 'request_label"
    936     my $rlabel = "ps_ud_" . $label if $label;
    937     $command .= " -rlabel $rlabel" if $rlabel;
     949    if ($label) {
     950        # compute rlabel for the run.
     951        # XXX: This bit of policy shouldn't be buried so deeply in the code
     952        # For now use one that implies 'postage stamp server' 'update' 'request_label"
     953        my $rlabel = "ps_ud_" . $label;
     954        $command .= " -rlabel $rlabel";
     955    }
    938956
    939957    if (!$no_update) {
     
    943961            my $fault = $error_code >> 8;
    944962            print STDERR "$command failed with fault $fault\n";
    945             if ($fault < 10) {
     963            if ($fault < $PSTAMP_FIRST_ERROR_CODE) {
    946964                # pstamptool returns an error if an existing depenent is faulted
    947                 # Set the object to not available even if the fault < 10
     965                # Set the object to not available even if the fault < $PSTAMP_FIRST_ERROR_CODE
    948966                # which is nominally a recoverable error in order to keep
    949967                # the request from faulting (which can be very expensive if
     
    951969                $fault = $PSTAMP_NOT_AVAILABLE
    952970            }
    953             if ($fault >= 10) {
     971            if ($fault >= $PSTAMP_FIRST_ERROR_CODE) {
    954972                $$r_dep_id = 0;
    955973                $$r_fault = $fault;
Note: See TracChangeset for help on using the changeset viewer.