Changeset 19397
- Timestamp:
- Sep 5, 2008, 12:39:33 PM (18 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 2 edited
-
chip_imfile.pl (modified) (5 diffs)
-
ipp_cleanup.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/chip_imfile.pl
r19333 r19397 59 59 60 60 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 61 $logDest .= "_update" if $run_state eq "update"; 61 62 62 63 $ipprc->redirect_output($logDest) if $redirect; … … 134 135 my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 135 136 my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 137 my $configuration = $ipprc->filename("PPIMAGE.CONFIG", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 136 138 137 139 # Run ppImage … … 140 142 ## XXX also stats: output should be implied by $outroot 141 143 my $command; 144 my $do_stats = 1; 142 145 143 146 if ($run_state eq "new") { 144 147 $command = "$ppImage -file $uri $outroot"; 145 148 $command .= " -recipe PPIMAGE $recipe"; 149 $command .= " -threads $threads" if defined $threads; 150 $command .= " -dbname $dbname" if defined $dbname; 151 $command .= " -dumpconfig $configuration"; 152 $command .= " -tracedest $traceDest -log $logDest"; 153 } else { 154 155 $do_stats = 0; # XXX write stats to an alternate file and compare? 156 157 $command = "$ppImage -file $uri $outroot"; 158 $command .= " -ipprc $configuration"; 159 $command .= " -threads $threads" if defined $threads; 160 $command .= " -dbname $dbname" if defined $dbname; 161 $command .= " -tracedest ${traceDest}_update -log $logDest"; 162 $command .= " -Db PPIMAGE:PHOTOM FALSE"; 163 } 164 if ($do_stats) { 146 165 $command .= " -recipe PPSTATS CHIPSTATS"; 147 166 $command .= " -stats $outputStats"; 148 $command .= " -threads $threads" if defined $threads;149 $command .= " -dbname $dbname" if defined $dbname;150 $command .= " -tracedest $traceDest -log $logDest";151 } else {152 ## for the UPDATE processing, we need to determine the config file153 my $configuration = $ipprc->filename("PPIMAGE.CONFIG", $outroot, $class_id) or154 &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);155 156 $command = "$ppImage -file $uri $outroot";157 $command .= " -ipprc $configuration";158 # $command .= " -stats $outputStats"; XXX write stats to an alternate file and compare?159 $command .= " -threads $threads" if defined $threads;160 $command .= " -dbname $dbname" if defined $dbname;161 # $command .= " -tracedest $traceDest -log $logDest"; XXX use an alternate trace and log file?162 $command .= "-Db PPIMAGE:PHOTOM FALSE";163 167 } 164 168 … … 199 203 &my_die("Couldn't find expected output file: $outputBin1\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1); 200 204 &my_die("Couldn't find expected output file: $outputBin2\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2); 201 &my_die("Couldn't find expected output file: $outputStats\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats); 202 203 # Get the statistics on the processed image 204 my $statsFile; # File handle 205 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 206 my @contents = <$statsFile>; # Contents of file 207 close $statsFile; 208 209 # parse the statistics MDC file 210 my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files 211 my $metadata = $mdcParser->parse(join "", @contents); 212 unless ($metadata) { 213 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 214 } 215 216 # extract the stats from the metadata 217 unless ($stats->parse($metadata)) { 218 &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 219 } 220 } 221 222 # command to update database 223 my $command = "$chiptool -addprocessedimfile"; 224 $command .= " -exp_id $exp_id"; 225 $command .= " -chip_id $chip_id"; 226 $command .= " -class_id $class_id"; 227 $command .= " -uri $outputImage"; 228 $command .= " -path_base $outroot"; 229 $command .= " -hostname $host" if defined $host; 230 $command .= " -dbname $dbname" if defined $dbname; 231 $command .= $stats->cmdflags(); 205 206 if ($do_stats) { 207 &my_die("Couldn't find expected output file: $outputStats\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats); 208 209 # Get the statistics on the processed image 210 my $statsFile; # File handle 211 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 212 my @contents = <$statsFile>; # Contents of file 213 close $statsFile; 214 215 # parse the statistics MDC file 216 my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files 217 my $metadata = $mdcParser->parse(join "", @contents); 218 unless ($metadata) { 219 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 220 } 221 222 # extract the stats from the metadata 223 unless ($stats->parse($metadata)) { 224 &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 225 } 226 } 227 } 228 229 my $command; 230 if ($run_state eq 'new') { 231 # command to update database 232 $command = "$chiptool -addprocessedimfile"; 233 $command .= " -exp_id $exp_id"; 234 $command .= " -chip_id $chip_id"; 235 $command .= " -class_id $class_id"; 236 $command .= " -uri $outputImage"; 237 $command .= " -path_base $outroot"; 238 $command .= " -hostname $host" if defined $host; 239 $command .= " -dbname $dbname" if defined $dbname; 240 $command .= $stats->cmdflags(); 241 } else { 242 $command = "$chiptool -tofullimfile"; 243 $command .= " -chip_id $chip_id"; 244 $command .= " -class_id $class_id"; 245 $command .= " -dbname $dbname" if defined $dbname; 246 } 232 247 233 248 # Add the processed file to the database … … 251 266 my $class_id = shift; # Class identifier 252 267 my $exit_code = shift; # Exit code to add 253 # outputImageand outroot are globals268 # run_state, outputImage, and outroot are globals 254 269 255 270 carp($msg); 256 271 if (defined $chip_id and defined $class_id and not $no_update) { 257 my $command = "$chiptool -addprocessedimfile"; 258 $command .= " -exp_id $exp_id"; 272 my $command; 273 if ($run_state eq 'new') { 274 $command = "$chiptool -addprocessedimfile"; 275 $command .= " -exp_id $exp_id"; 276 $command .= " -uri $outputImage"; 277 $command .= " -path_base $outroot"; 278 $command .= " -hostname $host" if defined $host; 279 } else { 280 $command .= "$chiptool -updateprocessedimfile"; 281 } 259 282 $command .= " -chip_id $chip_id"; 260 283 $command .= " -class_id $class_id"; 261 284 $command .= " -code $exit_code"; 262 $command .= " -uri $outputImage";263 $command .= " -path_base $outroot";264 $command .= " -hostname $host" if defined $host;265 285 $command .= " -dbname $dbname" if defined $dbname; 266 286 system ($command); -
trunk/ippScripts/scripts/ipp_cleanup.pl
r18994 r19397 110 110 my $status = &delete_files (\@files); 111 111 112 if (! $status) { 113 my $command = "$chiptool -updateimfile -chip_id $stage_id -class_id $class_id -code 1"; # Command to run 112 if ($status) { 113 my $command = "$chiptool -chip_id $stage_id -class_id $class_id"; 114 if ($mode eq "goto_purged") { 115 $command .= " -topurgedimfile"; 116 } else { 117 $command .= " -tocleanedimfile"; 118 } 114 119 $command .= " -dbname $dbname" if defined $dbname; 115 120 … … 119 124 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 120 125 } 121 126 } else { 127 my $command = "$chiptool -updateimfile -chip_id $stage_id -class_id $class_id -code 1"; 128 $command .= " -dbname $dbname" if defined $dbname; 129 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 131 unless ($success) { 132 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 133 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 134 } 122 135 $fault = 1; 123 136 } 124 137 } 138 139 if (0) { 140 # This block is not necessary 141 # chiptool -tocleanedimfile and -topurgedimfile automatically update chipRun when the 142 # last image gets set to purged or cleaned 125 143 126 144 if (! $fault) { … … 140 158 } 141 159 } 160 } 142 161 exit 0; 143 162 }
Note:
See TracChangeset
for help on using the changeset viewer.
