IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31795


Ignore:
Timestamp:
Jun 29, 2011, 1:59:08 PM (15 years ago)
Author:
watersc1
Message:

Improved LAP cleanup code to catch quickstacks.

File:
1 edited

Legend:

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

    r31678 r31795  
    8585    unless (($lapRunInfo{state} eq 'full')||
    8686            ($lapRunInfo{state} eq 'drop')) {
    87         &my_die("Cannot run cleanup_mode if lapRun != done!", $lap_id);
     87        &my_die("Cannot run cleanup_mode if lapRun != full!", $lap_id);
    8888    }
    8989    my $status = cleanup_mode($lap_id);
     
    456456    my $can_fstack = 0;
    457457    my $total_exposures = 0;
     458    my $lonely_exposures = 0;
    458459    foreach my $exposure (@$exposures) {
    459460        $total_exposures++;
     
    474475        if ($exposure->{private}) { # I've declared this exposure private to this lapRun.
    475476            $needs_qstack = 1;
     477#           $lonely_exposures++;
    476478        }
    477479       
     
    516518                    $companion->{pairwise} = 0;
    517519                    &update_this_exposure($companion);
     520#                   $lonely_exposures++;
    518521                }
    519522                $exposure->{private} = 1;
     
    897900
    898901    my @clean_modes = (
    899         'chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -chip_id @CHIP_ID@',
    900         'warptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -warp_id @WARP_ID@',
    901         'difftool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -diff_id @DIFF_ID@',
     902        'chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -chip_id @CHIP_ID@',
     903        'warptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -warp_id @WARP_ID@',
     904        'difftool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -diff_id @DIFF_ID@',
    902905        'magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -stage chip -stage_id @CHIP_ID@',
    903906        'magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -stage warp -stage_id @WARP_ID@',
     
    910913            my $command = $clean_mode;
    911914            $command =~ s/\@DBNAME\@/$dbname/g;
    912             $command =~ s/\@CHIP_ID\@/$exposure->{chip_id}/;
    913             $command =~ s/\@WARP_ID\@/$exposure->{warp_id}/;
    914             $command =~ s/\@DIFF_ID\@/$exposure->{diff_id}/;
     915            if ($command =~ /\@CHIP_ID\@/) {
     916                if (S64_IS_NOT_NULL($exposure->{chip_id})) {
     917                    $command =~ s/\@CHIP_ID\@/$exposure->{chip_id}/;
     918                }
     919                else {
     920                    next;
     921                }
     922            }
     923            if ($command =~ /\@WARP_ID\@/) {
     924                if (S64_IS_NOT_NULL($exposure->{warp_id})) {
     925                    $command =~ s/\@WARP_ID\@/$exposure->{warp_id}/;
     926                }
     927                else {
     928                    next;
     929                }
     930            }
     931            if ($command =~ /\@DIFF_ID\@/) {
     932                if (S64_IS_NOT_NULL($exposure->{diff_id})) {
     933                    $command =~ s/\@DIFF_ID\@/$exposure->{diff_id}/;
     934                }
     935                else {
     936                    next;
     937                }
     938            }
    915939            $command =~ s/\@LABEL\@/$exposure->{label}/;
    916940           
     
    925949        update_this_exposure($exposure);
    926950    }
     951   
     952    # Cleanup quickstacks.
     953    $command = "$laptool -stacks -lap_id $lap_id";
     954    $command .= " -dbname $dbname" if defined $dbname;
     955   
     956    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     957        run(command => $command, verbose => $verbose);
     958    unless ($success) {
     959        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     960        &my_die("Unable to perform laptool -stacks: $error_code", "none", "none");
     961    }
     962    if (@$stdout_buf == 0) {
     963        # Nothing to do.
     964        return(0);
     965    }
     966   
     967    my $stacks = $mdcParser->parse_list(join "", @$stdout_buf) or
     968        &my_die("Unable to parse metadata from laptool -inactiveexp", $lap_id);
     969   
     970
     971    @clean_modes = (
     972        'stacktool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -set_label goto_cleaned -label @LABEL@ -stack_id @STACK_ID@');
     973    foreach my $stack (@$stacks) {
     974        if (!S64_IS_NOT_NULL($stack->{quick_stack_id})) {
     975            next;
     976        }
     977        foreach my $clean_mode (@clean_modes) {
     978            my $command = $clean_mode;
     979            $command =~ s/\@DBNAME\@/$dbname/g;
     980            $command =~ s/\@LABEL\@/$stack->{label}/;
     981            $command =~ s/\@STACK_ID\@/$stack->{quick_stack_id}/;
     982
     983            ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     984                run(command => $command, verbose => $verbose);
     985            unless ($success) {
     986                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     987                &my_die("Unable to perform cleantool: $command : $error_code", "none", "none");
     988            }
     989        }
     990    }   
     991
     992    $command = "$laptool -updaterun -lap_id $lap_id";
     993    $command .= " -dbname $dbname " if defined $dbname;
     994    $command .= " -set_state done ";
     995    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     996        run(command => $command, verbose => $verbose);
     997    unless ($success) {
     998        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     999        &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
     1000    }
     1001
    9271002}
    9281003   
Note: See TracChangeset for help on using the changeset viewer.