Changeset 24234
- Timestamp:
- May 21, 2009, 11:53:13 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_serial_chip.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_serial_chip.pl
r18446 r24234 13 13 use Pod::Usage qw( pod2usage ); 14 14 15 my ($dbname, # Database name to use16 $workdir_default, # Default working directory17 $verbose, # Verbose operations?18 $no_op, # No operations?19 $no_update, # No updating?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? 20 20 ); 21 21 GetOptions( 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, 27 27 ) or pod2usage( 2 ); 28 28 29 29 pod2usage( -msg => "Required options: --dbname --workdir", 30 -exitval => 3,31 ) unless30 -exitval => 3, 31 ) unless 32 32 defined $dbname; 33 33 34 34 $workdir_default = `pwd` unless defined $workdir_default; 35 35 36 my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser36 my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser 37 37 my $ipprc = PS::IPP::Config->new; # IPP Configuration 38 38 … … 44 44 45 45 # Imfile processing 46 my @whole; # The whole list for processing46 my @whole; # The whole list for processing 47 47 { 48 48 my $command = "$chiptool -pendingimfile -dbname $dbname"; # Command to run 49 49 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 50 run( command => $command, verbose => 1 );50 run( command => $command, verbose => 1 ); 51 51 die "Unable to get phase 2 imfile list: $error_code\n" if not $success; 52 52 @whole = split /\n/, join( '', @$stdout_buf ); … … 59 59 push @single, $value; 60 60 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"; 76 62 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"; 79 65 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"); 89 77 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 = (); 91 92 92 93 }
Note:
See TracChangeset
for help on using the changeset viewer.
