Changeset 42646
- Timestamp:
- Apr 1, 2024, 2:26:58 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl
r42458 r42646 15 15 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 16 16 use Pod::Usage qw( pod2usage ); 17 18 use Sys::Hostname; 19 my $host = hostname(); 20 my $date = `date`; 21 print "\n\n"; 22 print "Starting script $0 on $host at $date\n\n"; 17 23 18 24 my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $dbname, $logfile, $verbose, $save_temps, $rerun, $psvidOutput); … … 65 71 $ipprc->redirect_output($logfile) if $logfile; 66 72 67 # Determine the value of a "good" burntool run. 68 # XXX this program should always generate the latest version 69 # but the processing system must be told to use an earlier version 70 # until the newer version is validated. Perhaps split these. 71 my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD"; 72 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 73 run ( command => $config_cmd, verbose => $verbose); 74 unless ($success) { 75 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 76 &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 77 } 78 79 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 80 &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 81 82 my $burntoolStateGood = 999; 83 foreach my $cfg (@$recipeData) { 84 if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') { 85 $burntoolStateGood = $cfg->{value}; 86 } 87 } 88 if ($burntoolStateGood == 999) { 89 &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR); 73 my $burntoolStateGood = 15; 74 if (0) { 75 # Determine the value of a "good" burntool run. 76 # XXX this program should always generate the latest version 77 # but the processing system must be told to use an earlier version 78 # until the newer version is validated. Perhaps split these. 79 80 my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD"; 81 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 82 run ( command => $config_cmd, verbose => $verbose); 83 unless ($success) { 84 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 85 &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 86 } 87 88 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 89 &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 90 91 my $burntoolStateGood = 999; 92 foreach my $cfg (@$recipeData) { 93 if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') { 94 $burntoolStateGood = $cfg->{value}; 95 } 96 } 97 if ($burntoolStateGood == 999) { 98 &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR); 99 } 90 100 } 91 101 my $outState = -1 * abs($burntoolStateGood); 92 102 93 103 print "Target burntool version: $burntoolStateGood\n"; 104 if ($burntoolStateGood != 15) { &my_die ("burntool state is not set to 15\n"); } 94 105 95 106 # Define list of images to examine. … … 101 112 $command .= " -dbname $dbname" if defined $dbname; 102 113 103 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =114 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 115 run ( command => $command, verbose => $verbose); 105 116 unless ($success) { … … 144 155 my $rawImfile = $file->{uri}; 145 156 my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0); 157 if (not defined $rawImfileReal) { 158 print "DEAD: $rawImfile, no valid instances found\n"; 159 next; 160 } 146 161 147 162 my $outTable = $file->{uri}; 148 163 164 my $data_state = $file->{data_state}; 165 if ($data_state eq "lossy") { 166 print "## skipping $rawImfile : data_state $data_state\n"; 167 next; 168 } 169 149 170 if($burntoolStateGood == 15) { 150 171 $outTable =~ s/fits$/burn.v15.tbl/; … … 200 221 $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN); 201 222 if ($status) { 223 print "FAIL: funpack fails for $rawImfile\n"; 202 224 &my_die("failed on funpack",$exp_id,$class_id); 203 225 } … … 210 232 } 211 233 if ($status) { 234 print STDERR "BURN: burntool failed for $exp_id $class_id\n"; 212 235 &my_die("failed on burntool",$exp_id,$class_id); 213 236 } … … 269 292 sub my_die { 270 293 my $message = shift; 294 printf STDERR "$message\n"; 271 295 if ($#_ != -1) { 272 296 my $exp_id = shift; … … 274 298 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1); 275 299 } 276 print f STDERR "$message\n";300 print STDERR "updated database with burntool state -3\n"; 277 301 exit 1; 278 302 }
Note:
See TracChangeset
for help on using the changeset viewer.
