Changeset 11048
- Timestamp:
- Jan 11, 2007, 3:41:58 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase0_imfile.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase0_imfile.pl
r11036 r11048 76 76 77 77 # Switches for p0tool 78 use constant P0TOOL_MODE => '- updateimfile'; # Mode for p0tool78 use constant P0TOOL_MODE => '-addprocessedimfile'; # Mode for p0tool 79 79 use constant P0TOOL_EXPTAG => '-exp_tag'; # Switch to specify the exposure id 80 80 use constant P0TOOL_CLASSID => '-class_id'; # Switch to specify the class id … … 110 110 cache_run(command => $command, verbose => 1); 111 111 unless ($success) { 112 warn ("Unable to perform ppStats on exposure id $exp_tag: $error_code");113 &my_die ($exp_tag, $class_id, $error_code);112 warn ("Unable to perform ppStats on exposure id $exp_tag: $error_code"); 113 &my_die ($exp_tag, $class_id, $error_code); 114 114 } 115 115 … … 118 118 my $metadata = $mdcParser->parse(join "", @$stdout_buf); # XXX is this join necessary? 119 119 unless ($metadata) { 120 warn ("Unable to parse metadata config doc");121 &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);120 warn ("Unable to parse metadata config doc"); 121 &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 122 122 } 123 123 my @constants = keys %{CONSTANTS()}; # List of constants to parse out … … 125 125 $stats = PS::IPP::Metadata::Stats->new(\@constants, \@variables); # Stats parser 126 126 unless ($stats->parse($metadata)) { 127 warn ("Unable to find all values");128 &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);129 # XXX is this a programming or a config error?127 warn ("Unable to find all values"); 128 &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 129 # XXX is this a programming or a config error? 130 130 } 131 131 … … 133 133 my $rnd = rand(1); 134 134 if ($rnd > 0.5) { 135 warn ("random failure");136 &my_die ($exp_tag, $class_id, $PS_EXIT_DATA_ERROR);135 warn ("random failure"); 136 &my_die ($exp_tag, $class_id, $PS_EXIT_DATA_ERROR); 137 137 } 138 138 } … … 144 144 145 145 foreach my $constant (keys %{CONSTANTS()}) { 146 push @command, CONSTANTS->{$constant}, ($stats->data($constant))->{value};146 push @command, CONSTANTS->{$constant}, ($stats->data($constant))->{value}; 147 147 148 148 } 149 149 foreach my $variable (keys %{VARIABLES()}) { 150 150 # Just use the mean value 151 push @command, VARIABLES->{$variable}, ($stats->data($variable))->{mean};151 push @command, VARIABLES->{$variable}, ($stats->data($variable))->{mean}; 152 152 } 153 153 154 154 push @command, P0TOOL_BG_MEAN(); 155 155 if (defined $stats->bg_mean()) { 156 push @command, $stats->bg_mean();157 } else { 158 push @command, "NAN";156 push @command, $stats->bg_mean(); 157 } else { 158 push @command, "NAN"; 159 159 } 160 160 push @command, P0TOOL_BG_STDEV(); 161 161 if (defined($stats->bg_stdev())) { 162 push @command, $stats->bg_stdev();163 } else { 164 # Will not be defined if there is only a single imfile165 push @command, 0;162 push @command, $stats->bg_stdev(); 163 } else { 164 # Will not be defined if there is only a single imfile 165 push @command, 0; 166 166 } 167 167 push @command, P0TOOL_BG_MEAN_STDEV(); 168 168 if (defined $stats->bg_mean_stdev()) { 169 push @command, $stats->bg_mean_stdev();170 } else { 171 push @command, "NAN";169 push @command, $stats->bg_mean_stdev(); 170 } else { 171 push @command, "NAN"; 172 172 } 173 173 174 174 # Quote arguments with whitespace 175 175 for (my $i = 0; $i < scalar @command; $i++) { 176 if ($command[$i] =~ /\s/) {177 $command[$i] = "\'$command[$i]\'";178 }176 if ($command[$i] =~ /\s/) { 177 $command[$i] = "\'$command[$i]\'"; 178 } 179 179 } 180 180 … … 183 183 184 184 unless ($success) { 185 # XXX this is tricky: if we can't run -updateimfile, can we actually set the error code?186 # XXX if this is not a database error, it is probably a programming error (in p0tool or the passed args)187 warn ("Unable to perform p0tool -updateimfile: $error_code");188 &my_die ($exp_tag, $class_id, $error_code);185 # XXX this is tricky: if we can't run -updateimfile, can we actually set the error code? 186 # XXX if this is not a database error, it is probably a programming error (in p0tool or the passed args) 187 warn ("Unable to perform p0tool -updateimfile: $error_code"); 188 &my_die ($exp_tag, $class_id, $error_code); 189 189 } 190 190 } … … 210 210 my $exit_code = $_[2]; 211 211 if ($exp_tag && $class_id) { 212 system ("$p0tool -faultimfile -exp_tag $exp_tag -class_id $class_id -code $exit_code");212 system ("$p0tool -faultimfile -exp_tag $exp_tag -class_id $class_id -code $exit_code"); 213 213 } 214 214 exit $exit_code;
Note:
See TracChangeset
for help on using the changeset viewer.
