IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25483


Ignore:
Timestamp:
Sep 22, 2009, 3:50:06 PM (17 years ago)
Author:
watersc1
Message:

Added support to identify if an exposure has been processed with burntool at the summit, and to correctly set the burntool_state in the database.

File:
1 edited

Legend:

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

    r25418 r25483  
    3333my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1);
    3434my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
     35my $ppConfigDump = can_run( 'ppConfigDump' ) or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    3536
    3637my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
     
    103104    print "[Running $command2]\n";
    104105    my $result2 = IPC::Run::run $h2;
    105     print "STDOUT:\n$out2";
    106     print "STDERR:\n$err2";
     106
    107107    &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h2->result() or $PS_EXIT_PROG_ERROR) ) unless $result2;
    108108    chomp $out2;
    109109    $cmdflags = $out2;
     110
     111    # Manually parse the burntool_state entry.
     112    my $burntoolState = 0;
     113    my $isGPC1 = 0;
     114    my $burntoolStateGood = 0;
     115    foreach my $line (split /\n/, $out1) {
     116        if ($line =~ /FPA.BURNTOOL.APPLIED/) {
     117            $line =~ s/^\s+//;
     118            $burntoolState = (split /\s+/, $line)[2];
     119        }
     120        if ($line =~ /FPA.CAMERA/) {
     121            $line =~ s/^\s+//;
     122            if ((split /\s+/, $line)[2] eq 'GPC1') {
     123                $isGPC1 = 1;
     124            }
     125        }
     126    }
     127    if ($isGPC1 != 1) {
     128        $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
     129    }
     130    elsif (($isGPC1 == 1) && ($burntoolState == 1)) {
     131        my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
     132        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     133            IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);
     134        unless ($success) {
     135            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     136            warn ("Unable to perform ppConfigDump");
     137            exit($error_code);
     138        }
     139
     140        # This is ugly, but doing a full parse for one entry is a bit wasteful.
     141        foreach my $line (split /\n/, (join "", @$stdout_buf)) {
     142            if ($line =~ /BURNTOOL.STATE.GOOD/) {
     143                $line =~ s/^\s+//;
     144                $burntoolStateGood = (split /\s+/, $line)[2];
     145                last;
     146            }
     147        }
     148        $burntoolState = $burntoolStateGood; # Positive because this has the header table.
     149    }
     150    $cmdflags .= " -burntool_state $burntoolState ";
    110151}
    111152
Note: See TracChangeset for help on using the changeset viewer.