IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32478


Ignore:
Timestamp:
Oct 3, 2011, 3:51:41 PM (15 years ago)
Author:
watersc1
Message:

Implementation of automatic nebulous repair for bad files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20110622/ippScripts/scripts/chip_imfile.pl

    r32378 r32478  
    3434my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    3535my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
     36my $nebrepair = can_run('neb-repair') or (warn "Can't find neb-repair" and $missing_tools = 1);
     37
    3638if ($missing_tools) {
    3739    warn("Can't find required tools.");
     
    330332        # get the UNIX version of the (possible) neb: or path: filename
    331333        my $uriReal = $ipprc->file_resolve( $uri );
     334        # Catch errors here
     335        if (!$uriReal) {
     336            my $repair_cmd = "$nebrepair $uri";
     337            my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     338            unless ($repair_success) {
     339                &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     340            }
     341            $uriReal = $ipprc->file_resolve( $uri );
     342        }
     343           
    332344        &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal;
    333345
     
    336348        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
    337349        unless ($success) {
     350            # Catch errors here
     351            my $repair_cmd = "$nebrepair $uri";
     352            my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     353            unless ($repair_success) {
     354                &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     355            }
     356            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
     357        }
     358        unless ($success) {
    338359            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    339360            &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     
    348369            $burntoolTable_uri =~ s/fits$/burn.tbl/;
    349370            $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     371            if (!$burntoolTable_uriReal) {
     372                my $repair_cmd = "$nebrepair $burntoolTable_uri";
     373                my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     374                unless ($repair_success) {
     375                    &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     376                }
     377                $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     378            }
    350379            unless ($ipprc->file_exists($burntoolTable_uri)) {
     380                # Catch errors here
    351381                &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR);
    352382            }
Note: See TracChangeset for help on using the changeset viewer.