Changeset 26721
- Timestamp:
- Jan 29, 2010, 10:51:08 AM (16 years ago)
- Location:
- branches/eam_branches/20091201/ippScripts
- Files:
-
- 2 added
- 6 edited
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
scripts/automate_stacks.pl (added)
-
scripts/dqstats_bundle.pl (added)
-
scripts/ipp_cleanup.pl (modified) (5 diffs)
-
scripts/magic_destreak.pl (modified) (13 diffs)
-
scripts/magic_destreak_cleanup.pl (modified) (4 diffs)
-
scripts/magic_destreak_revert.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ippScripts/Build.PL
r26290 r26721 98 98 scripts/rcserver_checkstatus.pl 99 99 scripts/publish_file.pl 100 scripts/dqstats_bundle.pl 100 101 scripts/whichimage 102 scripts/automate_stacks.pl 101 103 )], 102 104 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
branches/eam_branches/20091201/ippScripts/MANIFEST
r18564 r26721 36 36 scripts/isp_trans.pl 37 37 scripts/ds9_cmf_regions.pl 38 scripts/automate_stacks.pl 38 39 t/00_distribution.t -
branches/eam_branches/20091201/ippScripts/scripts/ipp_cleanup.pl
r25837 r26721 190 190 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 191 191 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 192 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 192 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 193 $command .= " -dbname $dbname" if defined $dbname; 193 194 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 194 195 run(command => $command, verbose => $verbose); … … 309 310 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 310 311 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 311 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 312 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 313 $command .= " -dbname $dbname" if defined $dbname; 312 314 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 313 315 run(command => $command, verbose => $verbose); … … 444 446 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 445 447 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 446 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 448 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 449 $command .= " -dbname $dbname" if defined $dbname; 447 450 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 448 451 run(command => $command, verbose => $verbose); … … 580 583 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 581 584 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 582 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 585 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 586 $command .= " -dbname $dbname" if defined $dbname; 583 587 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 584 588 run(command => $command, verbose => $verbose); … … 732 736 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 733 737 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 734 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 738 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned"; 739 $command .= " -dbname $dbname" if defined $dbname; 735 740 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 736 741 run(command => $command, verbose => $verbose); -
branches/eam_branches/20091201/ippScripts/scripts/magic_destreak.pl
r25029 r26721 15 15 16 16 use IPC::Cmd 0.36 qw( can_run run ); 17 use File::Temp qw( tempfile );17 use File::Temp qw( tempfile tempdir ); 18 18 use File::Basename qw( basename dirname ); 19 19 use PS::IPP::Metadata::Config; … … 32 32 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 33 33 my $censorObjects = can_run('censorObjects') or (warn "Can't find censorObjects" and $missing_tools = 1); 34 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 34 35 if ($missing_tools) { 35 36 warn("Can't find required tools."); … … 38 39 39 40 # Parse the command-line arguments 40 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $ stage, $stage_id, $component, $uri, $path_base, $cam_path_base);41 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base); 41 42 my ($outroot, $recoveryroot); 42 43 my ($replace, $release); … … 48 49 'streaks=s' => \$streaks, # file containing the list of streaks 49 50 'inv_streaks=s' => \$inv_streaks,# file containing the list of streaks from the inverse diff 51 'exp_id=s' => \$exp_id, # exp_id, chip_id, warp_id, or diff_id 50 52 'stage=s' => \$stage, # raw, chip, warp, or diff 51 53 'stage_id=s' => \$stage_id, # exp_id, chip_id, warp_id, or diff_id … … 74 76 defined $stage and 75 77 defined $stage_id and 78 defined $exp_id and 76 79 defined $component and 77 80 defined $uri and … … 145 148 } 146 149 } 150 151 my $statsFile = "$outroot/$exp_id.mds.$magic_ds_id.$stage_id.$component.stats"; 147 152 148 153 my $backup_path_base; … … 166 171 if (! -e $recoveryroot ) { 167 172 my $code = system "mkdir -p $recoveryroot"; 168 &my_die("cannot create output directory $ outroot", $magic_ds_id, $component,173 &my_die("cannot create output directory $recoveryroot", $magic_ds_id, $component, 169 174 $code >> 8) if $code; 170 175 } … … 173 178 $recovery_path_base = "$recoveryroot/$basename/"; 174 179 } 180 181 my $temp_dir; 175 182 176 183 if ($stage ne "camera") { … … 195 202 &my_die("Unable to parse metadata list", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 196 203 204 $temp_dir = tempdir( CLEANUP => !$save_temps); 197 205 ($sfh, $skycell_list) = tempfile( "/tmp/skycell_list.XXXX", UNLINK => !$save_temps); 198 206 199 207 foreach my $skycell (@$skycells) { 200 my $skycell_uri = $ipprc->filename("PPSUB.OUTPUT", $skycell->{path_base}); 208 my $skycell_uri; 209 if ($skycell->{data_state} eq "full") { 210 $skycell_uri = $ipprc->filename("PPSUB.OUTPUT", $skycell->{path_base}); 211 } else { 212 # diff run must have been cleaned up, need to create this skycell file on the fly 213 my $skycell_id = $skycell->{skycell_id}; 214 $skycell_uri = "$temp_dir/$skycell_id"; 215 $ipprc->skycell_file($skycell->{tess_id}, $skycell_id, $skycell_uri, $verbose) or 216 &my_die("failed to create skycell file for $skycell_id", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 217 } 201 218 print $sfh "$skycell_uri\n"; 202 219 } 203 close $sfh ;220 close $sfh 204 221 } 205 222 } … … 260 277 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image"; 261 278 279 $command .= " -stats $statsFile"; 262 280 $command .= " -class_id $class_id" if defined $class_id; 263 281 $command .= " -recovery $recoveryroot" if defined $recoveryroot; … … 288 306 $sources = $ipprc->filename("PPSUB.INVERSE.SOURCES", $path_base); 289 307 308 # Note: we create a stats file for the inverse procesing but we don't look at the results 309 my $invStatsFile = "$outroot/$exp_id.mds.$magic_ds_id.$stage_id.$component.inv.stats"; 310 290 311 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image"; 312 $command .= " -stats $invStatsFile"; 291 313 292 314 $command .= " -recovery $recoveryroot" if defined $recoveryroot; … … 371 393 } 372 394 373 # if recovery and/or backup files were expected make sure they exist 395 my $statsFlags; 396 if ($stage ne "camera") { 397 file_check($statsFile); 398 { 399 my $resolvedStatsFile = $ipprc->file_resolve($statsFile); 400 my $command = "$ppStatsFromMetadata $resolvedStatsFile - STREAKSREMOVE"; 401 402 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 403 run(command => $command, verbose => $verbose); 404 unless ($success) { 405 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 406 &my_die("Unable to perform ppStatsFromMetadata: $error_code", $magic_ds_id, $component, $error_code); 407 } 408 foreach my $line (@$stdout_buf) { 409 $statsFlags .= " $line"; 410 } 411 chomp $statsFlags; 412 } 413 } 414 415 # XXX: if recovery and/or backup files were expected make sure they exist 374 416 375 417 # Input result into database … … 381 423 $command .= " -backup_path_base $backup_path_base" if $backup_path_base; 382 424 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base; 425 $command .= " $statsFlags" if $statsFlags; 383 426 $command .= " -dbname $dbname" if defined $dbname; 384 427 -
branches/eam_branches/20091201/ippScripts/scripts/magic_destreak_cleanup.pl
r25837 r26721 183 183 } 184 184 185 delete_files($rimage, $rmask, $rweight, $rsources, $rastrom, $bimage, $bmask, $bweight, $bsources, $bastrom );185 delete_files($rimage, $rmask, $rweight, $rsources, $rastrom, $bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask); 186 186 187 187 if ($stage eq "diff" and $inverse) { … … 199 199 $rsources = $ipprc->filename("$name.SOURCES", $recovery_path_base); 200 200 } 201 delete_files($rimage, $rmask, $rweight, $rsources, undef, $bimage, $bmask, $bweight, $bsources, undef); 201 # undef is not necessary, it's just to keep the lists in the same order. 202 delete_files($rimage, $rmask, $rweight, $rsources, undef, $bimage, $bmask, $bweight, $bsources); 202 203 } 203 204 } … … 211 212 if (!$no_update) { 212 213 my $result = $dbh->do("UPDATE magicDSRun SET state = 'cleaned' WHERE magic_ds_id = ?", undef, $magic_ds_id); 213 my_die("attempt to update magicDSRun failed", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR) if $result eq "0E0";214 my_die("attempt to update magicDSRun.state failed", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR) if $result eq "0E0"; 214 215 } else { 215 216 print STDERR "skipping update of magicDSRun\n"; … … 246 247 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 247 248 248 my $command = "$magicdstool -updaterun - fault $exit_code";249 my $command = "$magicdstool -updaterun -set_state failed_cleanup"; 249 250 $command .= " -magic_ds_id $magic_ds_id"; 250 251 $command .= " -dbname $dbname" if defined $dbname; -
branches/eam_branches/20091201/ippScripts/scripts/magic_destreak_revert.pl
r26290 r26721 294 294 run(command => $command, verbose => $verbose); 295 295 296 if (!defined $error_code) { 297 print STDERR "run( $command ) returned undef error_code!!!!!\n"; 298 return $PS_EXIT_UNKNOWN_ERROR; 299 } 296 300 return $error_code >> 8; 297 301 } … … 392 396 my $command = "$magicdstool -updaterun"; 393 397 $command .= " -magic_ds_id $magic_ds_id"; 394 $command .= " - fault $exit_code";398 $command .= " -set_state failed_revert"; 395 399 $command .= " -dbname $dbname" if defined $dbname; 396 400
Note:
See TracChangeset
for help on using the changeset viewer.
