Changeset 28003 for branches/pap/ippScripts/scripts/dqstats_bundle.pl
- Timestamp:
- May 18, 2010, 12:49:05 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/dqstats_bundle.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/ippScripts/scripts/dqstats_bundle.pl
r27308 r28003 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; … … 37 38 my ( $dqstats_id, $camera, $uri, $dbname, $verbose, $no_update, $no_op, $redirect, $save_temps); 38 39 GetOptions( 39 'dqstats_id=s' => \$dqstats_id, # dqstatsrun ID40 'camera|c=s' => \$camera, # camera41 'dbname|d=s' => \$dbname, # database name42 'uri=s' => \$uri, # output file destination43 'verbose' => \$verbose, # print to stdout44 'no-update' => \$no_update, # Update the database45 'no-op' => \$no_op, # don't do the operations46 'redirect-output' => \$redirect, 47 'save-temps' => \$save_temps, # save temporary files48 ) or pod2usage( 2 );40 'dqstats_id=s' => \$dqstats_id, # dqstatsrun ID 41 'camera|c=s' => \$camera, # camera 42 'dbname|d=s' => \$dbname, # database name 43 'uri=s' => \$uri, # output file destination 44 'verbose' => \$verbose, # print to stdout 45 'no-update' => \$no_update, # Update the database 46 'no-op' => \$no_op, # don't do the operations 47 'redirect-output' => \$redirect, 48 'save-temps' => \$save_temps, # save temporary files 49 ) or pod2usage( 2 ); 49 50 50 51 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 51 52 pod2usage( -msg => "Required options --dqstats_id --camera", 52 -exitval => 3,53 ) unless53 -exitval => 3, 54 ) unless 54 55 defined $dqstats_id and 55 56 defined $camera; 56 57 57 my $ipprc = PS::IPP::Config->new( $camera ) 58 my $ipprc = PS::IPP::Config->new( $camera ) 58 59 or my_die( "Unable to set up", $dqstats_id, $PS_EXIT_CONFIG_ERROR ); # IPP config 59 #my $logDest = $ipprc->filename("LOG.EXP", $uri) 60 #my $logDest = $ipprc->filename("LOG.EXP", $uri) 60 61 # or my_die("Missing entry from camera config", $dqstats_id, $PS_EXIT_CONFIG_ERROR); 61 62 62 63 if ($redirect) { 63 # $ipprc->redirect_output($logDest) 64 # or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR );64 # $ipprc->redirect_output($logDest) 65 # or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR ); 65 66 print "\n\n"; 66 67 print "Starting script $0 on $host\n\n"; … … 84 85 unless ($no_op) { 85 86 # This bit needs to make the bundle. 86 87 87 88 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 88 run(command => $bundle_command, verbose => $verbose);89 run(command => $bundle_command, verbose => $verbose); 89 90 unless ($success) { 90 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);91 &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code);91 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 92 &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code); 92 93 } 93 94 94 95 # Parse stdout_buf to get output file name 95 96 ## Begin partial 96 97 my ($tempFile, $tempName) = tempfile( "/tmp/dqstats.XXXX", 97 UNLINK => !$save_temps, SUFFIX => 'dsin' );98 UNLINK => !$save_temps, SUFFIX => 'dsin' ); 98 99 print $tempFile $uri . '|||notset' . "\n"; 99 100 … … 102 103 # It can't be that simple, can it? This should probably add a fault on failure. 103 104 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 run(command => $register_cmd, verbose => $verbose);105 run(command => $register_cmd, verbose => $verbose); 105 106 unless ($success) { 106 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);107 &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code);107 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 108 &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code); 108 109 } 109 110 110 111 # We no longer need the file generated by dqstatstool. 111 112 unlink($uri); … … 118 119 # This bit needs to set the database state to full 119 120 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 120 run(command => $update_command, verbose => $verbose);121 run(command => $update_command, verbose => $verbose); 121 122 unless ($success) { 122 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);123 warn("Unable to add result to database: $error_code\n");124 exit($error_code);123 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 124 warn("Unable to add result to database: $error_code\n"); 125 exit($error_code); 125 126 } 126 127 } else { … … 139 140 carp($msg); 140 141 if (defined $dqstats_id and not $no_update) { 141 # There is no fault handling, which may be a mistake. This is where a fault coding would be.142 # There is no fault handling, which may be a mistake. This is where a fault coding would be. 142 143 # my $command = "$addtool -add_id $add_id"; 143 144 # $command .= " -addprocessedexp";
Note:
See TracChangeset
for help on using the changeset viewer.
