Changeset 27860 for trunk/ippScripts/scripts/automate_stacks.pl
- Timestamp:
- May 4, 2010, 6:07:38 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/automate_stacks.pl (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/automate_stacks.pl
r27712 r27860 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 } … … 731 762 my $date = shift; 732 763 my $target = shift; 764 my $mode = shift; 765 766 my $command = $clean_commands{$mode}; 767 my $retention_time = $clean_retention{$mode}; 733 768 734 769 my ($year,$month,$day) = split /-/,$date; … … 740 775 741 776 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 ";777 my $args = $command; 778 $args .= " -dbname gpc1 -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group "; 744 779 if ($debug == 1) { 745 780 $args .= ' -pretend '; … … 752 787 my $pretend = shift; 753 788 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)) { 789 foreach my $mode (keys (%clean_commands)) { 790 foreach my $target (@target_list) { 791 if (exists($noclean_list{$target})) { 792 next; 793 } 794 my ($cleaning_date,$command) = construct_cleantool_args($date,$target,$mode); 795 796 print STDERR "$command\n"; 797 if (!(defined($pretend) || $debug == 1)) { 760 798 # 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 } 799 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 800 run ( command => $command, verbose => $verbose ); 801 unless ($success) { 802 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 803 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 804 } 805 } 806 } 779 807 } 780 808 return(0);
Note:
See TracChangeset
for help on using the changeset viewer.
