Changeset 11036 for trunk/ippScripts/scripts/phase0_exp.pl
- Timestamp:
- Jan 11, 2007, 12:13:36 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase0_exp.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase0_exp.pl
r10625 r11036 14 14 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 15 15 use Pod::Usage qw( pod2usage ); 16 17 use PS::IPP::Config qw( 18 $PS_EXIT_SUCCESS 19 $PS_EXIT_UNKNOWN_ERROR 20 $PS_EXIT_SYS_ERROR 21 $PS_EXIT_CONFIG_ERROR 22 $PS_EXIT_PROG_ERROR 23 $PS_EXIT_DATA_ERROR 24 $PS_EXIT_TIMEOUT_ERROR 25 ); 16 26 17 27 my ($cache, $exptag, $no_update); … … 67 77 my $ppStats = can_run('ppStats') 68 78 or (warn "can't find ppStats" and $missing_tools = 1); 69 die "Can't find required tools.\n" if $missing_tools; 79 if ($missing_tools) { 80 warn ("Can't find required tools"); 81 &my_die ("", $PS_EXIT_CONFIG_ERROR); 82 } 70 83 71 84 # setup cache interface … … 84 97 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 85 98 cache_run(command => $command, verbose => 1); 86 die "Unable to perform p0tool on exposure id $exptag: $error_code\n" if not $success; 87 my $metadata = $mdcParser->parse(join "", @$stdout_buf) 88 or die "unable to parse metadata config doc"; 99 unless ($success) { 100 warn ("Unable to perform p0tool on exposure id $exptag: $error_code"); 101 &my_die ($exptag, $error_code); 102 } 103 104 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 105 unless ($metadata) { 106 warn ("Unable to parse metadata config doc"); 107 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 108 } 89 109 $imfiles = parse_md_list($metadata); # Data for imfiles 90 110 } … … 104 124 if (not defined $values{$constant}) { 105 125 $values{$constant} = $value; 106 } elsif ($values{$constant} ne $value) { 107 die "Value of $constant for " . $imfile->{PHASE0_CLASSID} . 108 " doesn't match previous value.\n"; 126 } 127 if ($values{$constant} ne $value) { 128 warn ("Value of $constant for $imfile->{PHASE0_CLASSID} doesn't match previous value"); 129 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 109 130 } 110 131 } … … 121 142 my $stdev = get_value($imfile, PHASE0_BG_MEAN_STDEV()); 122 143 push @variances, $stdev**2; 144 } 145 146 # XXX for a test, randomly declare a failure and return to pantasks 147 my $rnd = rand(1); 148 if ($rnd > 0.5) { 149 warn ("random failure"); 150 &my_die ($exptag, $PS_EXIT_DATA_ERROR); 123 151 } 124 152 … … 169 197 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 170 198 cache_run(command => \@command, verbose => 1); 171 die "Unable to run phase0 update for $exptag: $error_code\n" if not $success; 199 unless ($success) { 200 warn ("Unable to run phase0 update for $exptag: $error_code"); 201 &my_die ($exptag, $error_code); 202 } 172 203 } 173 204 174 205 ### Pau. 175 176 206 177 207 # Get the value for a particular imfile, along with a strong check for its existence … … 181 211 182 212 my $source = $imfile->{PHASE0_CLASSID()}; # Where it comes from 183 die "Couldn't find value of $name for class_id=$source\n" if not defined $imfile->{$name}; 213 214 unless (defined $imfile->{$name}) { 215 warn ("Couldn't find value of $name for class_id=$source"); 216 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 217 } 184 218 return $imfile->{$name}; 185 219 } … … 199 233 } 200 234 235 sub my_die 236 { 237 my $exp_tag = $_[0]; 238 my $exit_code = $_[1]; 239 if ($exp_tag) { 240 system ("$p0tool -faultexp -exp_tag $exp_tag -code $exit_code"); 241 } 242 exit $exit_code; 243 } 244 201 245 END { 202 246 my $exit = $?; … … 204 248 $? = $exit; 205 249 } 206
Note:
See TracChangeset
for help on using the changeset viewer.
