Changeset 30182
- Timestamp:
- Dec 26, 2010, 7:00:18 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/register_imfile.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/register_imfile.pl
r30144 r30182 84 84 85 85 my $cmdflags; 86 my $burntoolState Good;87 my $burntoolState ;86 my $burntoolStateTarget; 87 my $burntoolStateCurrent; 88 88 # Run ppStats on the input file 89 89 { … … 116 116 117 117 # Manually parse the burntool_state entry. 118 $burntoolState = 0;118 $burntoolStateCurrent = 0; 119 119 my $isGPC1 = 0; 120 $burntoolState Good= 0;120 $burntoolStateTarget = 0; 121 121 foreach my $line (split /\n/, $out1) { 122 122 if ($line =~ /FPA.BURNTOOL.APPLIED/) { 123 123 $line =~ s/^\s+//; 124 $burntoolState = (split /\s+/, $line)[2];124 $burntoolStateCurrent = (split /\s+/, $line)[2]; 125 125 } 126 126 if ($line =~ /FPA.CAMERA/) { … … 132 132 } 133 133 if ($isGPC1 != 1) { 134 $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.135 } 136 elsif (($isGPC1 == 1) && ($burntoolState == 1)) {137 # print STDERR "In the good region: >>$burntoolState <<\n";134 $burntoolStateCurrent = 0; # If it's not GPC1, you shouldn't have run burntool. 135 } 136 elsif (($isGPC1 == 1) && ($burntoolStateCurrent == 1)) { 137 # print STDERR "In the good region: >>$burntoolStateCurrent<<\n"; 138 138 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -"; 139 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 149 149 if ($line =~ /BURNTOOL.STATE.GOOD/) { 150 150 $line =~ s/^\s+//; 151 $burntoolState Good= (split /\s+/, $line)[2];151 $burntoolStateTarget = (split /\s+/, $line)[2]; 152 152 last; 153 153 } 154 154 } 155 $burntoolState = $burntoolStateGood; # Positive because this has the header table. 156 157 } 158 $cmdflags .= " -burntool_state $burntoolState "; 155 # XXX why was this being equated?? 156 # $burntoolState = $burntoolStateGood; # Positive because this has the header table. 157 158 } 159 $cmdflags .= " -burntool_state $burntoolStateTarget "; 159 160 } 160 161 161 162 $now_time = localtime(); 162 163 printf STDERR "\ndone with ppStats: %s\n", $now_time if $verbose; 164 printf STDERR "\nburntool state current: %d target: %d\n", $burntoolStateCurrent, $burntoolStateTarget; 163 165 164 166 # we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type … … 178 180 $command .= " -hostname $host" if defined $host; 179 181 $command .= " -dbname $dbname" if defined $dbname; 180 if (abs($burntoolState ) == $burntoolStateGood) {182 if (abs($burntoolStateCurrent) == $burntoolStateTarget) { 181 183 $command .= " -data_state full"; 182 184 } … … 222 224 # lock file? 223 225 # if exp_type = DARK and date > MIDNIGHT HST { wait } 224 # system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log"); 226 # system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log"); 225 227 226 228 $now_time = localtime(); … … 242 244 # We now have an imfile in the database, check if we can burntool it. If not, continue on. 243 245 244 if (abs($burntoolState ) != $burntoolStateGood) {246 if (abs($burntoolStateCurrent) != $burntoolStateTarget) { 245 247 my $mdcParser = PS::IPP::Metadata::Config->new; 246 248 … … 249 251 $check_date =~ s/T.*$//; 250 252 my $exp_name = $tmp_exp_name; 251 253 252 254 253 255 my $bt_check_command = "$regtool -checkburntoolimfile "; 254 256 $bt_check_command .= " -class_id $class_id "; 255 257 $bt_check_command .= " -date $check_date "; 256 $bt_check_command .= " -valid_burntool $burntoolState Good";258 $bt_check_command .= " -valid_burntool $burntoolStateTarget "; 257 259 $bt_check_command .= " -exp_name $exp_name "; 258 260 $bt_check_command .= " -dbname $dbname" if defined $dbname; 259 261 260 262 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 261 run ( command => $bt_check_command, verbose => $verbose);263 run ( command => $bt_check_command, verbose => $verbose); 262 264 unless ($success) { 263 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);264 &my_die_for_update("Unable to perform regtool: $error_code", 265 $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR);265 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 266 &my_die_for_update("Unable to perform regtool: $error_code", 267 $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR); 266 268 } 267 269 … … 270 272 my $exposures; 271 273 while ( scalar @whole > 0 ) { 272 my $value = shift @whole;273 push @single, $value;274 if ($value =~ /^\s*END\s*$/) {275 push @single, "\n";276 277 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) );278 &my_die_for_update("Unable to parse output from regtool", 279 $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR) unless280 defined $list;281 push @{ $exposures }, @$list;282 @single = ();283 }284 } 285 274 my $value = shift @whole; 275 push @single, $value; 276 if ($value =~ /^\s*END\s*$/) { 277 push @single, "\n"; 278 279 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ); 280 &my_die_for_update("Unable to parse output from regtool", 281 $exp_id, $exp_name, $class_id, $PS_EXIT_SYS_ERROR) unless 282 defined $list; 283 push @{ $exposures }, @$list; 284 @single = (); 285 } 286 } 287 286 288 # We only care about the final entry, as that contains the exposure we are. 287 289 288 290 my $regtool_update = "$regtool -updateprocessedimfile "; 289 291 $regtool_update .= "-dbname $dbname " if defined $dbname; … … 292 294 my $burntool_data = pop(@{ $exposures }); 293 295 if ($burntool_data->{burnable} == 0) { 294 $regtool_update .= " -burntool_state 0 -set_state pending_burntool ";295 unless ($no_update) {296 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =297 IPC::Cmd::run(command => $regtool_update, verbose => $verbose);298 unless ($success) {299 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);300 warn ("Unable to perform regtool -addprocessedimfile: $error_code");301 exit($error_code);302 }303 } else {304 print "skipping command: $command\n";305 }296 $regtool_update .= " -burntool_state 0 -set_state pending_burntool "; 297 unless ($no_update) { 298 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 299 IPC::Cmd::run(command => $regtool_update, verbose => $verbose); 300 unless ($success) { 301 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 302 warn ("Unable to perform regtool -addprocessedimfile: $error_code"); 303 exit($error_code); 304 } 305 } else { 306 print "skipping command: $command\n"; 307 } 306 308 } 307 309 else { 308 my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname ";309 $apply_command .= " --class_id $class_id --exp_id $exp_id ";310 $apply_command .= " --this_uri $burntool_data->{uri} ";311 $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri};312 $apply_command .= " --imfile_state $burntool_data->{imfile_state} ";313 $apply_command .= " --verbose " if $verbose;314 print "$apply_command\n";315 unless ($no_update) {316 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =317 IPC::Cmd::run(command => $apply_command, verbose => $verbose);318 unless ($success) {319 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);320 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code");321 exit($error_code);322 }323 }324 } 310 my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname "; 311 $apply_command .= " --class_id $class_id --exp_id $exp_id "; 312 $apply_command .= " --this_uri $burntool_data->{uri} "; 313 $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri}; 314 $apply_command .= " --imfile_state $burntool_data->{imfile_state} "; 315 $apply_command .= " --verbose " if $verbose; 316 print "$apply_command\n"; 317 unless ($no_update) { 318 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 319 IPC::Cmd::run(command => $apply_command, verbose => $verbose); 320 unless ($success) { 321 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 322 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code"); 323 exit($error_code); 324 } 325 } 326 } 325 327 326 328
Note:
See TracChangeset
for help on using the changeset viewer.
