Changeset 11831
- Timestamp:
- Feb 15, 2007, 10:45:58 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_norm_calc.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_norm_calc.pl
r11492 r11831 77 77 } 78 78 79 unless (exists NORMALIZE()->{lc($detType)}) { 80 warn("Unrecognised detrend type: $detType"); 81 exit($PS_EXIT_CONFIG_ERROR); 82 } 79 &my_die("Unrecognised detrend type: $detType", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless 80 exists NORMALIZE()->{lc($detType)}; 83 81 84 82 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 93 91 print "Running [$command]...\n"; 94 92 if (not run(\@command, \$stdin, \$stdout, \$stderr)) { 95 warn("Unable to perform dettool -processedimfile on detrend $detId/$iter: $?");96 exit($PS_EXIT_SYS_ERROR);93 &my_die("Unable to perform dettool -processedimfile on detrend $detId/$iter: $?", 94 $det_id, $iter, $PS_EXIT_SYS_ERROR); 97 95 } 98 96 # print $stdout . "\n"; … … 108 106 109 107 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ); 110 unless (defined $list) { 111 warn("Unable to parse output from dettool."); 112 exit($PS_EXIT_PROG_ERROR); 113 } 108 &my_die("Unable to parse output from dettool", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless 109 defined $list; 114 110 push @files, @$list; 115 111 @single = (); … … 148 144 print "Running [$ppNormCalc]...\n"; 149 145 if (not run(\@command, \$normData, \$stdout, \$stderr)) { 150 warn("Unable to perform ppNormCalc: $?"); 151 exit($PS_EXIT_SYS_ERROR); 146 &my_die("Unable to perform ppNormCalc: $?", $det_id, $iter, $PS_EXIT_SYS_ERROR); 152 147 } 153 148 print $stdout . "\n"; … … 155 150 # Parse the output 156 151 $norms = $mdcParser->parse($stdout); 157 unless ($norms) { 158 warn("Unable to parse metadata config doc"); 159 exit($PS_EXIT_PROG_ERROR); 160 } 152 &my_die("Unable to parse metadata config doc", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless $norms; 161 153 } 162 154 … … 199 191 } 200 192 193 sub my_die 194 { 195 my $msg = shift; # Warning message on die 196 my $det_id = shift; # Detrend identifier 197 my $iter = shift; # Iteration 198 my $exit_code = shift; # Exit code to add 199 200 warn($msg); 201 if ($det_id and $iter and $class_id and not $no_update) { 202 my $command = "$dettool -addnormalizedstat -det_id $det_id -iteration $iter -code $exit_code"; 203 $command .= " -dbname $dbname" if defined $dbname; 204 system ($command); 205 } 206 exit $exit_code; 207 } 208 209 201 210 END { 202 211 my $status = $?;
Note:
See TracChangeset
for help on using the changeset viewer.
