Changeset 12021 for trunk/ippScripts/scripts/diff_skycell.pl
- Timestamp:
- Feb 23, 2007, 3:12:46 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/diff_skycell.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/diff_skycell.pl
r12013 r12021 33 33 use Pod::Usage qw( pod2usage ); 34 34 35 my ($ p5_id, $camera, $dbname, $workdir, $no_update, $no_op);35 my ($diff_id, $camera, $dbname, $workdir, $no_update, $no_op); 36 36 GetOptions( 37 ' p5_id|d=s' => \$p5_id, # Phase 5identifier37 'diff_id|d=s' => \$diff_id, # Diff identifier 38 38 'camera|c=s' => \$camera, # Camera name 39 39 'dbname|d=s' => \$dbname, # Database name … … 45 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 46 pod2usage( 47 -msg => "Required options: -- p5_id --camera",47 -msg => "Required options: --diff_id --camera", 48 48 -exitval => 3, 49 ) unless defined $ p5_id49 ) unless defined $diff_id 50 50 and defined $camera; 51 51 … … 54 54 # Look for programs we need 55 55 my $missing_tools; 56 my $difftool = can_run(' p5tool') or (warn "Can't find p5tool" and $missing_tools = 1);56 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 57 57 my $pois = can_run('pois') or (warn "Can't find pois" and $missing_tools = 1); 58 58 if ($missing_tools) { … … 65 65 my $files; 66 66 { 67 my $command = "$difftool -inputscfile - p5_id $p5_id";67 my $command = "$difftool -inputscfile -diff_id $diff_id"; 68 68 $command .= " -dbname $dbname" if defined $dbname; 69 69 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 71 71 unless ($success) { 72 72 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 73 &my_die("Unable to perform difftool -inputscfile: $error_code", $ p5_id, $error_code);73 &my_die("Unable to perform difftool -inputscfile: $error_code", $diff_id, $error_code); 74 74 } 75 75 76 76 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 77 &my_die("Unable to parse metadata config doc", $ p5_id, $PS_EXIT_PROG_ERROR);77 &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR); 78 78 $files = parse_md_list($metadata) or 79 &my_die("Unable to parse metadata list", $ p5_id, $PS_EXIT_PROG_ERROR);80 } 81 82 &my_die("Subtraction list contains more than two elements", $ p5_id, $PS_EXIT_SYS_ERROR) unless79 &my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR); 80 } 81 82 &my_die("Subtraction list contains more than two elements", $diff_id, $PS_EXIT_SYS_ERROR) unless 83 83 scalar @$files == 2; 84 84 … … 95 95 } 96 96 if (defined $skycell_id) { 97 &my_die("Skycell identifiers don't match", $ p5_id, $PS_EXIT_SYS_ERROR) unless97 &my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless 98 98 $file->{skycell_id} eq $skycell_id; 99 99 } else { … … 102 102 } 103 103 104 &my_die("Unable to identify template", $ p5_id, $PS_EXIT_SYS_ERROR) unless defined $template;105 &my_die("Unable to identify input", $ p5_id, $PS_EXIT_SYS_ERROR) unless defined $input;104 &my_die("Unable to identify template", $diff_id, $PS_EXIT_SYS_ERROR) unless defined $template; 105 &my_die("Unable to identify input", $diff_id, $PS_EXIT_SYS_ERROR) unless defined $input; 106 106 107 107 ### Working directory … … 114 114 115 115 # Get the output filenames 116 my $outputFile = "$skycell_id.sub.$ p5_id"; # Root name116 my $outputFile = "$skycell_id.sub.$diff_id"; # Root name 117 117 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 118 118 … … 131 131 unless ($success) { 132 132 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 133 &my_die("Unable to perform ppImage: $error_code", $ p5_id, $error_code);134 } 135 &my_die("Couldn't find expected output file: $outputName", $ p5_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;136 # &my_die("Couldn't find expected output file: $bin1Name", $ p5_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;137 # &my_die("Couldn't find expected output file: $bin2Name", $ p5_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;138 # &my_die("Couldn't find expected output file: $outputStats", $ p5_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;133 &my_die("Unable to perform ppImage: $error_code", $diff_id, $error_code); 134 } 135 &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $outputName; 136 # &my_die("Couldn't find expected output file: $bin1Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name; 137 # &my_die("Couldn't find expected output file: $bin2Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name; 138 # &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 139 139 140 140 # Get the statistics on the residual image 141 141 if (0) { ### Disabled because pois doesn't output stats yet 142 142 my $statsFile; # File handle 143 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $ p5_id, $PS_EXIT_SYS_ERROR);143 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR); 144 144 my @contents = <$statsFile>; # Contents of file 145 145 close $statsFile; 146 146 my $metadata = $mdcParser->parse(join "", @contents) or 147 &my_die("Unable to parse metadata config doc", $ p5_id, $PS_EXIT_PROG_ERROR);148 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $ p5_id, $PS_EXIT_PROG_ERROR);147 &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR); 148 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $diff_id, $PS_EXIT_PROG_ERROR); 149 149 } 150 150 } … … 160 160 # Add the subtraction result 161 161 { 162 my $command = "$difftool -adddiffscfile - p5_id $p5_id -uri $outputName -b1_uri $outputRoot";162 my $command = "$difftool -adddiffscfile -diff_id $diff_id -uri $outputName -b1_uri $outputRoot"; 163 163 $command .= " -bg $bg -bg_stdev $bg_stdev"; 164 164 $command .= " -dbname $dbname" if defined $dbname; … … 168 168 unless ($success) { 169 169 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 170 &my_die("Unable to perform difftool -adddiffscfile: $error_code", $ p5_id, $error_code);170 &my_die("Unable to perform difftool -adddiffscfile: $error_code", $diff_id, $error_code); 171 171 } 172 172 … … 176 176 # Register the run as completed 177 177 { 178 my $command = "$difftool -updaterun - p5_id $p5_id -state stop"; # Command to run p5tool178 my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool 179 179 $command .= " -dbname $dbname" if defined $dbname; 180 180 … … 193 193 { 194 194 my $msg = shift; # Warning message on die 195 my $ p5_id = shift; # Phase 5identifier195 my $diff_id = shift; # Diff identifier 196 196 my $exit_code = shift; # Exit code to add 197 197 198 198 warn($msg); 199 if ($ p5_id and not $no_update) {200 my $command = "$difftool -updaterun - p5_id $p5_id -state stop -code $exit_code";199 if ($diff_id and not $no_update) { 200 my $command = "$difftool -updaterun -diff_id $diff_id -state stop -code $exit_code"; 201 201 $command .= " -dbname $dbname" if defined $dbname; 202 202 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
