IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2010, 8:39:32 AM (16 years ago)
Author:
bills
Message:

Change the destreak cleanup to preserve the rows in the magicDSFile table

File:
1 edited

Legend:

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

    r29348 r29561  
    197197    if (!$job_fault and ($stage eq 'chip')) {
    198198        # chip processing is done, start destreaking.
    199         $job_fault = check_states_magicDSRun($stage, $stage_id, $rlabel, $need_magic, $it->{raw_magicked}, $it->{dsRun_state});
     199        my @chips;
     200        push @chips, $it->{class_id};
     201        $job_fault = check_states_magicDSRun($stage, $stage_id, \@chips, $rlabel, $need_magic, $it->{raw_magicked}, $it->{magic_ds_id}, $it->{dsRun_state});
    200202    }
    201203    if ($job_fault) {
     
    217219    my $dsRun_state;
    218220    my $raw_all_magicked = 1; # this gets cleared if any of the inputs aren't destreaked
     221    my @chips;
     222    my $magic_ds_id;
    219223    if (!$whole_run) {
    220224        foreach my $chip (@$metadatas) {
    221225            $dsRun_state = $chip->{dsRun_state};
    222226            $raw_all_magicked &= ($chip->{raw_magicked} > 0);
     227            $magic_ds_id = $chip->{magic_ds_id};
     228
     229            push @chips, $chip->{class_id};
    223230
    224231            if (($chip->{state} =~ /error/) or ($chip->{state} =~ /purged/) or ($chip->{state} =~ /scrubbed/)) {
     
    273280    }
    274281
    275     my $status = check_states_magicDSRun('chip', $chip_id, $rlabel, $need_magic, $raw_all_magicked, $dsRun_state);
     282    my $status = check_states_magicDSRun('chip', $chip_id, \@chips, $rlabel, $need_magic, $raw_all_magicked, $magic_ds_id, $dsRun_state);
    276283
    277284    return $status;
     
    633640    my $stage = shift;
    634641    my $stage_id = shift;
     642    my $components = shift;
    635643    my $rlabel  = shift;
    636644    my $need_magic = shift;
    637645    my $input_magicked = shift;
     646    my $magic_ds_id = shift;
    638647    my $dsRun_state = shift;
    639648
    640649    # XXX: this code assumes that destreaking is handled at the chip stage
    641     my_die ("check_states_magicDSRun only works for stage chip", $PS_EXIT_PROG_ERROR) if $stage ne 'chip';
     650    my_die ("check_states_magicDSRun only implemented for chip stage", $PS_EXIT_PROG_ERROR) if $stage ne 'chip';
    642651
    643652    # if called from check_states_warp dsRun_state is unknown. Go find it.
     
    654663            print "No magicDSRun for chipRun $stage_id and magic is required\n";
    655664            faultJobs('stop', undef, undef, $PSTAMP_NOT_DESTREAKED);
    656         } elsif ($dsRun_state eq 'cleaned') {
    657             my $command = "$magicdstool -updaterun -set_state new -stage $stage -stage_id $stage_id";
    658             $command .= " -set_label $rlabel" if $rlabel;
    659             if (!$no_update) {
    660                 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    661                     run(command => $command, verbose => $verbose);
    662                 unless ($success) {
    663                     my_die("failed to set destreak run to 'new' for ${stage}Run $stage_id",
    664                         $PS_EXIT_UNKNOWN_ERROR);
     665        } elsif (($dsRun_state eq 'cleaned') or ($dsRun_state eq 'update')) {
     666            foreach my $c (@$components) {
     667                my $command = "$magicdstool -setfiletoupdate -magic_ds_id $magic_ds_id -component $c";
     668                $command .= " -set_label $rlabel" if $rlabel;
     669                if (!$no_update) {
     670                    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     671                        run(command => $command, verbose => $verbose);
     672                    unless ($success) {
     673                        my_die("failed to set destreaked component to 'update' for ${stage}Run $stage_id $c",
     674                            $PS_EXIT_UNKNOWN_ERROR);
     675                    }
     676                } else {
     677                    print "skipping $command\n";
    665678                }
    666             } else {
    667                 print "skipping $command\n";
    668679            }
    669680        } elsif ($dsRun_state eq 'failed_revert') {
Note: See TracChangeset for help on using the changeset viewer.