Changeset 29515 for branches/eam_branches/ipp-20100823/ippScripts
- Timestamp:
- Oct 21, 2010, 2:45:13 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100823/ippScripts/scripts
- Files:
-
- 6 edited
-
automate_stacks.pl (modified) (11 diffs)
-
ipp_apply_burntool.pl (modified) (2 diffs)
-
ipp_cleanup.pl (modified) (8 diffs)
-
magic_destreak.pl (modified) (9 diffs)
-
magic_process.pl (modified) (15 diffs)
-
magic_tree.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/ippScripts/scripts/automate_stacks.pl
r29124 r29515 124 124 defined $check_chips or defined $check_stacks or $check_sweetspot or $check_detrends or $check_dqstats or 125 125 defined $test_mode or defined $clean_old or defined $check_mode or 126 defined $confirm_stacks ;126 defined $confirm_stacks or defined $burntool_stats; 127 127 128 128 # Configurable parameters from our config file. 129 129 my @target_list = (); 130 130 my @filter_list = (); 131 my %distribution_list = (); 131 132 my %tessID_list = (); 132 133 my %obsmode_list = (); … … 135 136 my %cleanmods_list = (); 136 137 my %stackable_list = (); 138 my %extra_processing = (); 137 139 my %reduction_class = (); 138 140 my %macro_formats = (); … … 206 208 $this_target = ${ $tentry }{value}; 207 209 push @target_list, $this_target; 210 $distribution_list{$this_target} = $this_target; 211 } 212 elsif (${ $tentry }{name} eq 'DISTRIBUTION') { 213 $distribution_list{$this_target} = ${ $tentry }{value}; 208 214 } 209 215 elsif (${ $tentry }{name} eq 'TESS') { … … 222 228 $stackable_list{$this_target} = ${ $tentry }{value}; 223 229 } 230 elsif (${ $tentry }{name} eq 'EXTRA_PROCESSING') { 231 $extra_processing{$this_target} = ${ $tentry }{value}; 232 } 224 233 elsif (${ $tentry }{name} eq 'REDUCTION') { 225 234 $reduction_class{$this_target} = ${ $tentry }{value}; … … 726 735 my ($Nexposures,$Nimfiles,$Nburntooled,$Nalready) = pre_chip_queue($date,$target); 727 736 if (defined($burntool_stats)) { 728 print " $Nexposures $Nimfiles $Nburntooled $Nalready\n";737 print "BTSTATS: $date $target $Nexposures $Nimfiles $Nburntooled $Nalready\n"; 729 738 } 730 739 731 740 if ($Nexposures == 0) { 732 741 print STDERR "execute_chips: Target $target on $date had no exposures.\n"; 733 #next;742 next; 734 743 } 735 744 if ($Nalready != 0) { 736 745 print STDERR "execute_chips: Not queueing $target on $date due to already existing exposures.\n"; 737 #next;746 next; 738 747 } 739 748 if ($Nimfiles != $Nburntooled) { … … 1183 1192 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1184 1193 } 1194 1195 1185 1196 return(0); 1186 1197 } … … 1190 1201 my $pretend = shift; 1191 1202 foreach my $target (@target_list) { 1192 if ($stackable_list{$target} == 1) { 1193 foreach my $filter (@filter_list) { 1203 foreach my $filter (@filter_list) { 1204 if (exists($extra_processing{$target})) { 1205 do_extra_processing($date,$target,$filter,$pretend); 1206 } 1207 if ($stackable_list{$target} == 1) { 1194 1208 my ($Nexposures,$NprocChips,$NprocWarps,$Nalready) = pre_stack_queue($date,$target,$filter); 1195 1209 if ((!defined($force_stack_count))&&($NprocChips != $NprocWarps)) { # This makes me sad. :( … … 1231 1245 } 1232 1246 } 1247 else { 1248 # print STDERR "execute_stacks: Target $target is not auto-stackable.\n"; 1249 } 1233 1250 } 1234 else { 1235 # print STDERR "execute_stacks: Target $target is not auto-stackable.\n"; 1236 } 1237 } 1238 1251 } 1239 1252 } 1240 1253 … … 1291 1304 1292 1305 # 1306 # Extra processing 1307 ################################################################################ 1308 1309 sub do_extra_processing { 1310 my $date = shift; 1311 my $target = shift; 1312 my $filter = shift; 1313 my $pretend = shift; 1314 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1315 1316 if ($target eq 'OSS') { 1317 my $db = init_gpc_db(); 1318 1319 my $obj_sth = "select DISTINCT rawExp.object from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1320 $obj_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' ORDER BY rawExp.object"; 1321 print STDERR "$obj_sth\n"; 1322 my $object_ref = $db->selectall_arrayref( $obj_sth ); 1323 1324 foreach my $object_row (@{ $object_ref }) { 1325 my $this_object = shift @{ $object_row }; 1326 my $input_sth = "select exp_id,warp_id,dateobs from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1327 $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1328 $input_sth .= " ORDER BY dateobs "; 1329 1330 my $warps = $db->selectall_arrayref( $input_sth ); 1331 1332 if (($#{ $warps } + 1) % 2 != 0) { 1333 print STDERR "Number of input warps to make OSS diffs is not even! $#{ $warps }\n"; 1334 die; 1335 } 1336 1337 while ($#{ $warps } > -1) { 1338 my $input_warp = shift @{ $warps }; 1339 my $template_warp = shift @{ $warps }; 1340 my $input_exp_id = ${ $input_warp }[0]; 1341 my $template_exp_id = ${ $template_warp }[0]; 1342 1343 my $cmd = "$difftool -dbname $dbname -definewarpwarp "; 1344 $cmd .= "-input_label $label -template_label $label "; 1345 $cmd .= "-backwards "; # Needed because difftool assumes a different date sorting. 1346 $cmd .= "-set_workdir $workdir -set_dist_group $dist_group -set_data_group $data_group "; 1347 $cmd .= " -simple -set_label $label -exp_id $input_exp_id -template_exp_id $template_exp_id "; 1348 # $cmd .= " -pretend "; 1349 if (defined($pretend)) { 1350 $cmd .= ' -pretend '; 1351 } 1352 if ($debug == 1) { 1353 $cmd .= ' -pretend '; 1354 } 1355 print STDERR "EXTRA_PROCESSING: $cmd\n"; 1356 if (($debug == 0)&&(!defined($pretend))) { 1357 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1358 run ( command => $cmd, verbose => $verbose ); 1359 unless ($success) { 1360 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1361 &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1362 } 1363 } 1364 } 1365 } 1366 } 1367 } 1368 1369 1370 1371 1372 # 1293 1373 # Auto-Clean 1294 1374 ################################################################################ … … 1380 1460 my $object = $object_list{$target}; 1381 1461 my $comment = $comment_list{$target}; 1382 my $dist_group = $ target;1462 my $dist_group = $distribution_list{$target}; 1383 1463 my $data_group = "${target}.${trunc_date}"; 1384 1464 my $tess_id = $tessID_list{$target}; … … 1427 1507 my $N = $metadata_out{N_MACROS}; 1428 1508 $metadata_out{"ns${N}Macro"} = $macro_formats{$proc_mode}; 1429 print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n";1509 # print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n"; 1430 1510 if (defined($date)&&(defined($target))) { 1431 1511 -
branches/eam_branches/ipp-20100823/ippScripts/scripts/ipp_apply_burntool.pl
r27299 r29515 55 55 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 56 56 my $nebXattr = can_run('neb-xattr') or (warn "Can't find neb-xattr" and $missing_tools = 1); 57 my $nebreplicate = can_run('neb-replicate') or (warn "Can't find neb-replicate" and $missing_tools = 1); 57 58 #my $fpack = can_run('fpack') or (warn "Can't find fpack" and $missing_tools = 1); 58 59 if ($missing_tools) { … … 214 215 215 216 $status = vsystem ("$nebXattr --write $outTable user.copies:2",$REALRUN); 217 $status = vsystem ("$nebreplicate --set_copies 2 $outTable",$REALRUN); 216 218 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state $outState", $REALRUN); 217 219 if ($status) { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/ipp_cleanup.pl
r27959 r29515 53 53 } 54 54 55 # set this to 1 to enable checking for files on dead nodes 56 # it is off for now because the implementation is a hack 57 # See comments below. 58 my $check_for_gone = 0; 59 55 60 my $error_state; 56 if ($mode eq "goto_cleaned") { $error_state = "error_cleaned"; } 57 if ($mode eq "goto_scrubbed") { $error_state = "error_scrubbed"; } 58 if ($mode eq "goto_purged") { $error_state = "error_purged"; } 61 my $done_state; 62 if ($mode eq "goto_cleaned") { $error_state = "error_cleaned"; $done_state = "cleaned"; } 63 if ($mode eq "goto_scrubbed") { $error_state = "error_scrubbed"; $done_state = "scrubbed";} 64 if ($mode eq "goto_purged") { $error_state = "error_purged"; $done_state = "purged";} 59 65 60 66 … … 92 98 } 93 99 94 # if there are no chipProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 95 # XXX Why? This could just mean there's nothing to cleanup, or that we're trying to rerun an errored run. 100 # if there are no chipProcessedImfiles (@$stdout_buf == 0) then assume that we're done 101 # it could be that there are no chipProcessedImfiles at all if say if a run was changed from drop to goto_cleaned 102 # or of a run was set to update and then back to goto_cleaned before any images were processed 96 103 if (@$stdout_buf == 0) { 97 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $ error_state";104 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $done_state"; 98 105 $command .= " -dbname $dbname" if defined $dbname; 99 106 … … 126 133 127 134 unless ($ipprc->file_exists($config_file)) { 128 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 129 . " because config file ($config_file) is missing\n"; 130 $status = 0; 135 if (file_gone($config_file)) { 136 print STDERR "forcing cleanup for chipRun $stage_id $class_id " 137 . " because config file ($config_file) is gone\n"; 138 } else { 139 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 140 . " because config file ($config_file) is missing\n"; 141 $status = 0; 142 } 131 143 } 132 144 } … … 354 366 355 367 if (@$stdout_buf == 0) { 356 # No skycells were found for some reason. 357 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 358 my $command = "$warptool -updaterun -warp_id $stage_id -set_state $error_state"; 368 # No skycells were found for some reason. 369 # it could be that there are no warpSkyfiles at all if say if a run was changed from drop to goto_cleaned 370 # or of a run was cleaned, set to update, and then back to goto_cleaned before any images were successfully 371 # updated 372 my $command = "$warptool -updaterun -warp_id $stage_id -set_state $done_state"; 359 373 $command .= " -dbname $dbname" if defined $dbname; 360 374 … … 384 398 385 399 unless ($ipprc->file_exists($config_file)) { 386 print STDERR "skipping cleanup for warpRun $stage_id $skycell_id" . 387 " because config file is missing\n"; 388 $status = 0; 400 if (file_gone($config_file)) { 401 print STDERR "forcing cleanup for warpRun $stage_id $skycell_id" . 402 " because config file is gone\n"; 403 } else { 404 print STDERR "skipping cleanup for warpRun $stage_id $skycell_id" . 405 " because config file is missing\n"; 406 $status = 0; 407 } 389 408 } 390 409 } … … 624 643 625 644 if (@$stdout_buf == 0) { 626 # No skycells were found for some reason. 627 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 628 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $error_state"; 645 # No skycells were found for some reason. 646 # it could be that there are no warpSkyfiles at all if say if a run was changed from drop to goto_cleaned 647 # or of a run was cleaned, set to update, and then back to goto_cleaned before any images were successfully 648 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $done_state"; 629 649 $command .= " -dbname $dbname" if defined $dbname; 630 650 … … 658 678 659 679 unless ($ipprc->file_exists($config_file)) { 660 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 661 " because config file ($config_file) is missing\n"; 662 $status = 0; 680 if (file_gone($config_file)) { 681 print STDERR "forcing cleanup for diffRun $stage_id $skycell_id" . 682 " because config file ($config_file) is gone\n"; 683 } else { 684 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 685 " because config file ($config_file) is missing\n"; 686 $status = 0; 687 } 663 688 } 664 689 } … … 1665 1690 } 1666 1691 1692 my $whichnode; 1693 sub file_gone 1694 { 1695 # if $check_for_gone check whether the only instance of file is on a lost volumen 1696 # XXX: we don't have a proper interface for this. 1697 # For now try to use Bill's hack the script 'whichnode' 1698 return 0 if !$check_for_gone; 1699 1700 my $file = shift; 1701 1702 if (!$whichnode) { 1703 $whichnode = can_run('whichnode') or 1704 &my_die("Can't find whichnode", "chip", $stage_id, $PS_EXIT_CONFIG_ERROR); 1705 } 1706 1707 my $command = "$whichnode $file"; 1708 1709 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1710 run(command => $command, verbose => $verbose); 1711 unless ($success) { 1712 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1713 &my_die("Unable to perform whichnode: $error_code", "chip", $stage_id, $error_code); 1714 } 1715 1716 my @lines = split "\n", (join "", @$stdout_buf); 1717 my $numGone = 0; 1718 my $numNotGone = 0; 1719 foreach my $line (@lines) { 1720 chomp $line; 1721 1722 # output lines are either 1723 # "volume available" 1724 # or 1725 # "volume not available" 1726 1727 my ($volume, $answer, undef) = split " ", $line; 1728 # our hack is if the volume has an X in the name it's gone 1729 if ($volume =~ /X/) { 1730 print STDERR "$file is on $volume which is gone\n"; 1731 $numGone++; 1732 } elsif ($answer eq 'not') { 1733 print STDERR "$file is on $volume which is not available\n"; 1734 $numNotGone++; 1735 } else { 1736 print STDERR "unexpected output from whichnode: $line\n"; 1737 } 1738 } 1739 # if there are any instances that are not on a gone node return 0 1740 if ($numNotGone == 0 and $numGone > 0) { 1741 return 1; 1742 } else { 1743 return 0; 1744 } 1745 } 1746 1667 1747 sub addFilename 1668 1748 { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_destreak.pl
r28931 r29515 42 42 # Parse the command-line arguments 43 43 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base, $cam_reduction); 44 my ($streaks_path_base, $inv_streaks_path_base); 44 45 my ($outroot, $recoveryroot, $magicked); 45 46 my ($replace, $release); … … 49 50 'magic_ds_id=s' => \$magic_ds_id,# Magic destreak run identifier 50 51 'camera=s' => \$camera, # camera for evaluating file rules 52 'streaks_path_base=s' => \$streaks_path_base, # path_base for streaks data 53 'inv_streaks_path_base=s' => \$inv_streaks_path_base, #path_base for streaks from inverse diff 54 'inv_streaks=s' => \$inv_streaks,# file containing the list of streaks from the inverse diff 51 55 'streaks=s' => \$streaks, # file containing the list of streaks 52 56 'inv_streaks=s' => \$inv_streaks,# file containing the list of streaks from the inverse diff … … 78 82 defined $camera and 79 83 defined $streaks and 84 defined $streaks_path_base and 80 85 defined $stage and 81 86 defined $stage_id and … … 108 113 &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 109 114 } 115 $inv_streaks_path_base = undef if defined($inv_streaks_path_base) and ($inv_streaks_path_base eq "NULL"); 110 116 $inv_streaks = undef if defined($inv_streaks) and ($inv_streaks eq "NULL"); 111 117 … … 240 246 my ($allstreaks_fh, $allstreaks_name); 241 247 248 # Set name of streaks files from their path_base. Note. ne 'NULL' test is for backward compatability 249 # with runs that don't have path_base set yet 250 if ($streaks_path_base ne 'NULL') { 251 $streaks = "$streaks_path_base.streaks"; 252 } 253 if ($inv_streaks_path_base and ($inv_streaks_path_base ne 'NULL')) { 254 $inv_streaks = "$inv_streaks_path_base.streaks"; 255 } 256 257 my $streaks_resolved = $ipprc->file_resolve($streaks) or &my_die("failed to resolve streaks file $streaks", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR); 258 my $inv_streaks_resolved; 259 if ($inv_streaks) { 260 $inv_streaks_resolved = $ipprc->file_resolve($inv_streaks) or &my_die("failed to resolve inverse streaks file $inv_streaks", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR); 261 } 262 263 242 264 if ($stage eq "raw") { 243 265 $image = $uri; … … 301 323 $sources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $path_base); 302 324 303 if ($inv_streaks ) {325 if ($inv_streaks_resolved) { 304 326 # create a temporary file containing the contents of the 305 327 # two streaks files … … 307 329 UNLINK => !$save_temps); 308 330 309 combine_streaks($allstreaks_fh, $streaks , $inv_streaks);331 combine_streaks($allstreaks_fh, $streaks_resolved, $inv_streaks_resolved); 310 332 311 333 # apply the combined streaks to both the forward and inverse diffs 312 $streaks = $allstreaks_name;334 $streaks_resolved = $allstreaks_name; 313 335 } 314 336 } 315 337 316 338 { 317 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image";339 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks_resolved -image $image"; 318 340 319 341 $command .= " -stats $statsFile"; … … 340 362 } 341 363 } 342 if (($stage eq "diff") and $inv_streaks ) {364 if (($stage eq "diff") and $inv_streaks_resolved) { 343 365 $image = $ipprc->filename("PPSUB.INVERSE", $path_base); 344 366 $mask = $ipprc->filename("PPSUB.INVERSE.MASK", $path_base); … … 349 371 my $invStatsFile = "$outroot/$exp_id.mds.$magic_ds_id.$stage_id.$component.inv.stats"; 350 372 351 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image";373 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks_resolved -image $image"; 352 374 $command .= " -stats $invStatsFile"; 353 375 -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_process.pl
r28137 r29515 17 17 use IPC::Cmd 0.36 qw( can_run run ); 18 18 use File::Temp qw( tempfile ); 19 use File::Copy; 19 20 use PS::IPP::Metadata::Config; 20 21 use PS::IPP::Metadata::List qw( parse_md_list ); … … 41 42 42 43 # Parse the command-line arguments 43 my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile );44 my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile, $final_outroot); 44 45 45 46 GetOptions( … … 49 50 'dbname=s' => \$dbname, # Database name 50 51 'baseroot=s' => \$baseroot, # Output root name 52 'final-outroot=s' => \$final_outroot, # location for final outputs 51 53 'save-temps' => \$save_temps, # Save temporary files? 52 54 'verbose' => \$verbose, # Print stuff? … … 86 88 87 89 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 90 91 # list of VerifyStreaks input and output files to copy to nebulous 92 my @verify_outputs = qw( 93 clusterPos.txt 94 duplicate.png 95 mask.png 96 original.png 97 original.fits 98 residual.png 99 residual.fits 100 clusters.list 101 ); 88 102 89 103 ### Get a list of inputs … … 311 325 } 312 326 313 314 327 ### Input result into database 315 328 { … … 334 347 335 348 if ($node eq "root") { 349 # XXXX: Since we just added the result above, all of these my_dies are going to fail 350 # with a duplicate row error. 351 # see more comments below 336 352 my $streaks_file = "$outroot.streaks"; 337 353 my $resolved = $ipprc->file_resolve($streaks_file); … … 349 365 } 350 366 351 &run_verifystreaks($baseroot);352 367 353 368 my $exp_id; # Exposure identifier … … 366 381 } 367 382 383 &run_verifystreaks($baseroot, $exp_id); 384 368 385 { 369 386 my $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path); # Astrometry file … … 383 400 } 384 401 402 my $output_streaks = $final_outroot . ".streaks"; 403 if ($output_streaks and ($output_streaks ne $streaks_file)) { 404 copy_to_nebulous($ipprc, $streaks_file, $output_streaks, 1); 405 foreach my $f (@verify_outputs) { 406 my $src = "$baseroot.verify/${exp_id}_$f"; 407 my $dest = "$final_outroot.${f}"; 408 copy_to_nebulous($ipprc, $src, $dest, 1); 409 } 410 } else { 411 $output_streaks = $streaks_file; 412 } 385 413 386 414 { 387 415 my $command = "$magictool -addmask"; 388 416 $command .= " -magic_id $magic_id"; 389 $command .= " - uri $streaks_file";417 $command .= " -path_base $final_outroot"; 390 418 $command .= " -streaks $num_streaks"; 391 419 $command .= " -dbname $dbname" if defined $dbname; … … 397 425 unless ($success) { 398 426 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 399 # This isn't going to work because our result was already entered. 427 # XXX: This my_die isn't going to work because the result for the root node was already 428 # added to the database up above. 429 # There is a magicMask has a fault column. Maybe we should 430 # use that and add a new revert mode that deletes the magicMask and the magicNodeResult 431 # for the root node. 400 432 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 401 433 } … … 406 438 } 407 439 440 408 441 ### Pau. 409 442 … … 411 444 412 445 my $baseroot = shift; 446 my $exp_id = shift; 413 447 414 448 unless ($VerifyStreaks) { … … 431 465 my @files = <$baseroot.*.clusters>; 432 466 433 unless (open ($FILE, ">$outdir/clusters.list")) { 434 print "failed to create cluster file $outdir/clusters.list\n"; 467 my $clusters_list = "$outdir/${exp_id}_clusters.list"; 468 unless (open ($FILE, ">$clusters_list")) { 469 print "failed to create cluster file $clusters_list\n"; 435 470 return 1; 436 471 } … … 441 476 close ($FILE); 442 477 if ($status) { 443 print "failed to create cluster file $ outdir/clusters.list\n";478 print "failed to create cluster file $clusters_list\n"; 444 479 return 1; 445 480 } 446 481 447 my $command = "$VerifyStreaks --out $outdir --clusters $ outdir/clusters.list $baseroot.root.streakMap";482 my $command = "$VerifyStreaks --out $outdir --clusters $clusters_list $baseroot.root.streakMap"; 448 483 449 484 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 513 548 } 514 549 550 # Copy a file to nebulous and optionally replicate it 551 # We should consider making this an ipprc function. For now try it here so we can print 552 # the right error messages 553 sub copy_to_nebulous { 554 my $ipprc = shift; 555 my $src = shift; 556 my $dest = shift; 557 my $replicate = shift; 558 559 print "copying $src to $dest\n"; 560 561 $ipprc->file_exists($src) or 562 &my_die("expected output file does not exist: $src", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 563 564 # copy the file to it's final destination - which is presumably in nebulous 565 # we delete it so that all instances are deleted in case it has been replicated 566 if ($ipprc->file_exists($dest)) { 567 $ipprc->file_delete($dest) or 568 &my_die("failed to delete existing file: $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 569 } 570 my $dest_resolved = $ipprc->file_resolve($dest, 'create'); 571 &my_die("failed to resolve $dest", $PS_EXIT_UNKNOWN_ERROR) if !$dest_resolved; 572 573 copy ($src, $dest_resolved) or 574 &my_die("failed to copy $src to $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 575 576 if ($replicate and (file_scheme($dest) eq 'neb')) { 577 my $neb = $ipprc->nebulous(); 578 $neb->setxattr($dest, 'user.copies', 2, 'create') or 579 &my_die("failed to set user.copies for $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 580 581 $neb->replicate($dest) or 582 &my_die("failed to replicate $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 583 } 584 } 585 515 586 sub my_die 516 587 { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_tree.pl
r27718 r29515 83 83 unless ($success) { 84 84 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 85 &my_die("Unable to perform magictool -inputfile: $error_code", $magic_id, $error_code); 86 } 87 88 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 85 &my_die("Unable to perform magictool -inputskyfile: $error_code", $magic_id, $error_code); 86 } 87 88 my $magictool_output = join "", @$stdout_buf; 89 # if there is no output from magictool that means that there are no 90 # diffSkyfiles with non-zero quality. Set fault to a special value so 91 # that these magicRuns can be recognized and dropped. 92 &my_die("magictool -inputskyfile returned no output. Inputs are probably all bad quality.", $magic_id, 42) 93 if !$magictool_output; 94 my $metadata = $mdcParser->parse($magictool_output) or 89 95 &my_die("Unable to parse metadata config doc", $magic_id, $PS_EXIT_PROG_ERROR); 90 96
Note:
See TracChangeset
for help on using the changeset viewer.
