IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 9, 2013, 4:06:09 PM (13 years ago)
Author:
eugene
Message:

merge from trunk

Location:
branches/eam_branches/ipp-20130904/pstamp/scripts
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/pstamp/scripts

  • branches/eam_branches/ipp-20130904/pstamp/scripts/psmkreq

    r35438 r36192  
    177177$id = 0 if !$id;
    178178
    179 unless ($stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack') {
     179unless ($stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack'
     180    or $stage eq 'stack_summary') {
    180181    die "$stage is not a valid value for stage\n";
    181182}
     
    208209        $option_mask |= $PSTAMP_SELECT_PSF      if $psf;
    209210        $option_mask |= $PSTAMP_SELECT_BACKMDL  if $backmdl;
     211        $option_mask |= $PSTAMP_SELECT_UNCOMPRESSED   if $uncompressed;
    210212        $option_mask |= $PSTAMP_SELECT_UNCONV   if $unconvolved;
    211213        $option_mask |= $PSTAMP_USE_IMFILE_ID   if $use_imfile_id;
  • branches/eam_branches/ipp-20130904/pstamp/scripts/pstamp_checkdependent.pl

    r35937 r36192  
    304304            }
    305305            $queued_update = 1;
     306        } elsif ($chip->{state} eq 'cleaned' and $chip->{data_state} eq 'update') {
     307            # we've had a number of runs in this limbo state
     308
     309            my $command = "$chiptool -updaterun -set_state update -chip_id $chip_id";
     310            $command .= " -set_label $rlabel" if $rlabel;
     311
     312            if (!$no_update) {
     313                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     314                            run(command => $command, verbose => $verbose);
     315                unless ($success) {
     316                    my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR);
     317                }
     318            } else {
     319                print "skipping $command\n";
     320            }
     321            $queued_update = 1;
    306322        } elsif ($chip->{fault}) {
    307323            $fault_count++;
     
    460476            print "skipping $command\n";
    461477        }
     478    } elsif ($chips_ready and $skycell->{data_state} eq 'update' and $skycell->{state} ne 'update') {
     479        my $command = "$warptool -updaterun -warp_id $warp_id -set_state update";
     480        $command .= " -set_label $rlabel" if $rlabel;
     481
     482        if (!$no_update) {
     483            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     484                        run(command => $command, verbose => $verbose);
     485            unless ($success) {
     486                my_die("failed to change state of ${stage}Run $stage_id to update", $PS_EXIT_UNKNOWN_ERROR);
     487            }
     488        } else {
     489            print "skipping $command\n";
     490        }
     491
    462492    } elsif (scalar @chipsToUpdate > 0) {
    463493        my $fault = check_states_chip($chip_id, \@chipsToUpdate, $rlabel, $need_magic);
  • branches/eam_branches/ipp-20130904/pstamp/scripts/pstamp_job_run.pl

    r36059 r36192  
    236236                           $PSTAMP_SELECT_JPEG     => 'jpg',
    237237                           $PSTAMP_SELECT_EXP      => 'exp.fits',
    238                            $PSTAMP_SELECT_NUM      => 'num.fits');
     238                           $PSTAMP_SELECT_NUM      => 'num.fits',
     239                           $PSTAMP_SELECT_EXPJPEG  => 'exp.jpg',
     240                           $PSTAMP_SELECT_NUMJPEG  => 'num.jpg');
    239241
    240242        my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE
    241             | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES | $PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM);
     243            | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES
     244            | $PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM
     245            | $PSTAMP_SELECT_EXPJPEG | $PSTAMP_SELECT_NUMJPEG);
     246
    242247
    243248        foreach my $key (keys (%extensions)) {
     
    261266        close $F;
    262267        $jobStatus = $PS_EXIT_SUCCESS;
    263     } elsif ($exitStatus == $PSTAMP_NO_OVERLAP) {
    264         $jobStatus = $PSTAMP_NO_OVERLAP;
     268    } elsif ($exitStatus == $PSTAMP_NO_OVERLAP || $exitStatus == $PSTAMP_NO_VALID_PIXELS) {
     269        $jobStatus = $exitStatus;
    265270    } else {
    266271        my_die( "ppstamp failed with error code: $exitStatus", $job_id, $exitStatus);
     
    382387        my $backmdl_file = $params->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL);
    383388        my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL);
     389        my $filter = $params->{filter};
     390        $filter = ' ' if !$filter;
     391        $filter = substr $filter, 0, 1;
    384392        my $cmf_file;
    385393#        if ($stage ne 'chip') {
     
    394402            if (!$therest or !$rownum or !$jobnum);
    395403
    396         my $prefix = "${rownum}_${jobnum}_";
     404        # XXX: Here we are assuming the form of the output file names
     405        # if we change this in pstampparse we'll need to remember ....
     406        # (the last time I forgot)
     407        my $prefix = "${rownum}_${jobnum}_${filter}_";
    397408
    398409        if ($cmf_file) {
     
    573584    $params->{exp}    = $path_base . ".exp.b1.fits";
    574585    $params->{num}    = $path_base . ".num.b1.fits";
     586    $params->{expjpeg} = $path_base . ".exp.0.b1.jpeg";
     587    $params->{numjpeg} = $path_base . ".num.0.b1.jpeg";
    575588}
    576589
     
    632645        if (!myCopy("$outputBase.num.fits", $params->{num}, 'num', 0)) {
    633646            $options &= ~$PSTAMP_SELECT_NUM;
     647        }
     648    }
     649    if ($options & $PSTAMP_SELECT_EXPJPEG) {
     650        if (!myCopy("$outputBase.exp.jpg", $params->{expjpeg}, 'exp', 0)) {
     651            $options &= ~$PSTAMP_SELECT_EXPJPEG;
     652        }
     653    }
     654    if ($options & $PSTAMP_SELECT_NUMJPEG) {
     655        if (!myCopy("$outputBase.num.jpg", $params->{numjpeg}, 'num', 0)) {
     656            $options &= ~$PSTAMP_SELECT_NUMJPEG;
    634657        }
    635658    }
  • branches/eam_branches/ipp-20130904/pstamp/scripts/pstampparse.pl

    r36061 r36192  
    3131my $no_update;
    3232my $dest_requires_magic;
     33my $dump_params = 0;
    3334
    3435# set this to true to disable update processing
     
    4849    'save-temps'=>  \$save_temps,
    4950    'no-update' =>  \$no_update,
     51    'dump-params' => \$dump_params,
    5052);
    5153
     
    238240
    239241
     242# if label is for one of the high priority channels, watch for big requests
     243my $watch_for_big_requests = (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/));
     244
     245my $big_limit = 100;    # XXX: this should be in a configuration file somewhere not hard coded
     246
     247if ($watch_for_big_requests and $nRows > $big_limit) {
     248    $label = change_to_lower_priority_label($label);
     249    $watch_for_big_requests = 0;
     250}
    240251
    241252my $num_jobs = 0;
    242 my $imageList;
    243 my $stage;
    244 my $big_limit = 100;    # XXX: this should be in a configuration file some where
     253
    245254foreach my $row (@$rows) {
    246 
    247 
    248     if (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/) and ($nRows > $big_limit or $num_jobs > $big_limit)
    249         and $req_id and !$no_update) {
    250 
    251         # This is a "big" request and it came from one of the "high priority" channels
    252         # and doesn't have a specific label assigned.
    253         # Change the label to a value that its jobs run with lower priority.
    254 
    255         my $old_label = $label;
    256         $label = ($label =~ /WEB/) ? 'WEB.BIG' : 'PSI.BIG';
    257         print "\nChanging label for big $old_label request to $label\n";
    258 
    259         my $command = "$pstamptool -updatereq -req_id $req_id  -set_label $label";
    260         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    261             run(command => $command, verbose => $verbose);
    262         unless ($success) {
    263             my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
    264         }
    265     }
    266255
    267256    # validate the paramaters
     
    276265
    277266    $num_jobs += processRow($action, $row);
     267
     268    # see whether number of jobs limit for high priority request was exceeded
     269    if ($watch_for_big_requests and $num_jobs > $big_limit) {
     270        $label = change_to_lower_priority_label($label);
     271        $watch_for_big_requests = 0;
     272    }
    278273}
    279274
     
    286281
    287282exit 0;
     283
     284# end of main function
     285
     286sub change_to_lower_priority_label {
     287    my $label = shift;
     288    my $old_label = $label;
     289    $label = ($label =~ /WEB/) ? 'WEB.BIG' : 'PSI.BIG';
     290    print "\nChanging label for big $old_label request to $label\n";
     291
     292    my $command = "$pstamptool -updatereq -req_id $req_id  -set_label $label";
     293    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     294        run(command => $command, verbose => $verbose);
     295    unless ($success) {
     296        my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     297    }
     298    return $label;
     299}
    288300
    289301sub checkRow {
     
    494506    print "\nCalling locate_images_for_row for row: $rownum\n";
    495507
    496     $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);
     508    my $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);
    497509
    498510    my $dtime_locate = gettimeofday() - $start_locate;
     
    586598    # information required is contained there
    587599
    588     $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component,
     600    my $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component,
    589601                $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
    590602
     
    777789            print "$image->{image}\n";
    778790            ++$firstRow->{job_num};
     791            if ($dump_params) {
     792                my $rownum = $firstRow->{ROWNUM};
     793                my $jobnum = $firstRow->{job_num};
     794                my $filter = substr $image->{filter}, 0, 1;
     795                my $output_base = "${rownum}_${jobnum}_${filter}";
     796                write_params($output_base, $image);
     797            }
    779798        }
    780799    } elsif ($job_type eq "get_image") {
Note: See TracChangeset for help on using the changeset viewer.