IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2010, 2:11:08 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/czw_branch/20100427
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100427

  • branches/czw_branch/20100427/pstamp/scripts/pstampparse.pl

    r28017 r28031  
    521521    my $dep_id;
    522522
    523     # XXX: this code is repeated in queueGetImageJobs we should encapsulate it in a subroutine and share it
    524     if ($stage ne 'raw') {
    525         # updates for stack stage not supported yet
    526         my $allow_wait_for_update = ($stage ne 'stack');
    527         my $run_state = $image->{state};
    528         my $data_state = $image->{data_state};
    529         $data_state = $run_state if $stage eq 'stack';
    530         if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or
    531             ($run_state eq 'drop') or
    532             ($run_state eq 'error_cleaned') or ($data_state eq 'error_cleaned') or
    533             ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) {
    534             # image is gone and it's not coming back
    535             $newState = 'stop';
    536             $fault = $PSTAMP_GONE;
    537         } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) {
    538             if ($stage eq 'chip') {
    539                 my $burntool_state = $image->{burntool_state};
    540                 if ($burntool_state and (abs($burntool_state) < 14)) {
    541                     $newState = 'stop';
    542                     $fault = $PSTAMP_NOT_AVAILABLE;
    543                 }
    544             }
    545             if (!$allow_wait_for_update) {
    546                 print STDERR "wait for update not supported for stage $stage yet\n";
    547                 $newState = 'stop';
    548                 $fault = $PSTAMP_NOT_AVAILABLE;
    549             }
    550             if (!$fault) {
    551                 # wait for update unless the customer asks us not to
    552                 if (($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE)) {
    553                     $newState = 'stop';
    554                     $fault = $PSTAMP_NOT_AVAILABLE;
    555                 } elsif (!$image->{magicked}) {
    556                     $newState = 'stop';
    557                     $fault = $PSTAMP_NOT_DESTREAKED;
    558                 } else {
    559                     # cause the image to be re-made
    560                     # set up to queue an update run
    561                     queue_update_run(\$newState, \$fault, \$dep_id, $image->{imagedb},
    562                         $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic);
    563                 }
    564             }
    565         }
    566     }
     523    queueUpdatesIfNeeded($stage, $image, $option_mask, \$newState, \$fault, \$dep_id);
    567524
    568525    my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
     
    704661        my $dep_id;
    705662
    706         if ($stage ne 'raw') {
    707             my $run_state = $image->{state};
    708             my $data_state = $image->{data_state};
    709             $data_state = $run_state if $stage eq "stack";
    710             if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or
    711                 ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) {
    712                 # image is gone and it's not coming back
    713                 $newState = 'stop';
    714                 $fault = $PSTAMP_GONE;
    715             } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) {
    716                 # wait for update unless the customer asks us to not to
    717                 if ($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE) {
    718                     $newState = 'stop';
    719                     $fault = $PSTAMP_NOT_AVAILABLE;
    720                 } else {
    721                     # cause the image to be re-made
    722                     # set up to queue an update run
    723                     queue_update_run(\$newState, \$fault, \$dep_id, $image->{imagedb},
    724                         $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic);
    725                 }
    726             }
    727         }
     663        queueUpdatesIfNeeded($stage, $image, $option_mask, \$newState, \$fault, \$dep_id);
    728664
    729665        $num_jobs++;
     
    864800}
    865801
    866 sub queue_update_run
     802sub get_dependent
    867803{
    868804    my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_;
    869805
    870     # XXX: The update process for warp and subsequent stages requires
    871     # destreaking to run because the -pending queries require it when magicked > 0
    872     # queries.
    873     # The case of stack-stack diffs is taken care of in pstamp_checkdependent
     806    # XXX: The update process for warp and subsequent stages requires # destreaking to be performed
     807    # because the -pending queries require the inputs to have magicked >= 0
     808    # The case of stack-stack diffs not needing to be destreaked is taken care of in pstamp_checkdependent
    874809    $need_magic = 1 if $imagedb eq 'gpc1';
    875810
    876     if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned')) {
     811    # chipRun's can be in full state if destreaking is necessary
     812    if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned') and
     813        ($stage eq 'chip' and $state eq 'full')) {
    877814        my_die("$stage $stage_id is in unexpected state $state", $PS_EXIT_PROG_ERROR);
    878815    }
     
    910847}
    911848
     849sub queueUpdatesIfNeeded {
     850    my $stage = shift;
     851    my $image = shift;
     852    my $option_mask = shift;
     853    my $r_newState = shift;
     854    my $r_fault = shift;
     855    my $r_dep_id = shift;
     856
     857    if ($stage ne 'raw') {
     858        my $run_state = $image->{state};
     859        my $data_state = $image->{data_state};
     860        $data_state = $run_state if $stage eq 'stack';
     861        if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/) or ($run_state eq 'drop')) {
     862            # image is gone and it's not coming back
     863            $$r_newState = 'stop';
     864            $$r_fault = $PSTAMP_GONE;
     865        } elsif (($run_state eq "error_cleaned") or ($data_state eq 'error_cleaned')) {
     866            # if cleanup had an error don't get the user's hopes up set fault to gone
     867            $$r_newState = 'stop';
     868            $$r_fault = $PSTAMP_GONE;
     869        } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) {
     870   
     871            if ($stage eq 'stack') {
     872                print STDERR "Stamps cannot be made from cleaned stacks.\n";
     873                $$r_newState = 'stop';
     874                $$r_fault = $PSTAMP_GONE;
     875            }
     876            if (!$$r_fault) {
     877                # wait for update unless the customer asks us not to
     878                if (($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE)) {
     879                    $$r_newState = 'stop';
     880                    $$r_fault = $PSTAMP_NOT_AVAILABLE;
     881                } elsif (!$image->{magicked}) {
     882                    $$r_newState = 'stop';
     883                    $$r_fault = $PSTAMP_NOT_DESTREAKED;
     884                } else {
     885                    # cause the image to be re-made
     886                    # set up to queue an update run
     887                    get_dependent(\$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb},
     888                        $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic);
     889                }
     890            }
     891        }
     892    }
     893}
     894
    912895sub write_params {
    913896    my $output_base = shift;
Note: See TracChangeset for help on using the changeset viewer.