IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27805


Ignore:
Timestamp:
Apr 29, 2010, 1:25:33 PM (16 years ago)
Author:
bills
Message:

fix bug in order of updates. Write code for updates of other diff_modes

File:
1 edited

Legend:

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

    r27795 r27805  
    124124        ($whole_run or ($it->{data_state} eq 'cleaned'))) {
    125125
     126    # Update has not been queued for this component yet. 
     127
    126128    # XXX: if $whole_run this is going to repeatedly call -setimfiletoupdate. This will be a no-op
    127129    # but is wasteful.
     
    140142    }
    141143} else {
     144    # update for this component has been queued by hasn't completed yet
     145    # XXX: in this state we aren't checking the dependents anymore. If something goes wrong this
     146    # will never complete. Consider calling the 'queue_update' functions again just to check. They are relatively cheap
     147
     148
    142149    print "${stage}Run $stage_id state is $it->{state} $component data_state is $it->{data_state}\n";
    143150
     
    169176    }
    170177    if (!$job_fault and ($stage eq 'chip')) {
     178        # chip processing is done, start destreaking.
    171179        $job_fault = queue_update_magicDSRun($stage, $stage_id, $rlabel, $it->{raw_magicked}, $it->{dsRun_state});
    172180    }
     
    256264            if !$data or scalar @$data == 0;
    257265
    258         my $good_to_go = 1;
     266        my $chips_ready = 1;
    259267        my @chipsToUpdate;
    260268        my $chip_id;
     
    262270            $chip_id = $chip->{chip_id};
    263271            if (($chip->{data_state} ne 'full') or ($need_magic and ($chip->{magicked} <= 0))) {
    264                 $good_to_go = 0;
     272                $chips_ready = 0;
    265273                push @chipsToUpdate, $chip;
    266274            } else {
     
    269277        }
    270278
    271         if ($good_to_go) {
     279        if ($chips_ready) {
    272280            # the reason we defer setting the warp to update is so that we can handle error conditions at previous
    273281            # stages more easily.
     
    335343    my $need_magic = shift;
    336344
    337 # XXXX This is not ready to go yet XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx
    338 
    339345    my $diff_id   = $metadata->{diff_id};
    340346    my $diff_mode = $metadata->{diff_mode};
     
    346352        my $IPP_DIFF_MODE_WARP_WARP   = 1;
    347353        my $IPP_DIFF_MODE_WARP_STACK  = 2;
    348         my $IPP_DIFF_MODE_STACK_WARP  = 2;
     354        my $IPP_DIFF_MODE_STACK_WARP  = 3;
    349355        my $IPP_DIFF_MODE_STACK_STACK = 4;
    350356        if ($diff_mode == $IPP_DIFF_MODE_WARP_STACK ) {
     
    364370            $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id";
    365371            my $warp = runToolAndParseExpectOne($command, $verbose);
    366             my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp;
     372            my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp;
    367373
    368374            if ($warp->{data_state} ne 'full') {
     
    373379            my $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id";
    374380            my $warp1 = runToolAndParseExpectOne($command, $verbose);
    375             my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp1;
    376 
     381            my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp1;
     382
     383            my $warps_ready = 1;
     384            my $status = 0;
    377385            if ($warp1->{data_state} ne 'full') {
    378                 my $status = queue_update_warp($warp1, 0, $rlabel, $need_magic);
     386                $warps_ready = 0;
     387                $status = queue_update_warp($warp1, 0, $rlabel, $need_magic);
    379388                if ($status) {
    380389                    return $status;
     
    383392            $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id";
    384393            my $warp2 = runToolAndParseExpectOne($command, $verbose);
    385             my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp2;
     394            my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp2;
    386395
    387396            if ($warp2->{data_state} ne 'full') {
    388                 return queue_update_warp($warp2, 0, $rlabel, $need_magic);
    389             }
    390             # fall through to queue the diff update
     397                $warps_ready = 0;
     398                $status = queue_update_warp($warp2, 0, $rlabel, $need_magic);
     399            }
     400
     401            if (!$warps_ready) {
     402                # don't queue the diff update yet
     403                return $status;
     404            }
     405
     406        } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_STACK ) {
     407            # check the state of the input stack
     408            my $command = "$stacktool -sumkskyfile -stack_id $skycell->{stack2}";
     409            my $stack1 = runToolAndParseExpectOne($command, $verbose);
     410            my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack1;
     411
     412            if ($stack1->{state} ne 'full') {
     413                print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n";
     414                # this faults all jobs depending on this dep_id
     415                faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE);
     416                return $PSTAMP_GONE;
     417            }
     418            # check the state of the template stack
     419            $command = "$stacktool -sumkskyfile -stack_id $skycell->{stack2}";
     420            my $stack2 = runToolAndParseExpectOne($command, $verbose);
     421            my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack2;
     422
     423            if ($stack2->{state} ne 'full') {
     424                print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n";
     425                # this faults all jobs depending on this dep_id
     426                faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE);
     427                return $PSTAMP_GONE;
     428            }
     429
     430            # inputs are ready fall through and queue the diff update
     431        } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_WARP ) {
     432            # check the state of the input stack
     433            my $command = "$stacktool -sumkskyfile -stack_id $skycell->{stack1}";
     434            my $stack = runToolAndParseExpectOne($command, $verbose);
     435            my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack1}", $PS_EXIT_UNKNOWN_ERROR) if !$stack;
     436
     437            if ($stack->{state} ne 'full') {
     438                print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n";
     439                # this faults all jobs depending on this dep_id
     440                faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE);
     441                return $PSTAMP_GONE;
     442            }
     443
     444            # now check the template warp
     445            $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id";
     446            my $warp = runToolAndParseExpectOne($command, $verbose);
     447            my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp;
     448
     449            if ($warp->{data_state} ne 'full') {
     450                return queue_update_warp($warp, 0, $rlabel, $need_magic);
     451            }
     452            # warps are ready fall through and queue the diff update
    391453        } else {
    392             # XXX: check stack stack
    393             print STDERR "unexpected diff_mode found: $diff_mode\n";
    394             return $PS_EXIT_PROG_ERROR;
     454            my_die("unexpected diff_mode found: $diff_mode", $PS_EXIT_PROG_ERROR);
    395455        }
    396456
     
    411471        return $PS_EXIT_PROG_ERROR;
    412472    }
    413     # return value may be the return status of script so zero is good
     473
     474    # return value is a unix style exit status so zero is good
    414475    return 0;
    415476}
Note: See TracChangeset for help on using the changeset viewer.