Changeset 35787 for trunk/ippScripts/scripts/ipp_cleanup.pl
- Timestamp:
- Jul 10, 2013, 9:55:17 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_cleanup.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_cleanup.pl
r35465 r35787 202 202 print STDERR "\nSTDOUT:\n" . join "", @$stdout_buf; 203 203 print STDERR "\nSTDERR:\n" . join "", @$stderr_buf; 204 &my_die("Unable to perform censorObjects -checkinputonly: $error_code", "chip", $stage_id, $error_code); 204 # smf file is probably corrupt. Carry on. We will not clean sources unless another good smf is found 205 # &my_die("Unable to perform censorObjects -checkinputonly: $error_code", "chip", $stage_id, $error_code); 206 next; 205 207 } 206 208 $good_smf++; … … 374 376 # the imfiles being in the cleaned state. 375 377 # Due to missing files we don't always clean individual components. 376 # unless there was an error set state to $done_state378 # So unless there was an error set state to $done_state 377 379 if (!$set_error_state_for_run or $num_errors eq 0) { 378 380 # set state to $done_state … … 1916 1918 } 1917 1919 1918 # XXX: Is not having any files to process really a bug? 1919 if ( @$stdout_buf == 0) {1920 # XXX: Is not having any files to process really a bug? NO 1921 if (0 and @$stdout_buf == 0) { 1920 1922 my $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $error_state"; 1921 1923 $command .= " -dbname $dbname" if defined $dbname; … … 1935 1937 1936 1938 # loop over all of the imfiles, determine the path_base and class_id for each 1939 my $num_errors = 0; 1940 my $num_updated = 0; 1937 1941 foreach my $imfile (@$imfiles) { 1938 1942 my $class_id = $imfile->{class_id}; … … 1989 1993 1990 1994 if ($status) { 1995 $num_updated++; 1991 1996 my $command = "$bgtool -chip_bg_id $stage_id -class_id $class_id"; 1992 1997 if ($mode eq "goto_cleaned") { … … 2010 2015 2011 2016 } else { 2012 2013 # if an error happens for one chip, the chipBackgroundRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 2014 my $command = "$bgtool -updatechipimfile -chip_bg_id $stage_id -class_id $class_id -set_data_state $error_state"; 2015 $command .= " -dbname $dbname" if defined $dbname; 2016 2017 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2017 $num_errors++; 2018 2019 if ($set_error_state_for_file) { 2020 # if an error happens for one chip, the chipBackgroundRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 2021 my $command = "$bgtool -updatechipimfile -chip_bg_id $stage_id -class_id $class_id -set_data_state $error_state"; 2022 $command .= " -dbname $dbname" if defined $dbname; 2023 2024 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2025 run(command => $command, verbose => $verbose); 2026 unless ($success) { 2027 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2028 &my_die("Unable to perform bgtool: $error_code", "chip_bg", $stage_id, $error_code); 2029 } 2030 } 2031 if ($set_error_state_for_run) { 2032 2033 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 2034 $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $error_state"; 2035 $command .= " -dbname $dbname" if defined $dbname; 2036 2037 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2018 2038 run(command => $command, verbose => $verbose); 2019 unless ($success) { 2020 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2021 &my_die("Unable to perform bgtool: $error_code", "chip_bg", $stage_id, $error_code); 2022 } 2023 2024 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 2025 $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $error_state"; 2026 $command .= " -dbname $dbname" if defined $dbname; 2027 2028 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2029 run(command => $command, verbose => $verbose); 2030 unless ($success) { 2031 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2032 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 2033 } 2034 2035 } 2036 } 2039 unless ($success) { 2040 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2041 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 2042 } 2043 2044 } 2045 } 2046 } 2047 if (!$set_error_state_for_run or ($num_errors eq 0)) { 2048 # Set run to done state 2049 my $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $done_state"; 2050 $command .= " -dbname $dbname" if defined $dbname; 2051 2052 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2053 run(command => $command, verbose => $verbose); 2054 unless ($success) { 2055 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2056 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 2057 } 2058 } 2059 print "Cleanup completed for chip_bg_id $stage_id. num_updated: $num_updated"; 2060 print " num_errors: $num_errors" if $num_errors; 2061 print "\n"; 2037 2062 exit 0; 2038 2063 } … … 2060 2085 } 2061 2086 2062 # XXX: Is not having any files to process really a bug? 2063 if ( @$stdout_buf == 0) {2087 # XXX: Is not having any files to process really a bug? NO 2088 if (0 and @$stdout_buf == 0) { 2064 2089 my $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $error_state"; 2065 2090 $command .= " -dbname $dbname" if defined $dbname; … … 2079 2104 2080 2105 # loop over all of the imfiles, determine the path_base and skycell_id for each 2106 my $num_errors = 0; 2107 my $num_updated = 0; 2081 2108 foreach my $imfile (@$imfiles) { 2082 2109 my $skycell_id = $imfile->{skycell_id}; … … 2096 2123 print STDERR "forcing cleanup for warpBackgroundSkyfile $stage_id $skycell_id " 2097 2124 . " because config file ($config_file) is gone\n"; 2125 } elsif ($imfile->{fault}) { 2126 print STDERR "forcing cleanup for faulted warpBackgroundSkyfile\n"; 2098 2127 } else { 2099 2128 print STDERR "skipping cleanup for warpBackgroundSkyfile $stage_id $skycell_id " … … 2103 2132 } 2104 2133 } 2105 elsif ($mode eq "goto_scrubbed") {2106 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id);2107 2108 if ($ipprc->file_exists($config_file)) {2109 print STDERR "skipping scrubbed for chipBackgroundRun $stage_id $skycell_id "2110 . " because config file ($config_file) is present\n";2111 $status = 0;2112 }2113 }2114 2134 } 2115 2135 … … 2133 2153 2134 2154 if ($status) { 2155 $num_updated++; 2135 2156 my $command = "$bgtool -warp_bg_id $stage_id -skycell_id $skycell_id"; 2136 2157 # recall that only goto_cleaned is supported (currently) … … 2156 2177 } else { 2157 2178 2158 # if an error happens for one skycell, the warpBackgroundRun will stay in goto_*, but the skycells will go to error_* (matching the goto_*) 2159 my $command = "$bgtool -updatewarpskyfile -warp_bg_id $stage_id -skycell_id $skycell_id -set_state $error_state"; 2160 $command .= " -dbname $dbname" if defined $dbname; 2161 2162 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2179 $num_errors++; 2180 2181 # NOTE: bgtool does not support -updatewarpskyfile 2182 if (0) { 2183 # if an error happens for one skycell, the warpBackgroundRun will stay in goto_*, but the skycells will go to error_* (matching the goto_*) 2184 my $command = "$bgtool -updatewarpskyfile -warp_bg_id $stage_id -skycell_id $skycell_id -set_state $error_state"; 2185 $command .= " -dbname $dbname" if defined $dbname; 2186 2187 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2188 run(command => $command, verbose => $verbose); 2189 unless ($success) { 2190 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2191 &my_die("Unable to perform bgtool: $error_code", "warp_bg", $stage_id, $error_code); 2192 } 2193 } 2194 2195 if ($set_error_state_for_run) { 2196 2197 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 2198 $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $error_state"; 2199 $command .= " -dbname $dbname" if defined $dbname; 2200 2201 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2163 2202 run(command => $command, verbose => $verbose); 2164 unless ($success) { 2165 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2166 &my_die("Unable to perform bgtool: $error_code", "warp_bg", $stage_id, $error_code); 2167 } 2168 2169 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 2170 $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $error_state"; 2171 $command .= " -dbname $dbname" if defined $dbname; 2172 2173 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2174 run(command => $command, verbose => $verbose); 2175 unless ($success) { 2176 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2177 &my_die("Unable to perform bgtool: $error_code", "warp", $stage_id, $error_code); 2178 } 2179 } 2180 } 2203 unless ($success) { 2204 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2205 &my_die("Unable to perform bgtool: $error_code", "warp", $stage_id, $error_code); 2206 } 2207 } 2208 } 2209 } 2210 if (($num_errors == 0) || !$set_error_state_for_run) { 2211 # Set run to done state 2212 my $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $done_state"; 2213 $command .= " -dbname $dbname" if defined $dbname; 2214 2215 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2216 run(command => $command, verbose => $verbose); 2217 unless ($success) { 2218 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2219 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 2220 } 2221 } 2222 print "Cleanup completed for warp_bg_id $stage_id. num_updated: $num_updated"; 2223 print " num_errors: $num_errors" if $num_errors; 2224 print "\n"; 2181 2225 exit 0; 2182 2226 }
Note:
See TracChangeset
for help on using the changeset viewer.
