IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20707


Ignore:
Timestamp:
Nov 12, 2008, 1:43:41 PM (17 years ago)
Author:
bills
Message:

after successfully processing the root node add the streaks file
to magicMask and set the run to stop

File:
1 edited

Legend:

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

    r20702 r20707  
    235235    }
    236236}
     237if ($node eq "root") {
     238    my $streaks_file = "$outroot.streaks";
     239    my $resolved = $ipprc->file_resolve($streaks_file);
     240
     241    my $fh;
     242    open $fh, "<$resolved" or
     243        &my_die("failed to open streaks file $streaks_file", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR);
     244    # the first line in the streaks file contains the number of streaks found
     245    my $num_streaks = <$fh>;
     246    chomp $num_streaks;
     247    close $fh;
     248    print "$num_streaks streaks found on magicRun $magic_id\n" if $verbose;
     249   
     250    my $command = "$magictool -addmask";
     251    $command   .= " -magic_id $magic_id";
     252    $command   .= " -uri $streaks_file";
     253    $command   .= " -streaks $num_streaks";
     254    $command   .= " -dbname $dbname" if defined $dbname;
     255
     256    # Add the processed file to the database
     257    unless ($no_update) {
     258        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     259            run(command => $command, verbose => $verbose);
     260        unless ($success) {
     261            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     262            # This isn't going to work because our result was already entered.
     263            &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code);
     264        }
     265    } else {
     266        print "Skipping command: $command\n";
     267    }
     268}
    237269
    238270
     
    304336}
    305337
    306 END {
    307     my $status = $?;
    308     system("sync") == 0
    309         or die "failed to execute sync: $!" ;
    310     $? = $status;
    311 }
    312 
    313338__END__
Note: See TracChangeset for help on using the changeset viewer.