IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 5, 2009, 5:11:19 PM (17 years ago)
Author:
watersc1
Message:

Edit to have a run marked for cleanup but that contains no entries to clean as error_STATE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/ipp_cleanup.pl

    r25473 r25781  
    9191
    9292    # if there are no chipProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new'
     93    # XXX Why? This could just mean there's nothing to cleanup, or that we're trying to rerun an errored run.
    9394    if (@$stdout_buf == 0)  {
    94         my $command = "$chiptool -chip_id $stage_id -updaterun -set_state new";
     95        my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state";
    9596        $command .= " -dbname $dbname" if defined $dbname;
    9697
     
    123124            my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id);
    124125
    125 #            if (!$config_file or ! -e $config_file) {
    126126            unless ($ipprc->file_exists($config_file)) {
    127127                print STDERR "skipping cleanup for chipRun $stage_id $class_id "
     
    199199                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
    200200            }
     201           
     202            # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again.
     203            $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state";
     204            $command .= " -dbname $dbname" if defined $dbname;
     205
     206            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     207                run(command => $command, verbose => $verbose);
     208            unless ($success) {
     209                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     210                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
     211
     212            }
    201213        }
    202214    }
     
    314326        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    315327        &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     328    }
     329   
     330    if (@$stdout_buf == 0) {
     331        # No skycells were found for some reason.
     332        # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself."
     333        my $command = "$warptool -updaterun -warp_id $stage_id -set_state $error_state";
     334        $command .= " -dbname $dbname" if defined $dbname;
     335       
     336        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     337            run(command => $command, verbose => $verbose);
     338        unless ($success) {
     339            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     340            &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     341        }
     342       
     343        exit(0);
    316344    }
    317345    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     
    389417                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
    390418            }
     419
     420
    391421         } else {
    392422            my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -set_state $error_state";
     
    399429                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
    400430            }
    401             exit $PS_EXIT_UNKNOWN_ERROR;
     431
     432            #            exit $PS_EXIT_UNKNOWN_ERROR;
    402433        }
    403434    }
     
    422453        &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code);
    423454    }
     455
     456    if (@$stdout_buf == 0) {
     457        # No skycells were found for some reason.
     458        # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself."
     459        my $command = "$stacktool -updaterun -stack_id $stage_id -set_state $error_state";
     460        $command .= " -dbname $dbname" if defined $dbname;
     461       
     462        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     463            run(command => $command, verbose => $verbose);
     464        unless ($success) {
     465            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     466            &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     467        }
     468       
     469        exit(0);
     470    }
     471
    424472    my $metadata = $mdcParser->parse(join "", @{ $stdout_buf }) or
    425473        &my_die("Unable to parse metadata config doc", "stack", $stage_id, $PS_EXIT_PROG_ERROR);
     
    523571        &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code);
    524572    }
     573
     574    if (@$stdout_buf == 0) {
     575        # No skycells were found for some reason.
     576        # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself."
     577        my $command = "$difftool -updaterun -diff_id $stage_id -set_state $error_state";
     578        $command .= " -dbname $dbname" if defined $dbname;
     579       
     580        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     581            run(command => $command, verbose => $verbose);
     582        unless ($success) {
     583            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     584            &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     585        }
     586       
     587        exit(0);
     588    }
     589
    525590    my $metadata = $mdcParser->parse(join "", @{ $stdout_buf }) or
    526591        &my_die("Unable to parse metadata config doc", "diff", $stage_id, $PS_EXIT_PROG_ERROR);
     
    646711    # if there are no fakeProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new'
    647712    if (@$stdout_buf == 0)  {
    648         my $command = "$faketool -fake_id $stage_id -updaterun -set_state new";
     713        my $command = "$faketool -fake_id $stage_id -updaterun -set_state $error_state";
    649714        $command .= " -dbname $dbname" if defined $dbname;
    650715
Note: See TracChangeset for help on using the changeset viewer.