Changeset 11316 for trunk/ippScripts/scripts/phase3.pl
- Timestamp:
- Jan 25, 2007, 7:10:31 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase3.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase3.pl
r11298 r11316 12 12 use Statistics::Descriptive; 13 13 14 use PS::IPP::Config; 14 use PS::IPP::Config qw( 15 $PS_EXIT_SUCCESS 16 $PS_EXIT_UNKNOWN_ERROR 17 $PS_EXIT_SYS_ERROR 18 $PS_EXIT_CONFIG_ERROR 19 $PS_EXIT_PROG_ERROR 20 $PS_EXIT_DATA_ERROR 21 $PS_EXIT_TIMEOUT_ERROR 22 ); 15 23 my $ipprc = PS::IPP::Config->new(); # IPP configuration 16 24 use File::Spec; … … 45 53 my $p3tool = can_run('p3tool') or (warn "Can't find p3tool" and $missing_tools = 1); 46 54 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 47 die "Can't find required tools.\n" if $missing_tools; 55 if ($missing_tools) { 56 warn("Can't find required tools."); 57 exit($PS_EXIT_CONFIG_ERROR); 58 } 48 59 49 60 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 56 67 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 57 68 run(command => $command, verbose => 1); 58 die "Unable to perform p3tool -pendingimfile: $error_code\n" if not $success; 59 my $metadata = $mdcParser->parse(join "", @$stdout_buf) 60 or die "unable to parse metadata config doc"; 61 $files = parse_md_list($metadata); 69 unless ($success) { 70 $error_code >> 8; 71 &my_die("Unable to perform p3tool: $error_code", $exp_tag, $error_code); 72 } 73 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 74 &my_die("Unable to parse metadata config doc", $exp_tag, $PS_EXIT_PROG_ERROR); 75 $files = parse_md_list($metadata) or 76 &my_die("Unable to parse metadata list", $exp_tag, $PS_EXIT_PROG_ERROR); 62 77 } 63 78 … … 74 89 # my @zp; # Array of photometric zero points 75 90 foreach my $file (@$files) { 76 die "Unable to find class id\n"unless defined $file->{class_id};91 &my_die("Unable to find class id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id}; 77 92 my $class_id = $file->{class_id}; 78 die "Unable to find bg for class_id=$class_id\n"unless defined $file->{bg};79 die "Unable to find bg_mean_stdev for class_id=$class_id\n"unless defined $file->{bg_mean_stdev};80 # die "Unable to find sigma_ra for class_id=$class_id\n"unless defined $file->{sigma_ra};81 # die "Unable to find sigma_dec for class_id=$class_id\n"unless defined $file->{sigma_dec};82 # die "Unable to find zp for class_id=$class_id\n"unless defined $file->{zp};93 &my_die("Unable to find bg for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg}; 94 &my_die("Unable to find bg_mean_stdev for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev}; 95 # &my_die("Unable to find sigma_ra for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra}; 96 # &my_die("Unable to find sigma_dec for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec}; 97 # &my_die("Unable to find zp for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{zp}; 83 98 push @backgrounds, $file->{bg}; 84 99 push @variances, $file->{bg_stdev}**2; … … 132 147 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 133 148 run(command => $command, verbose => 1); 134 die "Unable to find expected output file: $jpeg1\n" if not -f $jpeg1; 149 unless ($success) { 150 $error_code >> 8; 151 &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code); 152 } 153 &my_die("Unable to find expected output file: $jpeg1", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg1; 135 154 } 136 155 … … 140 159 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 141 160 run(command => $command, verbose => 1); 142 die "Unable to find expected output file: $jpeg2\n" if not -f $jpeg2; 161 unless ($success) { 162 $error_code >> 8; 163 &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code); 164 } 165 &my_die("Unable to find expected output file: $jpeg2", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2; 143 166 } 144 167 … … 156 179 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 157 180 run(command => $command, verbose => 1); 158 die "Unable to perform p3tool -addprocessedexp: $error_code\n" if not $success; 181 unless ($success) { 182 $error_code >> 8; 183 warn("Unable to perform dettool -addprocessedexp: $error_code\n"); 184 exit($error_code); 185 } 159 186 160 187 unlink $list1Name; 161 188 unlink $list2Name; 162 189 } 190 191 192 sub my_die 193 { 194 my $msg = shift; # Warning message on die 195 my $exp_tag = shift; # Exposure tag 196 my $exit_code = shift; # Exit code to add 197 198 warn($msg); 199 if ($exp_tag) { 200 my $command = "$dettool -addprocessedexp -exp_tag $exp_tag -code $exit_code"; 201 $command .= " -dbname $dbname" if defined $dbname; 202 system ($command); 203 } 204 exit $exit_code; 205 } 206 163 207 164 208 END {
Note:
See TracChangeset
for help on using the changeset viewer.
