IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/ippScripts/scripts/lap_science.pl

    r32534 r33638  
    3333# Global configuration constants that probably should be read from elsewhere. 
    3434my $qstack_threshold     = 0.05; # Only make a quickstack if more than 5% of the exposures require it.
    35 my $minimum_stack_inputs = 6;    # We can avoid magicking stack inputs if we have more than this number.
     35my $minimum_stack_inputs = 4;    # We can avoid magicking stack inputs if we have more than this number.
    3636
    3737GetOptions(
     
    286286        &my_die("Unable to perform chiptool -setimfiletoupdate: $error_code", $exposure->{exp_id}, $data_group);
    287287    }
    288     if ($chip_magicDS_id != 0) {   
    289         ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    290             run(command => $magicDS_update_cmd, verbose => $verbose);
    291         unless ($success) {
    292             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    293             &my_die("Unable to perform magicdstool -setfiletoupdate: $error_code", $exposure->{exp_id}, $data_group);
    294         }
    295     }
     288#     if ($chip_magicDS_id != 0) {   
     289#       ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     290#           run(command => $magicDS_update_cmd, verbose => $verbose);
     291#       unless ($success) {
     292#           $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     293#           &my_die("Unable to perform magicdstool -setfiletoupdate: $error_code", $exposure->{exp_id}, $data_group);
     294#       }
     295#     }
    296296
    297297    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    551551            $complete_fstacks++;
    552552        }
     553        elsif (($stack->{final_state})&&
     554               ($stack->{final_state} eq 'drop')) {
     555            $complete_fstacks++;
     556        }
    553557        elsif (($stack->{final_state})&&($stack->{final_state} eq 'new')&&
    554558               ($stack->{final_fault} >= 4)&&($stack->{final_fault} != 32767)) {
     
    616620    my $are_warped = 0;
    617621    my $are_magicked = 0;
    618 
    619622    foreach my $exposure (@$exposures) {
    620623        $total_exposures++;
     
    706709            $exposure->{data_state} = 'to_diff';
    707710        }
    708         if (($exposure->{diff_id})&&(&S64_IS_NOT_NULL($exposure->{diff_id}))) {
     711        if (($exposure->{diff_id})&&
     712            (&S64_IS_NOT_NULL($exposure->{diff_id}))&&
     713            (($exposure->{diffRun_state} eq 'full')||
     714             ($exposure->{diffRun_state} eq 'error_cleaned')||
     715             ($exposure->{diffRun_state} eq 'cleaned'))
     716            ) {
     717            $are_magicked++;
    709718            $have_diff ++;
    710             $exposure->{data_state} = 'to_magic';
    711         }
    712         if (($exposure->{magicked})&&
    713             ($exposure->{warpRun_state})&&
    714             ($exposure->{warpRun_state} eq 'full')&&
    715             (&S64_IS_NOT_NULL($exposure->{magicked}))) {  # This exposure has been magicked, so it is through with diff.
    716             $are_magicked++;
     719#           $exposure->{data_state} = 'to_magic';
    717720            $exposure->{data_state} = 'full';
    718 #           $can_fstack ++;
    719         }
    720         &update_this_exposure($exposure);
     721        }
     722        # We no longer need to care about magic
     723#       if (($exposure->{magicked})&&
     724#           ($exposure->{warpRun_state})&&
     725#           ($exposure->{warpRun_state} eq 'full')&&
     726#           (&S64_IS_NOT_NULL($exposure->{magicked}))) { # This exposure has been magicked, so it is through with diff.
     727#           $are_magicked++;
     728#           $exposure->{data_state} = 'full';
     729# #         $can_fstack ++;
     730#       }
     731        unless ($debug) {
     732            &update_this_exposure($exposure);
     733        }
    721734    }
    722735
     
    744757        if ($defined_fstack == 0) {        # We have not yet made any stacks.
    745758            print "STATUS: We can attempt to queue deep final stacks.\n";
    746             my $Nstacks_made = &queue_muggle_finalstack($exposures);
     759            my $Nstacks_made;
     760            unless ($debug) {
     761                $Nstacks_made = &queue_muggle_finalstack($exposures);
     762            }
    747763            print "STATUS: Made $Nstacks_made final stacks.\n";
    748764            exit($Nstacks_made);
     
    752768            if ($have_fstack == $defined_fstack) { # We have made all the stacks we have asked for (so far)
    753769                if ($are_magicked < $total_exposures) { # But we have not yet made diffs
     770#               if ($have_diff < $total_exposures) { # We have not yet made diffs
    754771                    if (($can_diff == $total_exposures)&& # And we have exposures that should be diffed.
    755772                        ($have_diff < $can_diff)) {       # and we haven't made them all yet, either.
     
    759776#                           &update_this_exposure($exposure);
    760777#                       }
    761                         &queue_diffs($exposures);
     778                        unless ($debug) {
     779                            &queue_diffs($exposures);
     780                        }
    762781                        exit(0);
    763782                    }
     
    770789                }
    771790                elsif ($are_magicked == $total_exposures) { # We have made all of the diffs, and propagated through magic
    772                     print "STATUS: We can create all remaining stacks possible.\n";
    773                     my $Nstacks_made = &queue_magic_finalstack($exposures);
    774                     if ($Nstacks_made == 0) { # We have made all the stacks that we will ever make.
     791                    print "STATUS: We would create all remaining stacks possible, but no longer require magic.\n";
     792#                   my $Nstacks_made = -1;
     793#                   unless ($debug) {
     794#                       $Nstacks_made = &queue_muggle_finalstack($exposures);
     795#                   }
     796#                   if ($Nstacks_made == 0) { # We have made all the stacks that we will ever make.
    775797                        print "STATUS: No more stacks generated. Deactivating exposures for this complete lapRun.\n";
    776                         &deactivate_exposures($exposures);
    777                         $command = "$laptool -updaterun -lap_id $lap_id";
    778                         $command .= " -dbname $dbname " if defined $dbname;
    779                         $command .= " -set_state full ";
    780                         my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    781                             run(command => $command, verbose => $verbose);
    782                         unless ($success) {
    783                             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    784                             &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    785                         }
     798                        unless ($debug) {
     799                            &deactivate_exposures($exposures);
     800                       
     801                            $command = "$laptool -updaterun -lap_id $lap_id";
     802                            $command .= " -dbname $dbname " if defined $dbname;
     803                            $command .= " -set_state full ";
     804                            my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     805                                run(command => $command, verbose => $verbose);
     806                            unless ($success) {
     807                                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     808                                &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
     809                            }
     810#                       }
    786811                        exit(0);
    787812                    }
    788                     else {
    789                         print "STATUS: $Nstacks_made stacks made.\n";
    790                         exit(0);
    791                     }
     813#                   else {
     814#                       print "STATUS: $Nstacks_made stacks made.\n";
     815#                       exit(0);
     816#                   }
    792817                }
    793818                else { # What?
     
    9911016    foreach $exposure (@$exposures) {
    9921017        if (($exposure->{data_state} ne 'drop')&&
    993             (S64_IS_NOT_NULL($exposure->{magicked}))&&
     1018#           (S64_IS_NOT_NULL($exposure->{magicked}))&&
    9941019            (S64_IS_NOT_NULL($exposure->{warp_id}))) {
    9951020            $warps .= " -warp_id $exposure->{warp_id} ";
     
    12861311    if (@$stdout_buf == 0) {
    12871312        # Nothing to do.
     1313        $command = "$laptool -updaterun -lap_id $lap_id";
     1314        $command .= " -dbname $dbname " if defined $dbname;
     1315        $command .= " -set_state done ";
     1316        ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1317            run(command => $command, verbose => $verbose);
     1318        unless ($success) {
     1319            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     1320            &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
     1321        }
     1322
    12881323        return(0);
    12891324    }
     
    14741509        $command .= " -set_data_state $exposure->{data_state} ";
    14751510    }
    1476 
    1477     my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    1478         run(command => $command, verbose => $verbose);
    1479     unless ($success) {
    1480         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    1481         &my_die("Unable to perform laptool -updateexp: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     1511    unless ($do_nothing) {
     1512        my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1513            run(command => $command, verbose => $verbose);
     1514       
     1515        unless ($success) {
     1516            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     1517            &my_die("Unable to perform laptool -updateexp: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     1518        }
    14821519    }
    14831520}   
Note: See TracChangeset for help on using the changeset viewer.