IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24234


Ignore:
Timestamp:
May 21, 2009, 11:53:13 AM (17 years ago)
Author:
Paul Price
Message:

Updating --- chip_imfile.pl wants --run_state

File:
1 edited

Legend:

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

    r18446 r24234  
    1313use Pod::Usage qw( pod2usage );
    1414
    15 my ($dbname,                    # Database name to use
    16     $workdir_default,           # Default working directory
    17     $verbose,                   # Verbose operations?
    18     $no_op,                     # No operations?
    19     $no_update,                 # No updating?
     15my ($dbname,                    # Database name to use
     16    $workdir_default,           # Default working directory
     17    $verbose,                   # Verbose operations?
     18    $no_op,                     # No operations?
     19    $no_update,                 # No updating?
    2020    );
    2121GetOptions(
    22            'dbname=s' => \$dbname,
    23            'workdir=s' => \$workdir_default,
    24            'verbose' => \$verbose,
    25            'no-op' => \$no_op,
    26            'no-update' => \$no_update,
     22           'dbname=s' => \$dbname,
     23           'workdir=s' => \$workdir_default,
     24           'verbose' => \$verbose,
     25           'no-op' => \$no_op,
     26           'no-update' => \$no_update,
    2727) or pod2usage( 2 );
    2828
    2929pod2usage( -msg => "Required options: --dbname --workdir",
    30            -exitval => 3,
    31            ) unless
     30           -exitval => 3,
     31           ) unless
    3232    defined $dbname;
    3333
    3434$workdir_default = `pwd` unless defined $workdir_default;
    3535
    36 my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser
     36my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser
    3737my $ipprc = PS::IPP::Config->new; # IPP Configuration
    3838
     
    4444
    4545# Imfile processing
    46 my @whole;                      # The whole list for processing
     46my @whole;                      # The whole list for processing
    4747{
    4848    my $command = "$chiptool -pendingimfile -dbname $dbname"; # Command to run
    4949    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    50         run( command => $command, verbose => 1 );
     50        run( command => $command, verbose => 1 );
    5151    die "Unable to get phase 2 imfile list: $error_code\n" if not $success;
    5252    @whole = split /\n/, join( '', @$stdout_buf );
     
    5959    push @single, $value;
    6060    if ($value =~ /^\s*END\s*$/) {
    61         push @single, "\n";
    62        
    63         my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or
    64             die "Unable to parse output from chiptool.\n";
    65            
    66         foreach my $item (@$list) {
    67             my $chip_id = $item->{chip_id};
    68             my $exp_id = $item->{exp_id};
    69             my $exp_tag = $item->{exp_tag};
    70             my $camera = $item->{camera};
    71             my $class_id = $item->{class_id};
    72             my $uri = $item->{uri};
    73             my $reduction = $item->{reduction};
    74             my $workdir = $item->{workdir};
    75             $workdir = $workdir_default unless (defined $workdir or $workdir ne "NULL");
     61        push @single, "\n";
    7662
    77             my $outroot = caturi( $workdir, $exp_tag, "$exp_tag.ch.$chip_id" );
    78             $ipprc->outroot_prepare( $outroot );
     63        my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or
     64            die "Unable to parse output from chiptool.\n";
    7965
    80             my $command = "$chip --chip_id $chip_id --exp_id $exp_id --class_id $class_id --uri $uri --dbname $dbname --camera $camera --outroot $outroot";
    81             $command .= " --reduction $reduction" if defined $reduction;
    82             $command .= " --verbose" if defined $verbose;
    83             $command .= " --no-op" if defined $no_op;
    84             $command .= " --no-update" if defined $no_update;
    85             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    86                 run( command => $command, verbose => 1 );
    87             die "Unable to do phase 2 processing on $chip_id $class_id: $error_code\n" if not $success;
    88         }
     66        foreach my $item (@$list) {
     67            my $chip_id = $item->{chip_id};
     68            my $exp_id = $item->{exp_id};
     69            my $exp_tag = $item->{exp_tag};
     70            my $camera = $item->{camera};
     71            my $class_id = $item->{class_id};
     72            my $uri = $item->{uri};
     73            my $reduction = $item->{reduction};
     74            my $state = $item->{state};
     75            my $workdir = $item->{workdir};
     76            $workdir = $workdir_default unless (defined $workdir or $workdir ne "NULL");
    8977
    90         @single = ();
     78            my $outroot = caturi( $workdir, $exp_tag, "$exp_tag.ch.$chip_id" );
     79            $ipprc->outroot_prepare( $outroot );
     80
     81            my $command = "$chip --chip_id $chip_id --exp_id $exp_id --class_id $class_id --uri $uri --dbname $dbname --camera $camera --outroot $outroot --run-state $state";
     82            $command .= " --reduction $reduction" if defined $reduction;
     83            $command .= " --verbose" if defined $verbose;
     84            $command .= " --no-op" if defined $no_op;
     85            $command .= " --no-update" if defined $no_update;
     86            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     87                run( command => $command, verbose => 1 );
     88            die "Unable to do phase 2 processing on $chip_id $class_id: $error_code\n" if not $success;
     89        }
     90
     91        @single = ();
    9192
    9293    }
Note: See TracChangeset for help on using the changeset viewer.