Changeset 28017 for branches/czw_branch/20100427/ippScripts/scripts
- Timestamp:
- May 18, 2010, 5:06:01 PM (16 years ago)
- Location:
- branches/czw_branch/20100427
- Files:
-
- 13 edited
- 1 copied
-
. (modified) (1 prop)
-
ippScripts/scripts/automate_stacks.pl (modified) (16 diffs)
-
ippScripts/scripts/camera_exp.pl (modified) (1 diff)
-
ippScripts/scripts/diff_skycell.pl (modified) (1 diff)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (5 diffs)
-
ippScripts/scripts/magic_destreak.pl (modified) (8 diffs)
-
ippScripts/scripts/magic_destreak_cleanup.pl (modified) (4 diffs)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (8 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (4 diffs)
-
ippScripts/scripts/make_burntool_pcontrol.pl (modified) (11 diffs)
-
ippScripts/scripts/receive_advance.pl (modified) (2 diffs)
-
ippScripts/scripts/register_exp.pl (modified) (1 diff)
-
ippScripts/scripts/register_imfile.pl (modified) (1 diff)
-
ippScripts/scripts/staticsky.pl (copied) (copied from trunk/ippScripts/scripts/staticsky.pl )
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100427
- Property svn:mergeinfo changed
-
branches/czw_branch/20100427/ippScripts/scripts/automate_stacks.pl
r27712 r28017 56 56 # Grab options 57 57 my ( $date, $camera, $dbname, $logfile, $verbose, $manual); 58 my ( $help, $isburning, $force_stack_count, $test_mode, $this_target_only, $this_filter_only );58 my ( $help, $isburning, $force_stack_count, $test_mode, $this_target_only, $this_filter_only, $check_mode); 59 59 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips); 60 60 my ( $check_stacks, $queue_stacks, $check_diffs, $queue_diffs, $clean_old); … … 70 70 'isburning' => \$isburning, 71 71 'force_stack_count' => \$force_stack_count, 72 'check' => \$check_mode, 72 73 'test_mode' => \$test_mode, 73 74 'this_target_only=s' => \$this_target_only, … … 116 117 defined $queue_chips or defined $queue_stacks or 117 118 defined $check_chips or defined $check_stacks or 118 defined $test_mode or defined $clean_old ;119 defined $test_mode or defined $clean_old or defined $check_mode; 119 120 120 121 # Configurable parameters from our config file. … … 127 128 my %stackable_list = (); 128 129 my %reduction_class = (); 129 my $retention_time = 9000; 130 130 my %clean_commands = (); 131 my %clean_retention = (); 132 my %noclean_list = (); 131 133 # Grab the configuration data. 132 134 my $conf_cmd = "$ppConfigDump -dump-recipe NIGHTLY_SCIENCE -"; … … 141 143 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 142 144 foreach my $entry (@{ $metadata }) { 143 if (${ $entry }{name} eq 'RETENTION_TIME') { 144 $retention_time = ${ $entry }{value}; 145 } 145 if (@{ $entry }{name} eq 'CLEAN_MODES') { 146 my @mode_data = @{ ${ $entry }{value} }; 147 my $this_mode = ''; 148 foreach my $mentry (@mode_data) { 149 if (${ $mentry }{name} eq 'MODE') { 150 $this_mode = ${ $mentry }{value}; 151 } 152 elsif (${ $mentry }{name} eq 'COMMAND') { 153 $clean_commands{$this_mode} = ${ $mentry }{value}; 154 } 155 elsif (${ $mentry }{name} eq 'RETENTION_TIME') { 156 $clean_retention{$this_mode} = ${ $mentry }{value}; 157 } 158 } 159 } 160 # if (${ $entry }{name} eq 'RETENTION_TIME') { 161 # $retention_time = ${ $entry }{value}; 162 # } 146 163 elsif (${ $entry }{name} eq 'FILTERS') { 147 164 push @filter_list, ${ $entry }{value}; … … 173 190 $reduction_class{$this_target} = ${ $tentry }{value}; 174 191 } 192 elsif (${ $tentry }{name} eq 'NOCLEAN') { 193 $noclean_list{$this_target} = ${ $tentry }{value}; 194 } 175 195 } 176 196 } … … 218 238 if (defined($test_mode)) { 219 239 $debug = 1; 220 } 221 222 if (defined($check_registration) || defined($test_mode)) { 240 my $z; 241 foreach $z (@target_list) { 242 print "TARGET: $z $tessID_list{$z} $obsmode_list{$z} $object_list{$z} $comment_list{$z} $stackable_list{$z} $reduction_class{$z}\n"; 243 } 244 foreach $z (@filter_list) { 245 print "FILTER: $z\n"; 246 } 247 foreach $z (keys (%clean_commands)) { 248 print "CLEAN: $z $clean_commands{$z} $clean_retention{$z}\n"; 249 } 250 251 } 252 253 if (defined($check_registration) || defined($test_mode) || defined($check_mode)) { 223 254 $metadata_out{nsState} = 'NEW'; 224 255 my ($Nsummit_exp,$Nfaults) = check_summit_copy($date); 225 256 return_metadata($date); 226 unless (defined($test_mode) ) { exit(0); }257 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 227 258 } 228 259 if (defined($define_burntool) || defined($test_mode)) { … … 237 268 unless (defined($test_mode)) { exit(0); } 238 269 } 239 if (defined($check_chips) || defined($test_mode) ) {270 if (defined($check_chips) || defined($test_mode) || defined($check_mode)) { 240 271 $metadata_out{nsState} = 'QUEUECHIPS'; 241 272 &execute_chips($date,"pretend"); … … 244 275 } 245 276 return_metadata($date); 246 unless (defined($test_mode) ) { exit(0); }277 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 247 278 } 248 279 if (defined($queue_chips)) { … … 252 283 exit(0); 253 284 } 254 if (defined($check_stacks) || defined($test_mode) ) {285 if (defined($check_stacks) || defined($test_mode) || defined($check_mode)) { 255 286 $metadata_out{nsState} = 'TOWARP'; 256 287 &execute_stacks($date,"pretend"); … … 259 290 } 260 291 return_metadata($date); 261 unless (defined($test_mode) ) { exit(0); }292 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 262 293 } 263 294 if (defined($queue_stacks)) { 264 295 $metadata_out{nsState} = 'STACKING'; 265 296 &execute_stacks($date); 266 if ($metadata_out{nsState} =='QUEUESTACKING') {297 if ($metadata_out{nsState} eq 'QUEUESTACKING') { 267 298 $metadata_out{nsState} = 'STACKING_POSSIBLE_ERROR'; 268 299 } … … 424 455 } 425 456 426 if ($#{ $stderr_buf } > -1) {427 $metadata_out{nsState} = 'ERROR';428 return(1);429 }457 # if ($#{ $stderr_buf } > -1) { 458 # $metadata_out{nsState} = 'ERROR'; 459 # return(1); 460 # } 430 461 431 462 my $N = 0; … … 433 464 foreach my $row (@burntool_entries) { 434 465 my ($trash,$start,$end); 435 ($trash,$trash,$start,$end) = (split /\s+/,$row); 436 466 (undef,$trash,$start,$end) = (split /\s+/,$row); 467 if ($trash ne 'burntool') { 468 $metadata_out{nsState} = 'ERROR'; 469 return(1); 470 } 437 471 for (my $class_counter = 0; $class_counter < 60; $class_counter++) { 438 472 $metadata_out{"bt${N}Begin"} = $start; … … 731 765 my $date = shift; 732 766 my $target = shift; 767 my $mode = shift; 768 769 my $command = $clean_commands{$mode}; 770 my $retention_time = $clean_retention{$mode}; 733 771 734 772 my ($year,$month,$day) = split /-/,$date; … … 740 778 741 779 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($cleaning_date,$target); 742 743 my $args .= " -dbname gpc1 -updaterun -set_state goto_cleaned -state full -data_group $data_group ";780 my $args = $command; 781 $args .= " -dbname gpc1 -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group "; 744 782 if ($debug == 1) { 745 783 $args .= ' -pretend '; … … 752 790 my $pretend = shift; 753 791 754 foreach my $target (@target_list) { 755 my ($cleaning_date,$args) = construct_cleantool_args($date,$target); 756 757 my $command = $chiptool . $args; 758 print STDERR "$command\n"; 759 if (!(defined($pretend) || $debug == 1)) { 792 foreach my $mode (keys (%clean_commands)) { 793 foreach my $target (@target_list) { 794 if (exists($noclean_list{$target})) { 795 next; 796 } 797 my ($cleaning_date,$command) = construct_cleantool_args($date,$target,$mode); 798 799 print STDERR "$command\n"; 800 if (!(defined($pretend) || $debug == 1)) { 760 801 # print STDERR "BEAR IS DRIVING!?\n"; 761 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 762 run ( command => $command, verbose => $verbose ); 763 unless ($success) { 764 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 765 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 766 } 767 } 768 $command = $warptool . $args; 769 print STDERR "$command\n"; 770 if (!(defined($pretend) || $debug == 1)) { 771 # print STDERR "BEAR IS DRIVING $pretend $debug!?\n"; 772 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 773 run ( command => $command, verbose => $verbose ); 774 unless ($success) { 775 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 776 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 777 } 778 } 802 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 803 run ( command => $command, verbose => $verbose ); 804 unless ($success) { 805 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 806 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 807 } 808 } 809 } 779 810 } 780 811 return(0); -
branches/czw_branch/20100427/ippScripts/scripts/camera_exp.pl
r27718 r28017 280 280 unless ($success) { 281 281 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 282 print STDERR (join "\n", @$stderr_buf); 282 283 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code); 283 284 } -
branches/czw_branch/20100427/ippScripts/scripts/diff_skycell.pl
r27784 r28017 399 399 $command .= " -hostname $host" if defined $host; 400 400 $command .= " -path_base $outroot" if defined $outroot; 401 $command .= " -dbname $dbname" if defined $dbname;402 401 } else { 403 402 $command .= " -updatediffskyfile"; 404 403 } 404 $command .= " -dbname $dbname" if defined $dbname; 405 405 run(command => $command, verbose => $verbose); 406 406 } -
branches/czw_branch/20100427/ippScripts/scripts/ipp_cleanup.pl
r27757 r28017 192 192 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 193 193 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 194 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned ";194 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 195 195 $command .= " -dbname $dbname" if defined $dbname; 196 196 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 309 309 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 310 310 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 311 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned ";311 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 312 312 $command .= " -dbname $dbname" if defined $dbname; 313 313 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 447 447 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 448 448 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 449 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned ";449 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 450 450 $command .= " -dbname $dbname" if defined $dbname; 451 451 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 581 581 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 582 582 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 583 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned ";583 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 584 584 $command .= " -dbname $dbname" if defined $dbname; 585 585 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 731 731 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 732 732 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 733 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned ";733 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 734 734 $command .= " -dbname $dbname" if defined $dbname; 735 735 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = -
branches/czw_branch/20100427/ippScripts/scripts/magic_destreak.pl
r27718 r28017 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 ($outroot, $recoveryroot );44 my ($outroot, $recoveryroot, $magicked); 45 45 my ($replace, $release); 46 46 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); … … 62 62 'recoveryroot=s' => \$recoveryroot,# "directory" for saving the images of excised pixels 63 63 'replace=s' => \$replace, # replace the input images with the results. 64 'magicked=s' => \$magicked, # magicked state of the run 64 65 'release' => \$release, # NAN masked pixels for release 65 66 'save-temps' => \$save_temps, # Save temporary files? … … 72 73 73 74 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 74 pod2usage( -msg => "Required options: --magic_ds_id --camera --streaks --stage --stage_id --component --uri --path_base --outroot ",75 pod2usage( -msg => "Required options: --magic_ds_id --camera --streaks --stage --stage_id --component --uri --path_base --outroot --magicked", 75 76 -exitval => 3) unless 76 77 defined $magic_ds_id and … … 83 84 defined $uri and 84 85 defined $path_base and 85 defined $outroot; 86 defined $outroot and 87 defined $magicked; 86 88 87 89 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR ); # IPP configuration … … 210 212 &my_die("Unable to parse metadata list", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 211 213 212 $temp_dir = tempdir( CLEANUP => !$save_temps);213 214 ($sfh, $skycell_list) = tempfile( "/tmp/skycell_list.XXXX", UNLINK => !$save_temps); 214 215 … … 219 220 } else { 220 221 # diff run must have been cleaned up, need to create this skycell file on the fly 222 if (!defined $temp_dir ) { 223 $temp_dir = tempdir( CLEANUP => !$save_temps); 224 } 221 225 my $skycell_id = $skycell->{skycell_id}; 222 226 $skycell_uri = "$temp_dir/$skycell_id"; … … 248 252 my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -"; 249 253 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 250 run(command => $command, verbose => $verbose); 254 # note verbose == 0 to avoid polluting log files with almost always useless information 255 run(command => $command, verbose => 0); 251 256 unless ($success) { 252 257 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 267 272 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); 268 273 269 if ($dynamicMasks) { 274 # if magicked is non-zero we are updating a previously magicked component. In this case we don't 275 # touch the camera mask 276 if (!$magicked and $dynamicMasks) { 270 277 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id); 271 278 $ch_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); -
branches/czw_branch/20100427/ippScripts/scripts/magic_destreak_cleanup.pl
r27718 r28017 63 63 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $PS_EXIT_SYS_ERROR ) if $logfile; 64 64 65 if (0) {66 my $nebulousServer = metadataLookupStr( $ipprc->{_siteConfig}, 'NEB_SERVER' );67 &my_die("cannot find NEB_SERVER in site configuration", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if !$nebulousServer;68 69 my $nebulous = eval { Nebulous::Client->new( proxy => $nebulousServer ); };70 if ($@ or not defined $nebulous) {71 &my_die ("Unable to create a Nebulous::Client object with proxy $nebulousServer", $magic_ds_id, $PS_EXIT_CONFIG_ERROR);72 }73 }74 65 75 66 $dbname = metadataLookupStr( $ipprc->{_siteConfig}, 'DBNAME' ) if !$dbname; … … 108 99 109 100 101 &my_die("cleanup not supported for camera stage", $magic_ds_id, $PS_EXIT_PROG_ERROR) if $stage eq "camera"; 102 103 110 104 &my_die("unexpected run state found: $state", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $state ne "goto_cleaned"; 111 105 &my_die("clean not allowed for raw stage, use goto_restore", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $stage eq "raw"; … … 130 124 $dbh->disconnect() or warn $dbh->errstr; 131 125 126 # We no longer clean up the camera stage mask files, but the code was left in place in case 127 # we change our minds. 128 my $cleanup_cam_mask = 0; 129 132 130 my $dynamicMasks; # Use dynamic masks? 133 131 foreach my $comp (@components) { … … 140 138 if ($stage eq "chip") { 141 139 # Check to see if we're using dynamic masks 142 if ( !defined $dynamicMasks) {140 if ($cleanup_cam_mask && !defined $dynamicMasks) { 143 141 # Get the PSASTRO recipe 144 142 my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -"; -
branches/czw_branch/20100427/ippScripts/scripts/magic_destreak_revert.pl
r27718 r28017 38 38 39 39 # Parse the command-line arguments 40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction );40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction, $magicked); 41 41 my ($outroot, $recoveryroot, $replace, $release, $bytes, $md5sum); 42 42 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); … … 55 55 'replace=s' => \$replace, # replace the input images with the results. 56 56 'bothways=s' => \$bothways, # run has inverse files (bothways diff) 57 'magicked=s' => \$magicked, # magicked state of the run 57 58 'save-temps' => \$save_temps, # Save temporary files? 58 59 'dbname=s' => \$dbname, # Database name … … 64 65 65 66 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 66 pod2usage( -msg => "Required options: --magic_ds_id --camera --stage --stage_id --component --path_base --outroot ",67 pod2usage( -msg => "Required options: --magic_ds_id --camera --stage --stage_id --component --path_base --outroot --magicked", 67 68 -exitval => 3) unless 68 69 defined $magic_ds_id and … … 72 73 defined $component and 73 74 defined $path_base and 75 defined $magicked and 74 76 defined $outroot; 75 77 … … 77 79 78 80 &my_die("cam_path_base is required for chip stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) if ($stage eq 'chip' and !$cam_path_base); 81 82 79 83 80 84 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR ); # IPP configuration … … 169 173 my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -"; 170 174 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 run(command => $command, verbose => $verbose); 175 # note verbose == 0 to keep from polluting log file with lots of usually useless information 176 run(command => $command, verbose => 0); 172 177 unless ($success) { 173 178 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 182 187 } 183 188 189 $image = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id); 190 $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id); 191 184 192 # we use the mask output from the camera stage for input and replace 185 193 # the output of the chip stage with that mask as well. 186 $image = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id); 187 $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id); 188 189 if ($dynamicMasks) { 194 # Note that when destreaking as part of an update $magicked is non-zero. 195 # In this case we do not touch the camera stage mask so there is no need to revert it 196 if (!$magicked and $dynamicMasks) { 190 197 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id); 191 198 $ch_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); … … 195 202 196 203 $bimage = $ipprc->filename("PPIMAGE.CHIP", $backup_path_base, $class_id); 197 # This is kludgey but correct204 # This is somewhat kludgey but it works whether the mask is camera mask or chip mask 198 205 $bmask = dirname($backup_path_base) . "/SR_" . basename($mask); 199 206 $bch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $backup_path_base, $class_id); -
branches/czw_branch/20100427/ippScripts/scripts/magic_process.pl
r27718 r28017 99 99 } 100 100 101 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or101 $inputs = $mdcParser->parse_list(join "", @$stdout_buf) or 102 102 &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR); 103 104 $inputs = parse_md_list($metadata) or105 &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR);106 103 } 107 104 108 105 109 106 my @outputs; 107 my $inverse; # Using inverse diff? 110 108 ### Do the heavy lifting 111 109 { … … 263 261 cat_list_to_list($mfh, $in_path_base, "mask.list"); 264 262 cat_list_to_list($wfh, $in_path_base, "weight.list"); 263 264 if ($innode->{inverse}) { 265 $inverse = 1; 266 } 265 267 } 266 268 close $in_fh; … … 330 332 } 331 333 } 334 332 335 if ($node eq "root") { 333 336 my $streaks_file = "$outroot.streaks"; … … 348 351 &run_verifystreaks($baseroot); 349 352 350 my $command = "$magictool -addmask"; 351 $command .= " -magic_id $magic_id"; 352 $command .= " -uri $streaks_file"; 353 $command .= " -streaks $num_streaks"; 354 $command .= " -dbname $dbname" if defined $dbname; 355 356 # Add the processed file to the database 357 unless ($no_update) { 353 my $exp_id; # Exposure identifier 354 my $cam_path; # Camera stage path_base 355 { 356 my $command = "magictool -exposure -magic_id $magic_id"; 357 $command .= " -inverse" if defined $inverse; 358 $command .= " -dbname $dbname" if defined $dbname; 358 359 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 359 360 run(command => $command, verbose => $verbose); 360 unless ($success) { 361 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 362 # This isn't going to work because our result was already entered. 363 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 364 } 365 } else { 366 print "Skipping command: $command\n"; 361 my $exposures = $mdcParser->parse_list(join "", @$stdout_buf); 362 my $exp = $$exposures[0]; # Exposure of interest (should only be one) 363 364 $exp_id = $exp->{exp_id}; 365 $cam_path = $exp->{path_base}; 366 } 367 368 { 369 my $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path); # Astrometry file 370 my $streaks = "$outroot.streaks"; # Streaks file 371 my $clusters = "$baseroot.verify/${exp_id}_clusterPos.txt"; # Clusters file 372 373 my $command = "ppCoord -astrom $astrom -streaks $streaks"; 374 if ($ipprc->file_exists($clusters)) { 375 $command .= " -clusters $clusters"; 376 } 377 378 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 379 run(command => $command, verbose => $verbose); 380 open my $coords, "> $outroot.coords"; 381 print $coords join("", @$stdout_buf); 382 close $coords; 383 } 384 385 386 { 387 my $command = "$magictool -addmask"; 388 $command .= " -magic_id $magic_id"; 389 $command .= " -uri $streaks_file"; 390 $command .= " -streaks $num_streaks"; 391 $command .= " -dbname $dbname" if defined $dbname; 392 393 # Add the processed file to the database 394 unless ($no_update) { 395 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 396 run(command => $command, verbose => $verbose); 397 unless ($success) { 398 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 399 # This isn't going to work because our result was already entered. 400 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 401 } 402 } else { 403 print "Skipping command: $command\n"; 404 } 367 405 } 368 406 } -
branches/czw_branch/20100427/ippScripts/scripts/make_burntool_pcontrol.pl
r27033 r28017 1 #!/usr/bin/ perl -w1 #!/usr/bin/env perl 2 2 # script to generate a pcontrol.pro file to run burntool on a set of data. 3 3 4 4 use DBI; 5 use warnings; 5 6 use DateTime; 6 7 use Getopt::Std; 8 use PS::IPP::Metadata::List qw( parse_md_list ); 9 use PS::IPP::Config 1.01 qw( :standard ); 10 use IPC::Cmd 0.36 qw( can_run run); 7 11 8 12 use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock'; … … 35 39 ) or die "Unable to connect to database $DBI::errstr\n"; 36 40 41 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 42 if ($missing_tools) { 43 die "Cannot find required tools."; 44 } 37 45 # Determine what the value of "BURNTOOL.STATE.GOOD" currently is: 38 46 $burntoolStateGood = 999; 39 open(LAZY," ppConfigDump -camera GPC1 -dump-camera - |") || die "Can't run ppConfigDump\n";47 open(LAZY,"$ppConfigDump -camera GPC1 -dump-camera - |") || die "Can't run ppConfigDump\n"; 40 48 while(<LAZY>) { 41 49 chomp; … … 46 54 } 47 55 close(LAZY); 48 #unless( $burntoolStateGood == 999) { 49 # print STDERR "GOOD == $burntoolStateGood\n"; 50 #} 51 52 53 # List of which obs_modes are "science" and which are something else. 54 %science = ('MD' => 1, '3PI' => 1, 'STS' => 1, 'CAL' => 1, 'M31' => 1, 'SS' => 1, 55 'ENGINEERING' => 0, 'NULL' => 0, 'Unknown' => 1, ' ' => 0); 56 57 # Read the nightly science config file and use that to determine which data is science 58 my $verbose = 0; 59 my $conf_cmd = "$ppConfigDump -dump-recipe NIGHTLY_SCIENCE -"; 60 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 61 run(command => $conf_cmd, verbose => $verbose); 62 unless ($success) { 63 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 64 &my_die("Unable to perform ppConfigDUmp: $error_code", $date, $PS_EXIT_SYS_ERROR); 65 } 66 67 my @target_list; 68 my %object_list; 69 my $comment_list; 70 71 my $mdcParser = PS::IPP::Metadata::Config->new; 72 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 73 foreach my $entry (@{ $metadata }) { 74 if (${ $entry }{name} eq 'TARGETS') { 75 my @target_data = @{ ${ $entry }{value} }; 76 my $this_target = ''; 77 78 foreach my $tentry (@target_data) { 79 if (${ $tentry }{name} eq 'NAME') { 80 $this_target = ${ $tentry }{value}; 81 push @target_list, $this_target; 82 $obsmode_list{$this_target} = '.*'; 83 $object_list{$this_target} = '.*'; 84 $comment_list{$this_target} = '.*'; 85 } 86 elsif (${ $tentry }{name} eq 'OBSMODE') { 87 $obsmode_list{$this_target} = ${ $tentry }{value}; 88 $obsmode_list{$this_target} =~ s/%//; 89 } 90 elsif (${ $tentry }{name} eq 'OBJECT') { 91 $object_list{$this_target} = ${ $tentry }{value}; 92 $object_list{$this_target} =~ s/%//; 93 } 94 elsif (${ $tentry }{name} eq 'COMMENT') { 95 $comment_list{$this_target} = ${ $tentry }{value}; 96 $comment_list{$this_target} =~ s/%//; 97 } 98 } 99 } 100 } 56 101 if (exists($opt{P})) { 57 $science{Unknown} = 1; 102 push @target_list, 'PR'; 103 $obsmode_list{'PR'} = 'Unknown'; 104 $object_list{'PR'} = '.*'; 105 $comment_list{'PR'} = '.*'; 58 106 } 59 107 … … 119 167 120 168 # Find _ALL_ observations within the date range we care about 121 $sth = "SELECT exp_id,dateobs,pon_time,exp_type,obs_mode,comment FROM rawExp WHERE " .169 $sth = "SELECT exp_id,dateobs,pon_time,exp_type,obs_mode,comment,object FROM rawExp WHERE " . 122 170 "dateobs >= '${date_min}' AND dateobs <= '${date_max}' order by dateobs"; 123 171 … … 133 181 foreach $row_ref (@{ $data_ref }) { 134 182 135 ($exp_id,$dateobs,$pontime,$exp_type,$obs_mode,$comment ) = @{ $row_ref };183 ($exp_id,$dateobs,$pontime,$exp_type,$obs_mode,$comment,$object) = @{ $row_ref }; 136 184 # Fix nulls in the database 137 185 if (!defined($obs_mode)) { 138 186 $obs_mode = ' '; 139 187 } 188 if (!defined($object)) { 189 $object = ' '; 190 } 140 191 if (!defined($comment)) { 141 192 $comment = ' '; … … 144 195 ($date,$time) = split / /, $dateobs; 145 196 ($year,$month,$day) = split /-/, $date; 146 ($hour,$minute,$second) = split /:/, $time; 197 ($hour,$minute,$second) = split /:/, $time; # / # This stops emacs run-on syntax highlights. 147 198 148 199 $dt = DateTime->new( year => $year, month => $month, day => $day, … … 155 206 $et = $dt->epoch(); 156 207 157 158 if (!exists($science{$obs_mode})) { 159 $science{$obs_mode} = 0; 160 } 161 if ((($science{$obs_mode} == 1)&&($comment !~ /Daytime/))|| 162 (($science{$obs_mode} == 0)&&( 163 ($comment =~ /MD/)||($comment =~ /ThreePi/)|| 164 ($comment =~ /STS/i)||($comment =~ /M31/)||($comment =~ /Stellar Transit/)|| 165 ($comment =~ /CAL/i)||($comment =~ /SS/)||($comment =~ /SVS/)|| 166 ($comment =~ /Sweetspot/)||($comment =~ /virgo/i)||($comment =~ /kepler/)|| 167 ($comment =~ /sdss/)))) 168 { 208 if (is_science($exp_type,$obs_mode,$object,$comment)) { 169 209 if ($start_s[-1] == 0) { 170 210 $start_s[-1] = $et - 1800; … … 194 234 # Scan again and count how many exposures are between windows 195 235 foreach $row_ref (@{ $data_ref }) { 196 ($exp_id,$dateobs,$pontime,$exp_type,$obs_mode,$comment ) = @{ $row_ref };236 ($exp_id,$dateobs,$pontime,$exp_type,$obs_mode,$comment,$object) = @{ $row_ref }; 197 237 if (!defined($obs_mode)) { 198 238 $obs_mode = ' '; … … 204 244 ($date,$time) = split / /, $dateobs; 205 245 ($year,$month,$day) = split /-/, $date; 206 ($hour,$minute,$second) = split /:/, $time; 246 ($hour,$minute,$second) = split /:/, $time; # / # another emacs syntax highlight bug. 207 247 208 248 $dt = DateTime->new( year => $year, month => $month, day => $day, … … 215 255 $et = $dt->epoch(); 216 256 217 if (!exists($science{$obs_mode})) {218 die "No mode >>$obs_mode<<\n";219 }220 221 257 for ($i = 0; $i <= $#start_s; $i++) { 222 if (($et < $start_s[$i])&&( $science{$obs_mode}== 0)) {258 if (($et < $start_s[$i])&&(is_science($exp_type,$obs_mode,$object,$comment) == 0)) { 223 259 if ($i == 0) { 224 260 $skips[$i]++; … … 278 314 unless(exists($opt{b}) || ($N_ranges == 0)) { 279 315 print_epilogue(); 316 } 317 318 319 # Subroutine to use the configuration file data and the exposure data to determine whether or not something is "science" 320 sub is_science { 321 # if (is_science($exp_type,$obs_mode,$object,$comment)) { 322 my ($exp_type,$obs_mode,$object,$comment) = @_; 323 my $return_value = 0; 324 unless($object) { 325 $object = ''; 326 } 327 if ($exp_type eq 'OBJECT') { 328 foreach my $target (@target_list) { 329 # print STDERR "$target $obsmode_list{$target} $exp_type $obs_mode $object $comment\n"; 330 if (($obs_mode =~ /$obsmode_list{$target}/)&& 331 ($object =~ /$object_list{$target}/)&& 332 ($comment =~ /$comment_list{$target}/)) { 333 $return_value = 1; 334 } 335 # print ">$return_value $exp_type $obs_mode $object $comment $target $obsmode_list{$target} $object_list{$target} $comment_list{$target}\n"; 336 if ($return_value) { 337 return($return_value); 338 } 339 } 340 } 341 return(0); 280 342 } 281 343 -
branches/czw_branch/20100427/ippScripts/scripts/receive_advance.pl
r27718 r28017 60 60 &my_die( "Unable to set up", $fileset_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 61 61 62 # update the fileset entry 63 64 if ($dbinfo_uri and ($dbinfo_uri ne "NULL")) { 62 my $import_run_to_db = 0; 63 if ($import_run_to_db and $dbinfo_uri and ($dbinfo_uri ne "NULL")) { 65 64 my $filename = basename($dbinfo_uri); 66 65 my ($stage) = $filename =~ m|^dbinfo\.(\S+)\.\d+\.mdc$|; # Stage of interest … … 102 101 } 103 102 103 # update the fileset entry 104 104 # All done 105 105 { -
branches/czw_branch/20100427/ippScripts/scripts/register_exp.pl
r27718 r28017 127 127 $command .= " -end_stage $end_stage" if defined $end_stage; 128 128 $command .= " -tess_id $tess_id" if defined $tess_id; 129 $command .= " -state full"; 129 130 $command .= " $cmdflags"; 130 131 -
branches/czw_branch/20100427/ippScripts/scripts/register_imfile.pl
r27718 r28017 174 174 $command .= " -hostname $host" if defined $host; 175 175 $command .= " -dbname $dbname" if defined $dbname; 176 $command .= " -data_state full"; 176 177 $command .= " $cmdflags"; 177 178
Note:
See TracChangeset
for help on using the changeset viewer.
