IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36460


Ignore:
Timestamp:
Jan 21, 2014, 11:27:59 AM (12 years ago)
Author:
bills
Message:

changes from trunk to fix some dependency checking problems
and to improve the code that lowers job priorities by changing labels for
big jobs

Location:
tags/ipp-20130712/pstamp/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20130712/pstamp/scripts/pstamp_checkdependent.pl

    r35934 r36460  
    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);
     
    529559            }
    530560            return $warp_status;
     561        } elsif ($warp->{quality} != 0) {
     562            print STDERR "input warp has quality error\n";
     563            faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE);
     564            return $PSTAMP_GONE;
    531565        }
    532566        # warps are ready fall through and queue the diff update
  • tags/ipp-20130712/pstamp/scripts/pstampparse.pl

    r36122 r36460  
    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     if (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/)  and
    248         ($nRows > 200 or $num_jobs > 200) and $req_id and !$no_update) {
    249         # This is a "big" request and it came from one of the "high priority"
    250         # channels and doesn't have a specific label assigned.
    251         # Change the label to a value that its jobs run with lower priority.
    252         my $old_label = $label;
    253 
    254         print "\nChanging label for big request from $old_label to $label\n";
    255         $label = ($label =~ /WEB/) ? 'WEB.BIG' : 'PSI.BIG';
    256 
    257         my $command = "$pstamptool -updatereq -req_id $req_id  -set_label $label";
    258         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    259             run(command => $command, verbose => $verbose);
    260         unless ($success) {
    261             my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
    262         }
    263     }
    264255
    265256    # validate the paramaters
     
    274265
    275266    $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    }
    276273}
    277274
     
    284281
    285282exit 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}
    286300
    287301sub checkRow {
     
    492506    print "\nCalling locate_images_for_row for row: $rownum\n";
    493507
    494     $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);
     508    my $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);
    495509
    496510    my $dtime_locate = gettimeofday() - $start_locate;
     
    584598    # information required is contained there
    585599
    586     $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,
    587601                $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
    588602
     
    775789            print "$image->{image}\n";
    776790            ++$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            }
    777798        }
    778799    } elsif ($job_type eq "get_image") {
Note: See TracChangeset for help on using the changeset viewer.